Closed
Description
error: internal compiler error: unexpected panic
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.24.0-nightly (77efd6800 2017-12-15) running on x86_64-pc-windows-msvc
thread 'rustc' panicked at 'assertion failed: `(left == right)`
left: `1`,
right: `0`', src\librustc_trans\type_.rs:293:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `select`.
Backtrace
stack backtrace:
0: <std::fs::DirBuilder as core::fmt::Debug>::fmt
1: std::sync::condvar::Condvar::new
2: std::panicking::Location::column
3: std::panicking::Location::column
4: std::panicking::rust_panic_with_hook
5: std::panicking::begin_panic_fmt
6: std::panicking::begin_panic_fmt
7: rustc_trans::type_::Type::padding_filler
8: <rustc_trans::mir::operand::OperandRef<'tcx> as core::fmt::Debug>::fmt
9: <rustc::ty::layout::TyLayout<'tcx> as rustc_trans::type_of::LayoutLlvmExt<'tcx>>::llvm_type
10: <rustc::ty::layout::TyLayout<'tcx> as rustc_trans::type_of::LayoutLlvmExt<'tcx>>::llvm_type
11: <rustc_trans::abi::CastTarget as core::convert::From<rustc_trans::abi::Uniform>>::from
12: <&'a rustc_trans::context::CrateContext<'a, 'tcx> as rustc::ty::layout::LayoutOf<&'tcx rustc::ty::TyS<'tcx>>>::layout_of
13: rustc_trans::trans_item::predefine_fn
14: rustc_trans::type_::Type::to_ref_slice
15: rustc_trans::base::trans_crate
16: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::ensure
17: rustc::dep_graph::graph::DepGraph::in_ignore
18: rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::mir::Local>::lift_to_tcx
19: <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys
20: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::ensure
21: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::try_get
22: rustc::ty::maps::TyCtxtAt::compile_codegen_unit
23: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::compile_codegen_unit
24: rustc_trans::base::trans_crate
25: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
26: rustc_driver::driver::default_provide_extern
27: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
28: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
29: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
30: <rustc_driver::Compilation as core::fmt::Debug>::fmt
31: rustc_driver::driver::compile_input
32: rustc_driver::run_compiler
33: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
34: _rust_maybe_catch_panic
35: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
36: std::sync::condvar::Condvar::new
37: std::sys::windows::thread::Thread::new
38: BaseThreadInitThunk
Windows 10 (64-bit)
Activity
arielb1 commentedon Dec 17, 2017
@ishitatsuyuki
Which code had caused this assertion?
Details
Caused by this assertion:
rust/src/librustc_trans/type_.rs
Lines 289 to 295 in 1b1c792
Which was introduced in #46623, which is beta-nominated. cc @eddyb
eddyb commentedon Dec 17, 2017
I'm glad I added that assertion! What it likely means is that
size
isn't a multiple ofalign
.I'd be quite surprised if
#[repr(packed)]
and/or#[repr(align(N))]
weren't involved.rerz commentedon Dec 18, 2017
In my case this error is caused by the
select
crate. Simply including it in yourcargo.toml
and compiling crashes rustc.Backtrace
I'm on Arch running the latest nightly rustc.
eddyb commentedon Dec 18, 2017
Looks like
Option<(tendril::Tendril<tendril::fmt::UTF8>, bool)>
triggers the assertion, and it has alignment8
but size17
(which is illegal), IIRC,tendril
includes some types that are#[repr(packed)]
(or at least in older versionsthis is indeed0.3.1
which has a packedTendril
) and has caused issues in the past as well.EDIT: minimal repro:
Auto merge of #46808 - eddyb:issue-46769-quick, r=arielb1
select
crate #46840Rollup merge of rust-lang#46809 - eddyb:issue-46769-optimal, r=arielb1