Skip to content

internal compiler error in rustc when compiling cretonne after running mypy #49528

@sunfishcode

Description

@sunfishcode

When building https://github.com/Cretonne/cretonne/tree/24c8e6524fb814577c93779a628ab536e667c3f0, "cargo build" succeeds in a fresh tree, but if I run mypy over some of the python source files, without changing anything, subsequent "cargo build" runs hit an internal compiler error in rustc.

mypy doesn't seem to modify anything outside of its .mypy_cache directory, so I've not yet determined how mypy could be influencing rustc, but the error reproduces reliably for me.

$ rustc --version
rustc 1.26.0-nightly (ae544ee1c 2018-03-29)
$ cargo clean
$ cargo build
   Compiling cc v1.0.9
   Compiling unicode-xid v0.0.4
[...]
    Finished dev [unoptimized + debuginfo] target(s) in 35.81 secs
$ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
$ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
$ cd lib/cretonne/meta/
$ mypy --py2 build.py
$ cd -
/home/sunfish/cretonne
$ cargo build
   Compiling cretonne v0.4.1 (file:///home/sunfish/cretonne/lib/cretonne)
thread 'rustc' panicked at 'assertion failed: this.interpret_alloc_cache.borrow_mut().insert(pos, alloc_id).is_none()', librustc/ty/maps/on_disk_cache.rs:600:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

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.26.0-nightly (ae544ee1c 2018-03-29) running on x86_64-unknown-linux-gnu

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

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

error: Could not compile `cretonne`.

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

Here's the backtrace:

$ RUST_BACKTRACE=full cargo build --verbose
       Fresh unicode-xid v0.0.4
       Fresh cc v1.0.9
       Fresh unicode-xid v0.1.0
       Fresh quote v0.3.15
       Fresh void v1.0.2
       Fresh libc v0.2.40
       Fresh rustc-demangle v0.1.7
       Fresh ucd-util v0.1.1
       Fresh lazy_static v1.0.0
       Fresh gcc v0.3.54
       Fresh cfg-if v0.1.2
       Fresh utf8-ranges v1.0.0
       Fresh bitflags v0.7.0
       Fresh strsim v0.6.0
       Fresh byteorder v1.2.1
       Fresh remove_dir_all v0.5.0
       Fresh serde v1.0.36
       Fresh wasmparser v0.15.2
       Fresh synom v0.11.3
       Fresh proc-macro2 v0.2.3
       Fresh unreachable v1.0.0
       Fresh memchr v2.0.1
       Fresh rand v0.4.2
       Fresh num_cpus v1.8.0
       Fresh regex-syntax v0.5.3
       Fresh term v0.5.1
       Fresh syn v0.11.11
       Fresh quote v0.4.2
       Fresh thread_local v0.3.5
       Fresh aho-corasick v0.6.4
       Fresh tempdir v0.3.7
   Compiling cretonne v0.4.1 (file:///home/sunfish/cretonne/lib/cretonne)
       Fresh synstructure v0.6.1
       Fresh backtrace-sys v0.1.16
     Running `rustc --crate-name cretonne lib/cretonne/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=07919c7425d7c112 -C extra-filename=-07919c7425d7c112 --out-dir /home/sunfish/cretonne/target/debug/deps -C incremental=/home/sunfish/cretonne/target/debug/incremental -L dependency=/home/sunfish/cretonne/target/debug/deps --cfg build_riscv --cfg build_intel --cfg build_arm32 --cfg build_arm64`
       Fresh syn v0.12.15
       Fresh regex v0.2.10
       Fresh raw-cpuid v3.0.0
       Fresh failure_derive v0.1.1
       Fresh backtrace v0.3.5
       Fresh serde_derive_internals v0.22.2
       Fresh filecheck v0.2.1
       Fresh failure v0.1.1
       Fresh serde_derive v1.0.36
       Fresh filecheck v0.3.0
       Fresh docopt v0.8.3
thread 'rustc' panicked at 'assertion failed: this.interpret_alloc_cache.borrow_mut().insert(pos, alloc_id).is_none()', librustc/ty/maps/on_disk_cache.rs:600:17
stack backtrace:
   0:     0x7ffbfc76185b - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::he90736f0673c5957
                               at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7ffbfc72f990 - std::sys_common::backtrace::print::h37226c664104fff7
                               at libstd/sys_common/backtrace.rs:71
                               at libstd/sys_common/backtrace.rs:59
   2:     0x7ffbfc75529d - std::panicking::default_hook::{{closure}}::h5edcec13387dd2e3
                               at libstd/panicking.rs:207
   3:     0x7ffbfc754ffb - std::panicking::default_hook::ha0061cec4ea60cf2
                               at libstd/panicking.rs:223
   4:     0x7ffbf8d535bd - core::ops::function::Fn::call::hfbcf24185d298f84
   5:     0x7ffbfc7557e9 - std::panicking::rust_panic_with_hook::hb876ad0773f5dc16
                               at libstd/panicking.rs:403
   6:     0x7ffbf88aa6d5 - std::panicking::begin_panic::h06c4bb1157cdb39b
   7:     0x7ffbf89c1b29 - rustc::mir::interpret::specialized_decode_alloc_id::h2291847f4f3e799b
   8:     0x7ffbf8b153e7 - <rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x> as serialize::serialize::SpecializedDecoder<rustc::mir::interpret::AllocId>>::specialized_decode::h80c3dde4cadcaadd
   9:     0x7ffbf89c1866 - rustc::mir::interpret::specialized_decode_alloc_id::h2291847f4f3e799b
  10:     0x7ffbf8b153e7 - <rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x> as serialize::serialize::SpecializedDecoder<rustc::mir::interpret::AllocId>>::specialized_decode::h80c3dde4cadcaadd
  11:     0x7ffbf8aefbd2 - serialize::serialize::Decoder::read_map::h4c607091f848635c
  12:     0x7ffbf8ae759a - serialize::serialize::Decoder::read_struct::h233b13e9fb65b522
  13:     0x7ffbf89c179e - rustc::mir::interpret::specialized_decode_alloc_id::h2291847f4f3e799b
  14:     0x7ffbf8b153e7 - <rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x> as serialize::serialize::SpecializedDecoder<rustc::mir::interpret::AllocId>>::specialized_decode::h80c3dde4cadcaadd
  15:     0x7ffbf8aefbd2 - serialize::serialize::Decoder::read_map::h4c607091f848635c
  16:     0x7ffbf8ae759a - serialize::serialize::Decoder::read_struct::h233b13e9fb65b522
  17:     0x7ffbf89c179e - rustc::mir::interpret::specialized_decode_alloc_id::h2291847f4f3e799b
  18:     0x7ffbf8b153e7 - <rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x> as serialize::serialize::SpecializedDecoder<rustc::mir::interpret::AllocId>>::specialized_decode::h80c3dde4cadcaadd
  19:     0x7ffbf8aefbd2 - serialize::serialize::Decoder::read_map::h4c607091f848635c
  20:     0x7ffbf8ae759a - serialize::serialize::Decoder::read_struct::h233b13e9fb65b522
  21:     0x7ffbf89c179e - rustc::mir::interpret::specialized_decode_alloc_id::h2291847f4f3e799b
  22:     0x7ffbf8b153e7 - <rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x> as serialize::serialize::SpecializedDecoder<rustc::mir::interpret::AllocId>>::specialized_decode::h80c3dde4cadcaadd
  23:     0x7ffbf8afd031 - serialize::serialize::Decoder::read_enum::hc04b5d0bc1636a64
  24:     0x7ffbf8afe2af - serialize::serialize::Decoder::read_enum::heb95394f5ee7f74d
  25:     0x7ffbf8afd925 - serialize::serialize::Decoder::read_enum::hdb508e49903b0e55
  26:     0x7ffbf8b0eee5 - rustc::ty::maps::on_disk_cache::OnDiskCache::try_load_query_result::h271f3888101d51cf
  27:     0x7ffbf8c6e6a0 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::try_get::h23b58c87b8a638bd
  28:     0x7ffbf8c172fa - rustc::ty::maps::TyCtxtAt::const_eval::h125e2e934614106c
  29:     0x7ffbf8c13904 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::const_eval::h4f04045e39323659
  30:     0x7ffbf98cd50f - rustc_mir::monomorphize::collector::collect_items_rec::ha321e7245faddaa1
  31:     0x7ffbf98cd9a5 - rustc_mir::monomorphize::collector::collect_items_rec::ha321e7245faddaa1
  32:     0x7ffbf98cd9a5 - rustc_mir::monomorphize::collector::collect_items_rec::ha321e7245faddaa1
  33:     0x7ffbf98cd9a5 - rustc_mir::monomorphize::collector::collect_items_rec::ha321e7245faddaa1
  34:     0x7ffbf98cd9a5 - rustc_mir::monomorphize::collector::collect_items_rec::ha321e7245faddaa1
  35:     0x7ffbf98cd9a5 - rustc_mir::monomorphize::collector::collect_items_rec::ha321e7245faddaa1
  36:     0x7ffbf98cca7a - rustc_mir::monomorphize::collector::collect_crate_mono_items::h6c5c4d2f6be93974
  37:     0x7ffbf10e6a06 - rustc::util::common::time::h2b188e3826a5ea0e
  38:     0x7ffbf104cc78 - rustc_trans::base::collect_and_partition_translation_items::hc7f6051bb0ed2095
  39:     0x7ffbf88d41f7 - rustc::dep_graph::graph::DepGraph::with_ignore::h1f92ffc35e15667c
  40:     0x7ffbf8963835 - rustc_errors::Handler::track_diagnostics::h35f46c6f612e58b5
  41:     0x7ffbf8be1bf7 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hd962d3e6647f84f2
  42:     0x7ffbf8ce3ac7 - rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::try_get::h775812341537cb43
  43:     0x7ffbf8c1c2f7 - rustc::ty::maps::TyCtxtAt::collect_and_partition_translation_items::h44c32ed0ec66ca14
  44:     0x7ffbf8c14cbe - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::collect_and_partition_translation_items::h15854687a10ac9c6
  45:     0x7ffbf104b032 - rustc_trans::base::trans_crate::h30b12ada34eb627c
  46:     0x7ffbf1011917 - <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate::h47c4210dd6cfea88
  47:     0x7ffbfcaecfa5 - rustc::util::common::time::h516fe4fca915fefc
  48:     0x7ffbfcae0764 - rustc_driver::driver::phase_4_translate_to_llvm::h3384ff9dbd6ca1ee
  49:     0x7ffbfcb68f19 - rustc_driver::driver::compile_input::{{closure}}::h882b28e18bc8c2e8
  50:     0x7ffbfcb5fcda - <std::thread::local::LocalKey<T>>::with::h4c767a532ca41fa3
  51:     0x7ffbfcb66136 - <std::thread::local::LocalKey<T>>::with::he47cefd74ff28307
  52:     0x7ffbfcbdc59e - rustc::ty::context::TyCtxt::create_and_enter::hd599c2d32b176ac6
  53:     0x7ffbfcad9c37 - rustc_driver::driver::compile_input::hd12ba23060796bfe
  54:     0x7ffbfcb8eadf - rustc_driver::run_compiler_impl::h8ab3a92625df6f67
  55:     0x7ffbfcab3b18 - syntax::with_globals::h5b93a0cb73c64078
  56:     0x7ffbfcaf488d - std::sys_common::backtrace::__rust_begin_short_backtrace::h353ee474fb03bf90
  57:     0x7ffbfc76febe - __rust_maybe_catch_panic
                               at libpanic_unwind/lib.rs:102
  58:     0x7ffbfcb009ed - <F as alloc::boxed::FnBox<A>>::call_box::h7815eff9e835733f
  59:     0x7ffbfc766f47 - std::sys_common::thread::start_thread::h5801fa5836ace044
                               at /checkout/src/liballoc/boxed.rs:793
                               at libstd/sys_common/thread.rs:24
  60:     0x7ffbfc735fb8 - std::sys::unix::thread::Thread::new::thread_start::h9ffd4ead1288775a
                               at libstd/sys/unix/thread.rs:90
  61:     0x7ffbf6a9a7fb - start_thread
  62:     0x7ffbfc40cb5e - clone
  63:                0x0 - <unknown>

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.26.0-nightly (ae544ee1c 2018-03-29) running on x86_64-unknown-linux-gnu

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

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

error: Could not compile `cretonne`.

Caused by:
  process didn't exit successfully: `rustc --crate-name cretonne lib/cretonne/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=07919c7425d7c112 -C extra-filename=-07919c7425d7c112 --out-dir /home/sunfish/cretonne/target/debug/deps -C incremental=/home/sunfish/cretonne/target/debug/incremental -L dependency=/home/sunfish/cretonne/target/debug/deps --cfg build_riscv --cfg build_intel --cfg build_arm32 --cfg build_arm64` (exit code: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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