Skip to content

Compiler error on nightly (since April 28th): librustc/ty/layout.rs:1002: impossible case reached #50442

Closed
@cipriancraciun

Description

@cipriancraciun

I have a "largish" piece of code that fails to build with any nightly compilers since April 28th. The latest to work was April 27th.

The error is:

error: internal compiler error: librustc/ty/layout.rs:1002: impossible case reached
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:554:9
[...]
  99: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
query stack during panic:
#0 [layout_raw] computing layout of `primitives_procedures::ProcedurePrimitive0`
#1 [layout_raw] computing layout of `primitives_procedures::ProcedurePrimitive`
#2 [layout_raw] computing layout of `values_value::Value`
#3 [layout_raw] computing layout of `std::option::Option<values_value::Value>`
#4 [layout_raw] computing layout of `contexts::BindingTemplate`
#5 [layout_raw] computing layout of `std::option::Option<contexts::BindingTemplate>`
#6 [layout_raw] computing layout of `compiler::CompilerBinding`
end of query stack
error: aborting due to previous error

In order to reproduce this error, and to check the last nightly that works, bellow are the bash snippets that clone the repository, install the two nightlies via rust-up in the current folder, and execute the compilation:

  • get the sources:
git clone --depth=1 -- https://github.com/cipriancraciun/vonuvoli-scheme.git ./vonuvoli-scheme
cd -- ./vonuvoli-scheme
  • prepare the rust-up environment:
mkdir -- ./.rust ./.rust/rustup ./.rust/cargo

curl -s -o ./.rust/rustup-init.tmp -- https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
mv -n -T -- ./.rust/rustup-init.tmp ./.rust/rustup-init
chmod +x -- ./.rust/rustup-init

export -- RUSTUP_HOME="${PWD}/.rust/rustup"
export -- CARGO_HOME="${PWD}/.rust/cargo"
export -- RUST_BACKTRACE=1
  • install the two nightly versions:
./.rust/rustup-init -y --no-modify-path
./.rust/cargo/bin/rustup install nightly-2018-04-27
./.rust/cargo/bin/rustup install nightly-2018-05-04
  • compile with success by using the April 27th version of nightly:
./.rust/cargo/bin/cargo +nightly-2018-04-27 build --lib --no-default-features
  • compile with failure by using the latest version (at the moment of writing) of nightly:
./.rust/cargo/bin/cargo +nightly-2018-05-04 build --lib --no-default-features

The full output obtained from rustc is bellow:

   Compiling vonuvoli-scheme v0.1.0 (file:///home/ciprian/vonuvoli-scheme)
error: internal compiler error: librustc/ty/layout.rs:1002: impossible case reached

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:554:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:467
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::session::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::session::opt_span_bug_fmt
  13: rustc::session::bug_fmt
  14: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  15: rustc::ty::context::tls::with_related_context
  16: rustc::ty::layout::layout_raw
  17: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  18: rustc::ty::context::tls::with_context
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: rustc::ty::context::tls::with_related_context
  21: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  22: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  23: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  24: <&'a mut I as core::iter::iterator::Iterator>::next
  25: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  26: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  27: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  28: rustc::ty::context::tls::with_related_context
  29: rustc::ty::layout::layout_raw
  30: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  31: rustc::ty::context::tls::with_context
  32: rustc::dep_graph::graph::DepGraph::with_task_impl
  33: rustc::ty::context::tls::with_related_context
  34: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  35: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  36: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  37: <&'a mut I as core::iter::iterator::Iterator>::next
  38: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  39: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  40: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  41: rustc::ty::context::tls::with_related_context
  42: rustc::ty::layout::layout_raw
  43: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  44: rustc::ty::context::tls::with_context
  45: rustc::dep_graph::graph::DepGraph::with_task_impl
  46: rustc::ty::context::tls::with_related_context
  47: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  48: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  49: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  50: <&'a mut I as core::iter::iterator::Iterator>::next
  51: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  52: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  53: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  54: rustc::ty::context::tls::with_related_context
  55: rustc::ty::layout::layout_raw
  56: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  57: rustc::ty::context::tls::with_context
  58: rustc::dep_graph::graph::DepGraph::with_task_impl
  59: rustc::ty::context::tls::with_related_context
  60: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  61: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  62: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  63: <&'a mut I as core::iter::iterator::Iterator>::next
  64: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  65: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  66: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  67: rustc::ty::context::tls::with_related_context
  68: rustc::ty::layout::layout_raw
  69: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  70: rustc::ty::context::tls::with_context
  71: rustc::dep_graph::graph::DepGraph::with_task_impl
  72: rustc::ty::context::tls::with_related_context
  73: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  74: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  75: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  76: <&'a mut I as core::iter::iterator::Iterator>::next
  77: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  78: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  79: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  80: rustc::ty::context::tls::with_related_context
  81: rustc::ty::layout::layout_raw
  82: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  83: rustc::ty::context::tls::with_context
  84: rustc::dep_graph::graph::DepGraph::with_task_impl
  85: rustc::ty::context::tls::with_related_context
  86: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  87: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  88: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  89: <&'a mut I as core::iter::iterator::Iterator>::next
  90: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  91: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  92: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>>::layout_raw_uncached
  93: rustc::ty::context::tls::with_related_context
  94: rustc::ty::layout::layout_raw
  95: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::layout_raw<'tcx>>::compute
  96: rustc::ty::context::tls::with_context
  97: rustc::dep_graph::graph::DepGraph::with_task_impl
  98: rustc::ty::context::tls::with_related_context
  99: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
query stack during panic:
#0 [layout_raw] computing layout of `primitives_procedures::ProcedurePrimitive0`
#1 [layout_raw] computing layout of `primitives_procedures::ProcedurePrimitive`
#2 [layout_raw] computing layout of `values_value::Value`
#3 [layout_raw] computing layout of `std::option::Option<values_value::Value>`
#4 [layout_raw] computing layout of `contexts::BindingTemplate`
#5 [layout_raw] computing layout of `std::option::Option<contexts::BindingTemplate>`
#6 [layout_raw] computing layout of `compiler::CompilerBinding`
end of query stack
error: aborting due to previous error


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.27.0-nightly (e82261dfb 2018-05-03) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=32 -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `vonuvoli-scheme`.

To learn more, run the command again with --verbose.

If need I can try to use a different build, arguments, etc.

Hope it helps in finding the issue,
Ciprian.

Metadata

Metadata

Assignees

Labels

A-type-systemArea: Type systemC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant 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.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions