Skip to content
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

ICE: failed to get layout for E: the type E has an unknown layout #35988

Closed
petrochenkov opened this issue Aug 25, 2016 · 5 comments
Closed

ICE: failed to get layout for E: the type E has an unknown layout #35988

petrochenkov opened this issue Aug 25, 2016 · 5 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@petrochenkov
Copy link
Contributor

petrochenkov commented Aug 25, 2016

This is a regression: reproduces on beta and nightly, doesn't reproduce on stable.

enum E {
    V([Box<E>])
}

fn main() {}
error: internal compiler error: ../src/librustc_lint/types.rs:698: failed to get layout for `E`: the type `E` has an unknown layout

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:634
note: Run with `RUST_BACKTRACE=1` for a backtrace.
@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Aug 25, 2016
@eddyb
Copy link
Member

eddyb commented Aug 26, 2016

This is not supported though, why aren't you getting an error? cc @arielb1 @nikomatsakis

@TimNN
Copy link
Contributor

TimNN commented Aug 26, 2016

Note that referencing the type also causes an ICE on stable:

enum E {
    V([Box<E>])
}

fn foo(_: &E) {}

fn main() {}

This triggers without referencing the type since #34755 moved variant_size_differences from trans to a lint (I believe).

@jonas-schievink
Copy link
Contributor

Yes, similar to #34571

@nikomatsakis
Copy link
Contributor

This seems like a legitimate "staging" problem... not quite sure how to triage though.

@nikomatsakis nikomatsakis added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 31, 2016
@petrochenkov
Copy link
Contributor Author

Fixed in 1.15.1, needs test.

rustc 1.15.1 (021bd294c 2017-02-08)
error[E0277]: the trait bound `[Box<E>]: std::marker::Sized` is not satisfied
 --> <anon>:2:7
  |
2 |     V([Box<E>])
  |       ^^^^^^^^^ the trait `std::marker::Sized` is not implemented for `[Box<E>]`
  |
  = note: `[Box<E>]` does not have a constant size known at compile-time
  = note: only the last field of a struct may have a dynamically sized type

error: aborting due to previous error

@petrochenkov petrochenkov added E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 19, 2017
@petrochenkov petrochenkov added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Mar 1, 2017
bors added a commit that referenced this issue Mar 6, 2017
Add missing tests for 'E-needstest' labeled issues

This PR adds missing tests for issue #35988, #19712, ~~#18627~~, #24947, #28600 and #34751.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

6 participants