Repository navigation
Compiler panic compiling libcore #43982
Copy link
Copy link
Closed
Labels
A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.Area: saving results of analyses such as inference and borrowck results to a file.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-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-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.
Description
Last rebase was 11. Aug. Using rust-llvm-2017-07-20.
EDIT: First bad commit is 783ccc4
Compiling with:
cd $(rust_src) && \
./configure --enable-debug \
--enable-extended \
--prefix=$(rust_dest) \
--sysconfdir=$(rust_dest)/etc \
--localstatedir=$(rust_dest)/var/lib \
--datadir=$(rust_dest)/share \
--infodir=$(rust_dest)/share/info \
--default-linker=gcc \
--llvm-root=$(llvm_dest) \
--enable-llvm-link-shared
cd $(rust_src) && make
cd $(rust_src) && make installerror: internal compiler error: src/librustc/ty/context.rs:237: node unknown node (id=1) with HirId::owner DefId { krate: CrateNum(0), node: DefIndex(0) => core/a38a63e } cannot be placed in TypeckTables with local_id_root DefId { krate: CrateNum(0), node: DefIndex(1533) => core/a38a63e::panicking[0]::panic_fmt[0] }
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.21.0-dev (41193c16f 2017-08-18) running on x86_64-unknown-linux-gnu
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:486: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
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:60
3: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:381
4: std::panicking::default_hook
at src/libstd/panicking.rs:391
5: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:611
6: std::panicking::begin_panic
at ./src/libstd/panicking.rs:572
7: rustc_errors::Handler::bug
at src/librustc_errors/lib.rs:486
8: rustc::session::opt_span_bug_fmt::{{closure}}
at src/librustc/session/mod.rs:852
9: rustc::ty::context::tls::with_opt::{{closure}}
at src/librustc/ty/context.rs:1289
10: rustc::ty::context::tls::with::{{closure}}
at src/librustc/ty/context.rs:1278
11: <std::thread::local::LocalKey<T>>::try_with
at ./src/libstd/thread/local.rs:365
12: <std::thread::local::LocalKey<T>>::with
at ./src/libstd/thread/local.rs:279
13: rustc::ty::context::tls::with
at src/librustc/ty/context.rs:1274
14: rustc::ty::context::tls::with_opt
at src/librustc/ty/context.rs:1289
15: rustc::session::opt_span_bug_fmt
at src/librustc/session/mod.rs:848
16: rustc::session::bug_fmt
at src/librustc/session/mod.rs:832
17: rustc::ty::context::validate_hir_id_for_typeck_tables::{{closure}}
at src/librustc/ty/context.rs:237
18: rustc::ty::context::tls::with::{{closure}}
at src/librustc/ty/context.rs:1278
19: <std::thread::local::LocalKey<T>>::try_with
at ./src/libstd/thread/local.rs:365
20: <std::thread::local::LocalKey<T>>::with
at ./src/libstd/thread/local.rs:279
21: rustc::ty::context::tls::with
at src/librustc/ty/context.rs:1274
22: rustc::ty::context::validate_hir_id_for_typeck_tables
at src/librustc/ty/context.rs:232
23: rustc::ty::context::TypeckTables::node_id_to_type_opt
at src/librustc/ty/context.rs:448
24: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_formals
at src/librustc_save_analysis/dump_visitor.rs:322
25: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_foreign_item::{{closure}}
at src/librustc_save_analysis/dump_visitor.rs:1518
26: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::nest_tables
at src/librustc_save_analysis/dump_visitor.rs:115
27: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_foreign_item
at src/librustc_save_analysis/dump_visitor.rs:1518
28: syntax::visit::walk_item
at ./src/libsyntax/visit.rs:146
29: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_item
at src/librustc_save_analysis/dump_visitor.rs:1254
30: syntax::visit::walk_stmt
at ./src/libsyntax/visit.rs:624
31: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_stmt
at src/librustc_save_analysis/dump_visitor.rs:1499
32: syntax::visit::walk_block
at ./src/libsyntax/visit.rs:146
33: syntax::visit::Visitor::visit_block
at ./src/libsyntax/visit.rs:66
34: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_fn::{{closure}}::{{closure}}
at src/librustc_save_analysis/dump_visitor.rs:464
35: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::nest_scope
at src/librustc_save_analysis/dump_visitor.rs:100
36: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_fn::{{closure}}
at src/librustc_save_analysis/dump_visitor.rs:464
37: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::nest_tables
at src/librustc_save_analysis/dump_visitor.rs:112
38: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_fn
at src/librustc_save_analysis/dump_visitor.rs:464
39: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_item
at src/librustc_save_analysis/dump_visitor.rs:1206
40: syntax::visit::walk_mod
at ./src/libsyntax/visit.rs:146
41: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_item::{{closure}}
at src/librustc_save_analysis/dump_visitor.rs:1224
42: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::nest_scope
at src/librustc_save_analysis/dump_visitor.rs:100
43: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_item
at src/librustc_save_analysis/dump_visitor.rs:1224
44: syntax::visit::walk_mod
at ./src/libsyntax/visit.rs:146
45: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_mod::{{closure}}
at src/librustc_save_analysis/dump_visitor.rs:1111
46: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::nest_scope
at src/librustc_save_analysis/dump_visitor.rs:100
47: <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_mod
at src/librustc_save_analysis/dump_visitor.rs:1111
48: syntax::visit::walk_crate
at ./src/libsyntax/visit.rs:180
49: <rustc_save_analysis::DumpHandler<'a> as rustc_save_analysis::SaveHandler>::save
at src/librustc_save_analysis/lib.rs:939
50: rustc_save_analysis::process_crate
at ./src/librustc_save_analysis/lib.rs:986
51: rustc_driver::enable_save_analysis::{{closure}}::{{closure}}
at src/librustc_driver/lib.rs:697
52: rustc::util::common::time
at ./src/librustc/util/common.rs:48
53: rustc_driver::enable_save_analysis::{{closure}}
at src/librustc_driver/lib.rs:696
54: rustc_driver::driver::compile_input::{{closure}}
at src/librustc_driver/driver.rs:217
55: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
at src/librustc_driver/driver.rs:1101
56: rustc::ty::context::tls::enter::{{closure}}
at ./src/librustc/ty/context.rs:1262
57: <std::thread::local::LocalKey<T>>::try_with
at ./src/libstd/thread/local.rs:365
58: <std::thread::local::LocalKey<T>>::with
at ./src/libstd/thread/local.rs:279
59: rustc::ty::context::tls::enter
at ./src/librustc/ty/context.rs:1259
60: rustc::ty::context::tls::enter_global::{{closure}}
at ./src/librustc/ty/context.rs:1246
61: <std::thread::local::LocalKey<T>>::try_with
at ./src/libstd/thread/local.rs:365
62: <std::thread::local::LocalKey<T>>::with
at ./src/libstd/thread/local.rs:279
63: rustc::ty::context::tls::enter_global
at ./src/librustc/ty/context.rs:1243
64: rustc::ty::context::TyCtxt::create_and_enter
at ./src/librustc/ty/context.rs:1024
65: rustc_driver::driver::phase_3_run_analysis_passes
at src/librustc_driver/driver.rs:1014
66: rustc_driver::driver::compile_input
at src/librustc_driver/driver.rs:196
67: rustc_driver::run_compiler
at src/librustc_driver/lib.rs:316
68: rustc_driver::main::{{closure}}
at src/librustc_driver/lib.rs:1338
69: rustc_driver::run::{{closure}}
at src/librustc_driver/lib.rs:132
70: rustc_driver::monitor::{{closure}}
at src/librustc_driver/lib.rs:1255
error: Could not compile `core`.
Caused by:
process didn't exit successfully: `/home/dvc/repos/riscv-rust/rust/build/bootstrap/debug/rustc --crate-name core src/libcore/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=0f4c6fa20e4370e3 -C extra-filename=-0f4c6fa20e4370e3 --out-dir /home/dvc/repos/riscv-rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/dvc/repos/riscv-rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/dvc/repos/riscv-rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/debug/deps` (exit code: 101)
thread 'main' panicked at 'command did not execute successfully: "/home/dvc/repos/riscv-rust/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "--features" "panic-unwind debug-jemalloc jemalloc backtrace" "--manifest-path" "/home/dvc/repos/riscv-rust/rust/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101', src/bootstrap/compile.rs:869:8
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:60
at /checkout/src/libstd/panicking.rs:380
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:396
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:611
5: std::panicking::begin_panic_new
at /checkout/src/libstd/panicking.rs:553
6: std::panicking::begin_panic_fmt
at /checkout/src/libstd/panicking.rs:521
7: bootstrap::compile::run_cargo
8: <bootstrap::compile::Std as bootstrap::builder::Step>::run
9: bootstrap::builder::Builder::ensure
10: <bootstrap::compile::Test as bootstrap::builder::Step>::run
11: bootstrap::builder::Builder::ensure
12: <bootstrap::compile::Rustc as bootstrap::builder::Step>::run
13: bootstrap::builder::Builder::ensure
14: <bootstrap::compile::Assemble as bootstrap::builder::Step>::run
15: bootstrap::builder::Builder::ensure
16: bootstrap::builder::Builder::compiler
17: <bootstrap::compile::Std as bootstrap::builder::Step>::make_run
18: bootstrap::builder::StepDescription::maybe_run
19: bootstrap::builder::StepDescription::run
20: bootstrap::builder::Builder::run
21: bootstrap::Build::build
22: bootstrap::main
23: __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
24: std::rt::lang_start
at /checkout/src/libstd/panicking.rs:458
at /checkout/src/libstd/panic.rs:361
at /checkout/src/libstd/rt.rs:59
25: main
26: __libc_start_main
27: _start
failed to run: /home/dvc/repos/riscv-rust/rust/build/bootstrap/debug/bootstrap buildMetadata
Metadata
Assignees
Labels
A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.Area: saving results of analyses such as inference and borrowck results to a file.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-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-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.
Activity
jessicah commentedon Sep 7, 2017
Just hit this myself. It only happens in my builds if I pass
--enable-extendedto configure script for my CI container. Running with and without each time from a clean obj directory.Note that it does need to be a clean build when changing
--enable-extended. This does not happen if I start without--enable-extendedthen rebuilding with it added with existing build artefacts present.At commit a209539
cuviper commentedon Sep 8, 2017
Ping @michaelwoerister, since you wrote commit 783ccc4 implicated in OP, any ideas?
michaelwoerister commentedon Sep 9, 2017
Hm, looks like the
DumpVisitorin save-analysis doesn't update itsTypeckTablescorrectly as it traverses the AST. I'll take a closer look next week.jld commentedon Sep 16, 2017
I just ran into this trying to run the CI container build for FreeBSD, to investigate #44433. I worked around it for now by removing
--enable-extended, but I'm a little confused, because according to the list of platformsx86_64-unknown-freebsdis Tier 2 and build breakages won't land, which would mean that there's something different about my local setup that's observable inside the container and relevant to this part of rustc.oli-obk commentedon Dec 20, 2017
ping @michaelwoerister I just ran into this
michaelwoerister commentedon Dec 20, 2017
Maybe @nrc can help debug this? It seems that in
DumpVisitor::process_formals(), one of thecollected_idents(withNodeId=1) is something that is not actually part of the function being visited, thus triggering an assertion when we try to look up the type of that node. It looks valid to me that the assertion is triggered. But it's strange that thePathCollectorthere should find that node. AreNodeIdsin the AST reliable?mcandre commentedon Dec 31, 2017
How can NetBSD users inject the
--enable-extendedflag for installing rust via pkgsrc? I'm getting the same exit 101 error withsu root -c "cd /usr/pkgsrc/lang/rust && sudo make install PKG_OPTIONS.python27=-x11".As a workaround, I'm using rustup to install rustc and cargo in NetBSD, now that rustup features support for the NetBSD kernel :)
nrc commentedon Jan 12, 2018
Does anyone have a minimal test case for this?
That NodeId=1 seems suspicious, it would be good to see the source code where this happened to get some idea about what is going on. Maybe it is a synthetic argument for a
selfargument? It would have to be some weird edge case, or I'd think we'd hit this a lot.jonas-schievink commentedon Aug 25, 2019
#63663 seems like it has an easy reproduction
jonas-schievink commentedon Aug 25, 2019
Nominating. This has been reported at least 6 times, and is being hit in random PR builds too.
nikomatsakis commentedon Aug 29, 2019
Visiting for compiler triage.
This problems seems to be closely tied to save-analysis, correct? @Xanewok, maybe you can investigate, and ping @michaelwoerister for help where needed?
nikomatsakis commentedon Aug 29, 2019
Marking P-high and assigning to @Xanewok, because I'm optimistic like that.
Xanewok commentedon Sep 5, 2019
This looks strikingly similar to #60649 where we didn't nest typeck tables in the AST visitor.
In this case it's
visit_foreign_item > process_formalsso hopefully we can reproduce that on source such asXanewok commentedon Sep 5, 2019
The backtrace in the OP is outdated or at least that's not the issue I first encountered.
In general it seems that generating save-analysis from libcore triggers a debug-assertion (which is why it came up recently when running dist builds with
-C debug-assertions=y).I managed to reproduce it with:
by running
$ RUSTC_SAVE_ANALYSIS=api ./x.py buildThe current backtrace I'm getting is as follows:
on most recent
masterwhich I believe stumbles on
rust/src/libcore/iter/adapters/flatten.rs
Lines 245 to 260 in 9776723
most specifically when processing the associated
T::IntoIter(IIUC the typeck tables are not nested correctly somehow)Xanewok commentedon Sep 6, 2019
With
debug_assertions-enabled rustc, I managed to minimize the reproduction case when generating save-analysis toRollup merge of rust-lang#64250 - Xanewok:save-analysis-assoc-nested,…
Rollup merge of rust-lang#64250 - Xanewok:save-analysis-assoc-nested,…