Skip to content

Commit

Permalink
Add a regression test for #57271
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Oct 7, 2019
1 parent 85b7aa2 commit c990744
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/ui/issues/auxiliary/issue-57271-lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum BaseType {
Byte,
Char,
Double,
Float,
Int,
Long,
Short,
Boolean,
}
24 changes: 24 additions & 0 deletions src/test/ui/issues/issue-57271.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// aux-build:issue-57271-lib.rs

extern crate issue_57271_lib;

use issue_57271_lib::BaseType;

pub enum ObjectType { //~ ERROR recursive type `ObjectType` has infinite size
Class(ClassTypeSignature),
Array(TypeSignature),
TypeVariable(()),
}

pub struct ClassTypeSignature {
pub package: (),
pub class: (),
pub inner: (),
}

pub enum TypeSignature { //~ ERROR recursive type `TypeSignature` has infinite size
Base(BaseType),
Object(ObjectType),
}

fn main() {}
25 changes: 25 additions & 0 deletions src/test/ui/issues/issue-57271.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error[E0072]: recursive type `ObjectType` has infinite size
--> $DIR/issue-57271.rs:7:1
|
LL | pub enum ObjectType {
| ^^^^^^^^^^^^^^^^^^^ recursive type has infinite size
LL | Class(ClassTypeSignature),
LL | Array(TypeSignature),
| ------------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ObjectType` representable

error[E0072]: recursive type `TypeSignature` has infinite size
--> $DIR/issue-57271.rs:19:1
|
LL | pub enum TypeSignature {
| ^^^^^^^^^^^^^^^^^^^^^^ recursive type has infinite size
LL | Base(BaseType),
LL | Object(ObjectType),
| ---------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `TypeSignature` representable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0072`.

0 comments on commit c990744

Please sign in to comment.