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

Thread 'rustc' panicked at 'failed to lookup SourceFile in new context' #84362

Closed
Corfucinas opened this issue Apr 20, 2021 · 2 comments
Closed
Labels
C-bug Category: This is a bug. 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.

Comments

@Corfucinas
Copy link

Corfucinas commented Apr 20, 2021

Code

You can reproduce it as follows

cargo new this_will_panic
mkdir test
touch test/test_config.rs

#[cfg(test)]
#[path = "./simple_test.rs"]
mod simple_test_2;

touch test/simple_test.rs
#[test]
fn test_simple() {
    assert_eq!(2 + 2, 4);
}

Cargo.Toml


[[test]]
name = "test"
path = "./test/test_config.rs"
edition = "2018"

[package]
name = "compiler_error"
version = "0.1.0"
authors = ["Corfucinas <[email protected]>"]
edition = "2018"

[dependencies]


run 'cargo test'

change 
path = "./test/test_config.rs"
to
path = "./test/test_config_2.rs"

change
test/test_config.rs
to
test/test_config_2.rs

run 'cargo test'

Meta

Yes, the bug is on nightly

rustc 1.53.0-nightly (9d9c2c92b 2021-04-19)
binary: rustc
commit-hash: 9d9c2c92b834c430f102ea96f65119e37320776e
commit-date: 2021-04-19
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Version

Also on stable

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

Error output


cargo test --verbose
       Fresh autocfg v1.0.1
       Fresh cfg-if v1.0.0
       Fresh unicode-xid v0.2.1
       Fresh cc v1.0.67
       Fresh pkg-config v0.3.19
       Fresh pin-project-lite v0.2.6
       Fresh bytes v1.0.1
       Fresh ahash v0.4.7
       Fresh lazy_static v1.4.0
       Fresh version_check v0.9.3
       Fresh itoa v0.4.7
       Fresh futures-core v0.3.14
       Fresh fnv v1.0.7
       Fresh matches v0.1.8
       Fresh foreign-types-shared v0.1.1
       Fresh tinyvec_macros v0.1.0
       Fresh futures-task v0.3.14
       Fresh futures-sink v0.3.14
       Fresh futures-io v0.3.14
       Fresh unicode-segmentation v1.7.1
       Fresh pin-utils v0.1.0
       Fresh slab v0.4.2
       Fresh smallvec v1.6.1
       Fresh once_cell v1.7.2
       Fresh scopeguard v1.1.0
       Fresh percent-encoding v2.1.0
       Fresh openssl-probe v0.1.2
       Fresh try-lock v0.2.3
       Fresh adler v1.0.2
       Fresh httpdate v0.3.2
       Fresh tower-service v0.3.1
       Fresh byteorder v1.4.3
       Fresh unicode-width v0.1.8
       Fresh fallible-iterator v0.2.0
       Fresh vec_map v0.8.2
       Fresh fallible-streaming-iterator v0.1.9
       Fresh os_str_bytes v2.4.0
       Fresh base64 v0.13.0
       Fresh termcolor v1.1.2
       Fresh strum v0.20.0
       Fresh mime v0.3.16
       Fresh strsim v0.10.0
       Fresh ipnet v2.3.0
       Fresh colorful v0.2.1
       Fresh instant v0.1.9
       Fresh hashbrown v0.9.1
       Fresh tracing-core v0.1.17
       Fresh http v0.2.4
       Fresh foreign-types v0.3.2
       Fresh tinyvec v1.2.0
       Fresh futures-channel v0.3.14
       Fresh unicode-bidi v0.3.5
       Fresh heck v0.3.2
       Fresh form_urlencoded v1.0.1
       Fresh lock_api v0.4.3
       Fresh textwrap v0.12.1
       Fresh libc v0.2.93
       Fresh proc-macro2 v1.0.26
       Fresh log v0.4.14
       Fresh bitflags v1.2.1
       Fresh memchr v2.3.4
       Fresh tracing v0.1.25
       Fresh http-body v0.4.1
       Fresh hashlink v0.6.0
       Fresh crc32fast v1.2.1
       Fresh ryu v1.0.5
       Fresh httparse v1.4.0
       Fresh unicode-normalization v0.1.17
       Fresh num_cpus v1.13.0
       Fresh indexmap v1.6.2
       Fresh time v0.1.44
       Fresh signal-hook-registry v1.3.0
       Fresh socket2 v0.4.0
       Fresh parking_lot_core v0.8.3
       Fresh encoding_rs v0.8.28
       Fresh atty v0.2.14
       Fresh quote v1.0.9
       Fresh mio v0.7.11
       Fresh openssl-sys v0.9.61
       Fresh miniz_oxide v0.4.4
       Fresh bzip2-sys v0.1.10+1.0.8
       Fresh want v0.3.0
       Fresh num-traits v0.2.14
       Fresh futures-util v0.3.14
       Fresh libsqlite3-sys v0.22.1
       Fresh idna v0.2.3
       Fresh syn v1.0.69
       Fresh tokio v1.5.0
       Fresh openssl v0.10.33
       Fresh proc-macro-error-attr v1.0.4
       Fresh signal-hook v0.1.17
       Fresh parking_lot v0.11.1
       Fresh serde_derive v1.0.125
       Fresh pin-project-internal v1.0.7
       Fresh thiserror-impl v1.0.24
       Fresh flate2 v1.0.20
       Fresh bzip2 v0.3.3
       Fresh num-integer v0.1.44
       Fresh strum_macros v0.20.1
       Fresh url v2.2.1
       Fresh rusqlite v0.25.1
       Fresh tokio-util v0.6.6
       Fresh native-tls v0.2.7
       Fresh serde v1.0.125
       Fresh pin-project v1.0.7
       Fresh proc-macro-error v1.0.4
       Fresh thiserror v1.0.24
       Fresh crossterm v0.19.0
       Fresh h2 v0.3.2
       Fresh tokio-native-tls v0.3.0
       Fresh chrono v0.4.19
       Fresh hyper v0.14.5
       Fresh clap_derive v3.0.0-beta.2
       Fresh serde_json v1.0.64
       Fresh zip v0.5.12
       Fresh serde_urlencoded v0.7.0
       Fresh comfy-table v2.1.0
       Fresh hyper-tls v0.5.0
       Fresh simple_excel_writer v0.1.7
       Fresh clap v3.0.0-beta.2
       Fresh reqwest v0.11.3
   Compiling crypto-candlesticks-rust v0.1.0 (/home/the-box/Github/crypto-candlesticks-rust)
     Running `rustc --crate-name test --edition=2018 test/all_tests.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=6aff53cd9ec9fa5e -C extra-filename=-6aff53cd9ec9fa5e --out-dir /home/the-box/Github/crypto-candlesticks-rust/target/debug/deps -C incremental=/home/the-box/Github/crypto-candlesticks-rust/target/debug/incremental -L dependency=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps --extern chrono=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libchrono-5657d8032b66c0f1.rlib --extern clap=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libclap-fce1dc7f69ea835b.rlib --extern colorful=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libcolorful-730391748cea3faa.rlib --extern comfy_table=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libcomfy_table-54924fd4f52b8c81.rlib --extern reqwest=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libreqwest-a5bfe9c64a92793f.rlib --extern rusqlite=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/librusqlite-d031e9b891576fc2.rlib --extern serde=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libserde-9abe7c4275ac0b44.rlib --extern simple_excel_writer=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libsimple_excel_writer-c94130e54254c17e.rlib -L native=/home/the-box/Github/crypto-candlesticks-rust/target/debug/build/libsqlite3-sys-24aba17c869f035d/out -L native=/home/the-box/Github/crypto-candlesticks-rust/target/debug/build/bzip2-sys-71416b7b0591da95/out/lib`
thread 'rustc' panicked at 'failed to lookup `SourceFile` in new context', compiler/rustc_middle/src/ty/query/on_disk_cache.rs:710:22
stack backtrace:
   0:     0x7ff127b2bee0 - std::backtrace_rs::backtrace::libunwind::trace::h5e9d00f0cdf4f57e
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7ff127b2bee0 - std::backtrace_rs::backtrace::trace_unsynchronized::hd5302bd66215dab9
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff127b2bee0 - std::sys_common::backtrace::_print_fmt::ha0237cd11a34e2bf
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7ff127b2bee0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h171d4c10df1a98ee
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7ff127b9cd0c - core::fmt::write::h89e4288724daa3fa
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/fmt/mod.rs:1096:17
   5:     0x7ff127b1eff2 - std::io::Write::write_fmt::h6d40f996e84584d9
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/io/mod.rs:1568:15
   6:     0x7ff127b2fd95 - std::sys_common::backtrace::_print::h0c0b93221682afc8
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7ff127b2fd95 - std::sys_common::backtrace::print::h57a9f95204c2fdd6
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7ff127b2fd95 - std::panicking::default_hook::{{closure}}::h4245258b50e37e69
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:208:50
   9:     0x7ff127b2f8f3 - std::panicking::default_hook::h7b00dcc1d0944747
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:225:9
  10:     0x7ff128391f3b - rustc_driver::report_ice::hd11b2540f4ebea82
  11:     0x7ff127b30696 - std::panicking::rust_panic_with_hook::h71e6a073d87de1f5
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:595:17
  12:     0x7ff127b301b7 - std::panicking::begin_panic_handler::{{closure}}::hd549436f6bb6dbb8
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:497:13
  13:     0x7ff127b2c37c - std::sys_common::backtrace::__rust_end_short_backtrace::h4e5f4b72b04174c3
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7ff127b30119 - rust_begin_unwind
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:493:5
  15:     0x7ff127b99331 - core::panicking::panic_fmt::hcd56f7f635f62c74
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/panicking.rs:92:14
  16:     0x7ff127b98f13 - core::option::expect_failed::h5086d7196b9e2f90
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/option.rs:1292:5
  17:     0x7ff12b28d0fc - rustc_middle::ty::query::on_disk_cache::CacheDecoder::file_index_to_file::hcb457343d5e095a9
  18:     0x7ff12b0fd9c4 - rustc_middle::ty::query::on_disk_cache::<impl rustc_serialize::serialize::Decodable<rustc_middle::ty::query::on_disk_cache::CacheDecoder> for rustc_span::span_encoding::Span>::decode::h8599c64ba5413418
  19:     0x7ff12b13020b - rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_SourceInfo::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::SourceInfo>::decode::h6ac5f4b63afd5df6
  20:     0x7ff12b134247 - rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_Statement::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::Statement>::decode::h7dbdd800e3152efe
  21:     0x7ff12b27982a - rustc_serialize::serialize::Decoder::read_seq::h2d7918c67adf859a
  22:     0x7ff12b134c30 - rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_BasicBlockData::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::BasicBlockData>::decode::h1c52eb0be3b71d47
  23:     0x7ff12b27b67b - rustc_serialize::serialize::Decoder::read_seq::hb11db33c37b778ba
  24:     0x7ff12b135bf7 - rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_Body::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::Body>::decode::he6fc7bbfecbc1e9a
  25:     0x7ff129806674 - rustc_middle::ty::codec::<impl rustc_serialize::serialize::Decodable<D> for &rustc_middle::mir::Body>::decode::h7b9565daf8364831
  26:     0x7ff129ac66b8 - rustc_middle::ty::query::on_disk_cache::OnDiskCache::try_load_query_result::hec575f8d9456488f
  27:     0x7ff129913c4a - rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory::haf1693693230fe7a
  28:     0x7ff12b0f3c14 - rustc_data_structures::stack::ensure_sufficient_stack::he6605a7a825170f3
  29:     0x7ff12a5f4b8a - rustc_query_system::query::plumbing::get_query_impl::hf2648788c97ce9e3
  30:     0x7ff12a646100 - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir::ha7ad8a9120480565
  31:     0x7ff12a0d523c - rustc_mir::monomorphize::collector::collect_neighbours::hbd5e0d4bd5a55007
  32:     0x7ff12a0d073a - rustc_mir::monomorphize::collector::collect_items_rec::h68571fcc61845e5e
  33:     0x7ff12ad290fd - rustc_session::utils::<impl rustc_session::session::Session>::time::h1b6fa63d6e1f146d
  34:     0x7ff12ac95f9c - rustc_mir::monomorphize::collector::collect_crate_mono_items::h158b434cee4e66f3
  35:     0x7ff12acbf5c3 - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::hc5f618b24170b5a5
  36:     0x7ff12a7c36e1 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute::h30c2744feeda4f4c
  37:     0x7ff12859b103 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hf77411c55f33aabf
  38:     0x7ff12a7fc9d6 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hdbab804f2cb6c2f9
  39:     0x7ff12a7abc28 - rustc_data_structures::stack::ensure_sufficient_stack::hcaea54a442e13acc
  40:     0x7ff12a7da92d - rustc_query_system::query::plumbing::force_query_with_job::h5210da7a92c52cc4
  41:     0x7ff12a7ca73c - rustc_query_system::query::plumbing::get_query_impl::h1d58d3f870a15953
  42:     0x7ff12a7c37ea - rustc_codegen_ssa::base::codegen_crate::h15d4935f7d3e82fb
  43:     0x7ff12a7eec96 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h26df70778f166067
  44:     0x7ff12a7190e1 - rustc_session::utils::<impl rustc_session::session::Session>::time::h158ca93521b57a9f
  45:     0x7ff12a73059c - rustc_interface::passes::QueryContext::enter::hef98dc6dd1c73460
  46:     0x7ff12a742416 - rustc_interface::queries::Queries::ongoing_codegen::h20d2b21a48c425de
  47:     0x7ff12a6d5d70 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hc8c0f3e9bba77540
  48:     0x7ff12a6cf643 - rustc_span::with_source_map::hedfeccc0422f91c4
  49:     0x7ff12a6d6eca - rustc_interface::interface::create_compiler_and_run::h7abf0b53119fd7ea
  50:     0x7ff12a6cfd05 - rustc_span::with_session_globals::hb5dbfdbd3bd12723
  51:     0x7ff12a6d736a - std::sys_common::backtrace::__rust_begin_short_backtrace::hfe0fde7e082e2baf
  52:     0x7ff12a6f3c4a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h83306388c44d16bf
  53:     0x7ff127b40c8a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h61144a2be4ee36d8
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/alloc/src/boxed.rs:1521:9
  54:     0x7ff127b40c8a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcf5d395fdd120c17
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/alloc/src/boxed.rs:1521:9
  55:     0x7ff127b40c8a - std::sys::unix::thread::Thread::new::thread_start::hb5e40d3d934ebb7a
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys/unix/thread.rs:71:17
  56:     0x7ff127a59450 - start_thread
  57:     0x7ff127967d53 - clone
  58:                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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0 (2fd73fabe 2021-03-23) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [optimized_mir] optimizing MIR for `main`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `crypto-candlesticks-rust`

Caused by:
  process didn't exit successfully: `rustc --crate-name test --edition=2018 test/all_tests.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=6aff53cd9ec9fa5e -C extra-filename=-6aff53cd9ec9fa5e --out-dir /home/the-box/Github/crypto-candlesticks-rust/target/debug/deps -C incremental=/home/the-box/Github/crypto-candlesticks-rust/target/debug/incremental -L dependency=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps --extern chrono=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libchrono-5657d8032b66c0f1.rlib --extern clap=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libclap-fce1dc7f69ea835b.rlib --extern colorful=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libcolorful-730391748cea3faa.rlib --extern comfy_table=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libcomfy_table-54924fd4f52b8c81.rlib --extern reqwest=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libreqwest-a5bfe9c64a92793f.rlib --extern rusqlite=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/librusqlite-d031e9b891576fc2.rlib --extern serde=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libserde-9abe7c4275ac0b44.rlib --extern simple_excel_writer=/home/the-box/Github/crypto-candlesticks-rust/target/debug/deps/libsimple_excel_writer-c94130e54254c17e.rlib -L native=/home/the-box/Github/crypto-candlesticks-rust/target/debug/build/libsqlite3-sys-24aba17c869f035d/out -L native=/home/the-box/Github/crypto-candlesticks-rust/target/debug/build/bzip2-sys-71416b7b0591da95/out/lib` (exit code: 101)

@Corfucinas Corfucinas added C-bug Category: This is a bug. 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 Apr 20, 2021
@Corfucinas
Copy link
Author

I realized the error is from the crate I'm coding on...but I was able to reproduce it in order to isolate it, let me know, I don't think there's a dep involved.

@Aaron1011
Copy link
Member

This is a duplicate of #83112, and is fixed on the latest nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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.
Projects
None yet
Development

No branches or pull requests

2 participants