Repository navigation
ICE: failed to get layout #43132
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Description
Compiling rs-web-tk v0.1.0 (file:///Users/remram/Documents/programming/rs-web-tk)
error: internal compiler error: src/librustc_trans/context.rs:739: failed to get layout for `&mut futures::future::join::MaybeDone<tk_listen::Listen<futures::stream::Map<tk_listen::SleepOnError<tokio_core::net::Incoming>, [closure@src/main.rs:85:14: 136:10 sender:&std::sync::Arc<futures_mpsc::Sender<std::string::String>>, outsockets:&std::sync::Arc<std::sync::Mutex<(std::collections::HashMap<i32, tk_bufstream::WriteFramed<tokio_core::net::TcpStream, tk_http::websocket::ServerCodec>>, i32)>>, cfg:&std::sync::Arc<tk_http::server::Config>, h1:&tokio_core::reactor::Handle]>>>`: the type `futures::future::join::MaybeDone<tk_listen::Listen<futures::stream::Map<tk_listen::SleepOnError<tokio_core::net::Incoming>, [closure@src/main.rs:85:14: 136:10 sender:&std::sync::Arc<futures_mpsc::Sender<std::string::String>>, outsockets:&std::sync::Arc<std::sync::Mutex<(std::collections::HashMap<i32, tk_bufstream::WriteFramed<tokio_core::net::TcpStream, tk_http::websocket::ServerCodec>>, i32)>>, cfg:&std::sync::Arc<tk_http::server::Config>, h1:&tokio_core::reactor::Handle]>>>` 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
note: rustc 1.20.0-nightly (720c596ec 2017-07-08) running on x86_64-apple-darwin
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:489:8
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
1: std::panicking::default_hook::{{closure}}
2: std::panicking::default_hook
3: std::panicking::rust_panic_with_hook
4: std::panicking::begin_panic_new
5: rustc_errors::Handler::bug
6: rustc::session::opt_span_bug_fmt::{{closure}}
7: rustc::session::opt_span_bug_fmt
8: rustc::session::bug_fmt
9: <&'a rustc_trans::context::SharedCrateContext<'a, 'tcx> as rustc::ty::layout::LayoutTyper<'tcx>>::layout_of
10: rustc_trans::abi::FnType::unadjusted::{{closure}}
11: rustc_trans::abi::FnType::unadjusted
12: rustc_trans::declare::declare_fn
13: rustc_trans::trans_item::TransItem::predefine
14: rustc_trans::base::trans_crate
15: rustc_driver::driver::phase_4_translate_to_llvm
16: rustc_driver::driver::compile_input::{{closure}}
17: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
18: rustc_driver::driver::phase_3_run_analysis_passes
19: rustc_driver::driver::compile_input
20: rustc_driver::run_compiler
error: Could not compile `rs-web-tk`.
Code: https://gitlab.com/remram44/rs-web/blob/bf5066037ffb627c98b4988ff7d46b054ce33e40/src/main.rs#L92
Using versions (similar crash; logs):
rustc 1.20.0-nightly (720c596 2017-07-08)
rustc 1.18.0 (03fc9d6 2017-06-06)
I don't know too much about the compiler internals, but a bug search for "layout_of" didn't bring up anything that seemed relevant. So here you go.
Seems similar to #37096 but I'm not using impl Trait?
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Activity
est31 commentedon Jul 9, 2017
Minimized a bit (52 lines):
(expand)
alexcrichton commentedon Jul 10, 2017
This showed up in the
futurescrate's test suite as wellalexcrichton commentedon Jul 10, 2017
A smaller version of what I believe is the same ICE:
est31 commentedon Jul 10, 2017
@alexcrichton yeah now that I look at it is that on stable OP's example has a different ICE error than on nightly, very alike to #40274, while the one on nightly matches your example.
est31 commentedon Jul 10, 2017
Bisected the nightly ICE using bisect-rust to #42840 (9b85e1c) -- cc @arielb1 @nikomatsakis
arielb1 commentedon Jul 13, 2017
Looks like the projection cache is dropping normalization obligations on the floor at https://github.com/rust-lang/rust/blob/master/src/librustc/traits/project.rs#L1392:
This causes problems with my new evaluation code because it causes an earlier call into evaluation, which allows the cache pollution to proceed (I think).
arielb1 commentedon Jul 13, 2017
Actually, the problem is that the projection cache is incompatible with 1-pass evaluation. Not sure how to solve this.
12 remaining items
Auto merge of #43546 - nikomatsakis:issue-43132, r=arielb1
remram44 commentedon Aug 1, 2017
The nightly is out and I no longer run into that ICE! On the other hand compiling this simple program now takes 8 minutes. The previous commit (before I introduced the ICE) is up from 6s to 1m51s.
est31 commentedon Aug 1, 2017
@remram44 I suggest you file a separate bug report for this.
alexcrichton commentedon Aug 1, 2017
@remram44 hm I can't seem to get the commit linked above to compile? What compiler are you using to compile it "pre ICE"?
remram44 commentedon Aug 1, 2017
I'm compiling using stable and the nightly from the 28th from rustup... not sure why this would fail for you?
alexcrichton commentedon Aug 9, 2017
@remram44 sorry I still can't get the code to compile. Can you list the exact commands you're using, along with the exact toolchain in rustup-style syntax?
remram44 commentedon Aug 9, 2017
The toolchains I tried are
nightly-2017-08-01-x86_64-apple-darwinandnightly-2017-08-01-x86_64-unknown-linux-gnu.Whatever your environment you can reproduce this from scratch in Docker with:
alexcrichton commentedon Aug 9, 2017
Ok thanks for the repro @remram44! Want to open a new issue with that so we can be sure to track it?
remram44 commentedon Aug 9, 2017
Will do!
[edit: #43787]
fix logic error in rust-lang#44269's `prune_cache_value_obligations`
fix logic error in rust-lang#44269's `prune_cache_value_obligations`
Auto merge of #45065 - arielb1:not-correct, r=nikomatsakis