I got this ICE when compiling one of the UI test files ( slice-pattern-const.rs ) as a normal cargo project.
How can that be? Well, compiler flags are different than in the test suit. The culprit turns out to be incremental compilation.
The following ICEs:
rustc main.rs -C incremental=true
cargo check
The following works as expected:
rustc main.rs
cargo build --release
.
There is a fun bonus bug in here:
cargo clean ; cargo check
delete the line b"" => (),
run cargo check
add that line again.
Now cargo checkdoesn't ICE anymore, on the original code.
Affected versions
The bug report is made with rustc 1.63.0-nightly (1fede1753 2022-05-28), but this ICE seems to be very old.
Output of cargo bisect-rustc --preserve --prompt --end=2021-09-11 --start=2020-01-01:
[...]
searched toolchains nightly-2020-01-01 through nightly-2021-09-11
********************************************************************************
Regression in nightly-2020-10-26
********************************************************************************
fetching https://static.rust-lang.org/dist/2020-10-25/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2020-10-25: 40 B / 40 B [=======================================================] 100.00 % 57.27 KB/s converted 2020-10-25 to ffa2e7ae8fbf9badc035740db949b9dae271c29f
fetching https://static.rust-lang.org/dist/2020-10-26/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2020-10-26: 40 B / 40 B [=======================================================] 100.00 % 81.40 KB/s converted 2020-10-26 to 4760b8fb886a3702ae11bfa7868d495b2675b5ed
looking for regression commit between 2020-10-25 and 2020-10-26
cloning rust repository
fetching (via local git) commits from ffa2e7ae8fbf9badc035740db949b9dae271c29f to 4760b8fb886a3702ae11bfa7868d495b2675b5ed
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 11 bors merge commits in the specified range
commit[0] 2020-10-24UTC: Auto merge of #77255 - Aaron1011:feature/collect-attr-tokens, r=petrochenkov
commit[1] 2020-10-24UTC: Auto merge of #78334 - jonas-schievink:rollup-z0gzbmm, r=jonas-schievink
commit[2] 2020-10-25UTC: Auto merge of #78310 - ebroto:clippyup, r=Manishearth
commit[3] 2020-10-25UTC: Auto merge of #77526 - RalfJung:dont-promote-unions, r=lcnr
commit[4] 2020-10-25UTC: Auto merge of #77398 - wesleywiser:measureme_0_8, r=Mark-Simulacrum
commit[5] 2020-10-25UTC: Auto merge of #77546 - lcnr:impl-trait-closure, r=eddyb
commit[6] 2020-10-25UTC: Auto merge of #77476 - tgnottingham:buffered_siphasher128, r=nnethercote
commit[7] 2020-10-25UTC: Auto merge of #78350 - JohnTitor:rollup-vbbm5wf, r=JohnTitor
commit[8] 2020-10-25UTC: Auto merge of #78253 - Aaron1011:bump-llvm-deadarg, r=cuviper
commit[9] 2020-10-25UTC: Auto merge of #77901 - jonas-schievink:unignore-test-36710, r=Mark-Simulacrum
commit[10] 2020-10-25UTC: Auto merge of #78179 - RalfJung:miri-comments, r=oli-obk
ERROR: no CI builds available between ffa2e7ae8fbf9badc035740db949b9dae271c29f and 4760b8fb886a3702ae11bfa7868d495b2675b5ed within last 167 days
Error output
Checking tempdir v0.1.0 (D:\Dokumente\Rust\fuzzing-rustc\repos\Second ICE\tempdir)
thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, constness: NotConst }, value: Val(Scalar(alloc5), &[u8; 0]) }
- dep-node: deref_mir_constant(f274d09d4d410170-67b2b755964a310a)', /rustc/1fede1753c33f4ce0660ad9b8edbd618d9733daf\compiler\rustc_query_system\src\dep_graph\graph.rs:300:9
stack backtrace:
0: 0x7ff9cf899b4f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h58508b3f8525c109
1: 0x7ff9cf8d4e5a - core::fmt::write::h00a3e95c7c04103e
2: 0x7ff9cf88c009 - <std::io::IoSlice as core::fmt::Debug>::fmt::h7884a9e95f1b1022
3: 0x7ff9cf89d43b - std::panicking::default_hook::h3f8dbc57d7df9994
4: 0x7ff9cf89d0bb - std::panicking::default_hook::h3f8dbc57d7df9994
5: 0x7ff9b77ef2d6 - <rustc_metadata[b2f2848d139875d1]::rmeta::encoder::EncodeContext as rustc_serialize[979d5f7f20b036c4]::serialize::Encoder>::emit_raw_bytes
6: 0x7ff9cf89dbe2 - std::panicking::rust_panic_with_hook::he403a961d6bd3e59
7: 0x7ff9cf89d97d - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h9b9722e75b45b376
8: 0x7ff9cf89a787 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h58508b3f8525c109
9: 0x7ff9cf89d659 - rust_begin_unwind
10: 0x7ff9cf908935 - core::panicking::panic_fmt::hcf4174d66c865fdf
11: 0x7ff9bb0919f4 - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
12: 0x7ff9bb028c80 - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
13: 0x7ff9bacbdff6 - <rustc_query_impl[fcbe4ce9962e1e39]::Queries as rustc_middle[c72282b761ffb2ca]::ty::query::QueryEngine>::try_mark_green
14: 0x7ff9ba74ce4b - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::PatternError as core[97cc336334fd47ab]::fmt::Debug>::fmt
15: 0x7ff9ba742450 - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::PatternError as core[97cc336334fd47ab]::fmt::Debug>::fmt
16: 0x7ff9ba7303be - <rustc_mir_build[6ed738a698dde9b0]::build::NeedsTemporary as core[97cc336334fd47ab]::fmt::Debug>::fmt
17: 0x7ff9ba72c236 - <rustc_mir_build[6ed738a698dde9b0]::build::NeedsTemporary as core[97cc336334fd47ab]::fmt::Debug>::fmt
18: 0x7ff9ba6d50bb - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::check_match::MatchVisitor as rustc_hir[58843d480a0d6ffd]::intravisit::Visitor>::visit_param
19: 0x7ff9ba6dfc8c - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::check_match::LetSource as core[97cc336334fd47ab]::fmt::Debug>::fmt
20: 0x7ff9ba6d2cff - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::check_match::MatchVisitor as rustc_hir[58843d480a0d6ffd]::intravisit::Visitor>::visit_expr
21: 0x7ff9ba6d2991 - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::check_match::MatchVisitor as rustc_hir[58843d480a0d6ffd]::intravisit::Visitor>::visit_expr
22: 0x7ff9ba6d2447 - <rustc_mir_build[6ed738a698dde9b0]::thir::pattern::deconstruct_pat::Fields as core[97cc336334fd47ab]::fmt::Debug>::fmt
23: 0x7ff9bad84651 - <&[(rustc_middle[c72282b761ffb2ca]::middle::exported_symbols::ExportedSymbol, rustc_middle[c72282b761ffb2ca]::middle::exported_symbols::SymbolExportInfo)] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
24: 0x7ff9bb0b35a7 - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
25: 0x7ff9baf6f3d7 - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
26: 0x7ff9bb010a9b - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
27: 0x7ff9b794ca29 - <rustc_interface[dd9c94d8fc04b103]::passes::boxed_resolver::BoxedResolver>::to_resolver_outputs
28: 0x7ff9b78fc4d3 - <rustc_interface[dd9c94d8fc04b103]::queries::Linker>::link
29: 0x7ff9b78ff64b - <rustc_interface[dd9c94d8fc04b103]::queries::Linker>::link
30: 0x7ff9b78e8a20 - rustc_interface[dd9c94d8fc04b103]::passes::analysis
31: 0x7ff9bad852de - <&[(rustc_middle[c72282b761ffb2ca]::middle::exported_symbols::ExportedSymbol, rustc_middle[c72282b761ffb2ca]::middle::exported_symbols::SymbolExportInfo)] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
32: 0x7ff9bb0c45bf - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
33: 0x7ff9baf9f924 - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
34: 0x7ff9bb061c06 - <&[rustc_middle[c72282b761ffb2ca]::thir::abstract_const::Node] as rustc_serialize[979d5f7f20b036c4]::serialize::Decodable<rustc_query_impl[fcbe4ce9962e1e39]::on_disk_cache::CacheDecoder>>::decode
35: 0x7ff9b77a96cf - <rustc_driver[2389871ec3bd2ddd]::args::Error as core[97cc336334fd47ab]::fmt::Debug>::fmt
36: 0x7ff9b77853a9 - <rustc_mir_dataflow[3acb063bbaa902c6]::impls::liveness::MaybeLiveLocals as rustc_mir_dataflow[3acb063bbaa902c6]::framework::AnalysisDomain>::initialize_start_block
37: 0x7ff9b77fbf75 - <rustc_driver[2389871ec3bd2ddd]::Compilation as core[97cc336334fd47ab]::fmt::Debug>::fmt
38: 0x7ff9b77a5b70 - <rustc_mir_dataflow[3acb063bbaa902c6]::impls::liveness::MaybeLiveLocals as rustc_mir_dataflow[3acb063bbaa902c6]::framework::AnalysisDomain>::initialize_start_block
39: 0x7ff9b777d8a7 - <rustc_mir_dataflow[3acb063bbaa902c6]::impls::liveness::MaybeLiveLocals as rustc_mir_dataflow[3acb063bbaa902c6]::framework::AnalysisDomain>::initialize_start_block
40: 0x7ff9b77ebc16 - <rustc_metadata[b2f2848d139875d1]::rmeta::encoder::EncodeContext as rustc_serialize[979d5f7f20b036c4]::serialize::Encoder>::emit_raw_bytes
41: 0x7ff9b77ae7f8 - <rustc_driver[2389871ec3bd2ddd]::args::Error as core[97cc336334fd47ab]::fmt::Debug>::fmt
42: 0x7ff9cf8aee2c - std::sys::windows::thread::Thread::new::h811e7c4461002a6b
43: 0x7ffa33f754e0 - BaseThreadInitThunk
44: 0x7ffa350e485b - RtlUserThreadStart
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.63.0-nightly (1fede1753 2022-05-28) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin -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 [deref_mir_constant] deref constant
#1 [check_match] match-checking `main`
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `tempdir`
Minimized Code
Summary
I got this ICE when compiling one of the UI test files ( slice-pattern-const.rs ) as a normal cargo project. How can that be? Well, compiler flags are different than in the test suit. The culprit turns out to be incremental compilation.
The following ICEs:
rustc main.rs -C incremental=true
cargo check
The following works as expected:
rustc main.rs
cargo build --release
.
There is a fun bonus bug in here:
cargo clean ; cargo check
b"" => (),
cargo check
cargo check
doesn't ICE anymore, on the original code.Affected versions
The bug report is made with
rustc 1.63.0-nightly (1fede1753 2022-05-28)
, but this ICE seems to be very old.Output of
cargo bisect-rustc --preserve --prompt --end=2021-09-11 --start=2020-01-01
:Error output