Skip to content

Commit c990744

Browse files
committed
Add a regression test for #57271
1 parent 85b7aa2 commit c990744

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
2+
pub enum BaseType {
3+
Byte,
4+
Char,
5+
Double,
6+
Float,
7+
Int,
8+
Long,
9+
Short,
10+
Boolean,
11+
}

src/test/ui/issues/issue-57271.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// aux-build:issue-57271-lib.rs
2+
3+
extern crate issue_57271_lib;
4+
5+
use issue_57271_lib::BaseType;
6+
7+
pub enum ObjectType { //~ ERROR recursive type `ObjectType` has infinite size
8+
Class(ClassTypeSignature),
9+
Array(TypeSignature),
10+
TypeVariable(()),
11+
}
12+
13+
pub struct ClassTypeSignature {
14+
pub package: (),
15+
pub class: (),
16+
pub inner: (),
17+
}
18+
19+
pub enum TypeSignature { //~ ERROR recursive type `TypeSignature` has infinite size
20+
Base(BaseType),
21+
Object(ObjectType),
22+
}
23+
24+
fn main() {}

src/test/ui/issues/issue-57271.stderr

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0072]: recursive type `ObjectType` has infinite size
2+
--> $DIR/issue-57271.rs:7:1
3+
|
4+
LL | pub enum ObjectType {
5+
| ^^^^^^^^^^^^^^^^^^^ recursive type has infinite size
6+
LL | Class(ClassTypeSignature),
7+
LL | Array(TypeSignature),
8+
| ------------- recursive without indirection
9+
|
10+
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ObjectType` representable
11+
12+
error[E0072]: recursive type `TypeSignature` has infinite size
13+
--> $DIR/issue-57271.rs:19:1
14+
|
15+
LL | pub enum TypeSignature {
16+
| ^^^^^^^^^^^^^^^^^^^^^^ recursive type has infinite size
17+
LL | Base(BaseType),
18+
LL | Object(ObjectType),
19+
| ---------- recursive without indirection
20+
|
21+
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `TypeSignature` representable
22+
23+
error: aborting due to 2 previous errors
24+
25+
For more information about this error, try `rustc --explain E0072`.

0 commit comments

Comments
 (0)