Add a regression test for #57271

This commit is contained in:
varkor 2019-10-07 22:24:04 +01:00
parent 85b7aa2cfb
commit c99074490b
3 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum BaseType {
Byte,
Char,
Double,
Float,
Int,
Long,
Short,
Boolean,
}

View file

@ -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() {}

View file

@ -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`.