Closed
Description
Code
This is from https://github.com/theduke/rustc-cranelift-bench by @theduke.
[package]
name = "clif_bench"
version = "0.1.0"
authors = ["Christoph Herzog <chris@theduke.at>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
chrono = { version = "0.4.19", features = ["serde"] }
serde = { version = "1.0.124", features = ["derive"] }
serde_json = "1.0.64"
tracing = "0.1.25"
tracing-subscriber = { version = "0.2.16", features = ["fmt"] }
url = { version = "2.2.1", features = ["serde"] }
uuid = { version = "0.8.2", features = ["serde"] }
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug)]
struct S {
a: bool,
i: i64,
d: Option<chrono::DateTime<chrono::Utc>>,
url: Option<url::Url>,
id: Option<uuid::Uuid>,
}
fn main() {
tracing_subscriber::fmt::init();
tracing::info!("start");
let s = S{
a: true,
i: 42,
d: None,
url: None,
id: None,
};
let raw = serde_json::to_string(&s).unwrap();
let recovered: S = serde_json::from_str(&raw).unwrap();
assert_eq!(s, recovered);
tracing::info!("done");
}
Repro
cargo build
- Run the final rustc invocation with a
--sysroot
argument for a different sysroot compiled by the same rustc. - ICE
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (8f349be27 2021-03-08)
binary: rustc
commit-hash: 8f349be27815d43d462a32faeb270a22a68486b6
commit-date: 2021-03-08
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
Error output
thread 'rustc' panicked at 'Failed to get crate data for crate19', compiler/rustc_metadata/src/creader.rs:136:32
Backtrace
stack backtrace:
0: rust_begin_unwind
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:493:5
1: std::panicking::begin_panic_fmt
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:435:5
2: rustc_metadata::creader::CrateLoader::maybe_resolve_crate
3: rustc_metadata::creader::CrateLoader::maybe_process_path_extern
4: rustc_resolve::Resolver::extern_prelude_get
5: rustc_resolve::macros::<impl rustc_resolve::Resolver>::early_resolve_ident_in_lexical_scope
6: rustc_resolve::Resolver::resolve_path_with_ribs::{{closure}}
7: rustc_resolve::Resolver::resolve_path_with_ribs
8: rustc_resolve::macros::<impl rustc_resolve::Resolver>::resolve_macro_path
9: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::resolve_macro_invocation
10: rustc_expand::expand::MacroExpander::fully_expand_fragment
11: rustc_expand::expand::MacroExpander::expand_crate
12: rustc_session::utils::<impl rustc_session::session::Session>::time
13: rustc_interface::passes::configure_and_expand_inner
14: rustc_interface::passes::configure_and_expand::{{closure}}
15: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
16: rustc_interface::passes::configure_and_expand
17: rustc_interface::queries::Queries::expansion
18: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
19: rustc_span::with_source_map
20: rustc_interface::interface::create_compiler_and_run
21: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.52.0-nightly (8f349be27 2021-03-08) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C panic=abort --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
With a small change to the source I even managed to get a delayed bug to trigger after the ICE backtrace:
diff --git a/src/main.rs b/src/main.rs
index a629550..ef634e7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -11,19 +11,4 @@ struct S {
fn main() {
tracing_subscriber::fmt::init();
tracing::info!("start");
-
- let s = S{
- a: true,
- i: 42,
- d: None,
- url: None,
- id: None,
- };
-
- let raw = serde_json::to_string(&s).unwrap();
- let recovered: S = serde_json::from_str(&raw).unwrap();
-
- assert_eq!(s, recovered);
-
- tracing::info!("done");
}
thread 'rustc' panicked at 'Failed to get crate data for crate19', compiler/rustc_metadata/src/creader.rs:136:32
stack backtrace:
0: rust_begin_unwind
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:493:5
1: std::panicking::begin_panic_fmt
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:435:5
2: rustc_metadata::creader::CrateLoader::maybe_resolve_crate
3: rustc_metadata::creader::CrateLoader::maybe_process_path_extern
4: rustc_resolve::Resolver::extern_prelude_get
5: rustc_resolve::macros::<impl rustc_resolve::Resolver>::early_resolve_ident_in_lexical_scope
6: rustc_resolve::Resolver::resolve_path_with_ribs::{{closure}}
7: rustc_resolve::Resolver::resolve_path_with_ribs
8: rustc_resolve::macros::<impl rustc_resolve::Resolver>::resolve_macro_path
9: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::resolve_macro_invocation
10: rustc_expand::expand::MacroExpander::fully_expand_fragment
11: rustc_expand::expand::MacroExpander::expand_crate
12: rustc_session::utils::<impl rustc_session::session::Session>::time
13: rustc_interface::passes::configure_and_expand_inner
14: rustc_interface::passes::configure_and_expand::{{closure}}
15: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
16: rustc_interface::passes::configure_and_expand
17: rustc_interface::queries::Queries::expansion
18: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
19: rustc_span::with_source_map
20: rustc_interface::interface::create_compiler_and_run
21: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.52.0-nightly (8f349be27 2021-03-08) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C panic=abort --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: internal compiler error: expansion entered force mode without producing any errors
--> src/main.rs:13:5
|
13 | tracing::info!("start");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: delayed at compiler/rustc_expand/src/expand.rs:450:34
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1012:13
stack backtrace:
0: 0x7fd750ed07f0 - std::backtrace_rs::backtrace::libunwind::trace::h7ebc0dc57eca9f9f
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x7fd750ed07f0 - std::backtrace_rs::backtrace::trace_unsynchronized::h1edc0478d7bdf5c0
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fd750ed07f0 - std::sys_common::backtrace::_print_fmt::hbb311d6132fce696
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7fd750ed07f0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h03d3f67952eb1474
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7fd750f3fa1f - core::fmt::write::h127419eb46f2ecc9
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/core/src/fmt/mod.rs:1092:17
5: 0x7fd750ec42e2 - std::io::Write::write_fmt::hd5dc550bce1749bc
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/io/mod.rs:1567:15
6: 0x7fd750ed4665 - std::sys_common::backtrace::_print::h90485b7fc45739f1
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7fd750ed4665 - std::sys_common::backtrace::print::h580a1169aa12c859
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7fd750ed4665 - std::panicking::default_hook::{{closure}}::h9a5ebd561570f374
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:208:50
9: 0x7fd750ed4113 - std::panicking::default_hook::hf184b9bb4512b229
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:225:9
10: 0x7fd7516c076b - rustc_driver::report_ice::h839363725321ec36
11: 0x7fd750ed4dd0 - std::panicking::rust_panic_with_hook::ha986482ea3855e1a
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:595:17
12: 0x7fd750ed4947 - std::panicking::begin_panic_handler::{{closure}}::hf83a7d38b8aaf96f
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:497:13
13: 0x7fd750ed0c8c - std::sys_common::backtrace::__rust_end_short_backtrace::hde9b7d88bfadfe76
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/sys_common/backtrace.rs:141:18
14: 0x7fd750ed48a9 - rust_begin_unwind
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:493:5
15: 0x7fd750e980eb - std::panicking::begin_panic_fmt::h0170054cfae87e91
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/panicking.rs:435:5
16: 0x7fd753e82899 - rustc_errors::HandlerInner::flush_delayed::h50504530b90bea60
17: 0x7fd753e81259 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hee91671f04827c06
18: 0x7fd75349fbd6 - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::h6f71262dd4fac774
19: 0x7fd7534a2800 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::ha61f934e3506719c
20: 0x7fd7534a400d - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::h9850104d4cd168fa
21: 0x7fd7534a3aa7 - rustc_span::with_source_map::hea5ba571ebb20280
22: 0x7fd7534a58fa - rustc_interface::interface::create_compiler_and_run::h5f97656bcc8a4930
23: 0x7fd7534a3bcf - rustc_span::with_session_globals::h7d9c5cb670da0b78
24: 0x7fd7534a5c7c - std::sys_common::backtrace::__rust_begin_short_backtrace::hd327375d1fa29fe7
25: 0x7fd7534c0f45 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h2dd366f87a09cc65
26: 0x7fd750ee48ba - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h83eba159d58672b0
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/alloc/src/boxed.rs:1546:9
27: 0x7fd750ee48ba - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4c917549e359165b
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/alloc/src/boxed.rs:1546:9
28: 0x7fd750ee48ba - std::sys::unix::thread::Thread::new::thread_start::h28edfc134fd92155
at /rustc/8f349be27815d43d462a32faeb270a22a68486b6/library/std/src/sys/unix/thread.rs:71:17
29: 0x7fd750de2fa3 - start_thread
30: 0x7fd750d024cf - clone
31: 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.52.0-nightly (8f349be27 2021-03-08) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C panic=abort --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
thread panicked while panicking. aborting.
[1] 3850 illegal hardware instruction rustc --crate-name clif_bench --edition=2018 src/main.rs --crate-type bin -C
Removing tracing::info!("start");
too fixes the ICE.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.