Skip to content

lint recursive enums #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
llogiq opened this issue Mar 22, 2016 · 2 comments
Closed

lint recursive enums #787

llogiq opened this issue Mar 22, 2016 · 2 comments

Comments

@llogiq
Copy link
Contributor

llogiq commented Mar 22, 2016

Those recently led to OOM in rustc nightly.

Basically lint enum variants containing fields of the same enum type, but stop checking within known pointer classes (box, syntax::ptr::P, ...)

@mcarton
Copy link
Member

mcarton commented Mar 22, 2016

Aren’t those forbidden anyway?

% cat a.rs
enum Foo {
    A,
    B(Foo),
}
% rustc a.rs
error: main function not found
a.rs:1:1: 4:2 error: recursive type `Foo` has infinite size [E0072]
a.rs:1 enum Foo {
a.rs:2     A,
a.rs:3     B(Foo),
a.rs:4 }
a.rs:1:1: 4:2 help: run `rustc --explain E0072` to see a detailed explanation
a.rs:1:1: 4:2 help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
error: aborting due to previous error

@llogiq
Copy link
Contributor Author

llogiq commented Mar 22, 2016

Ah, the problem was that the rustic lint runs after type checking... I was a bit confused because of Rust #32326.

@llogiq llogiq closed this as completed Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants