ICE: unexpected region in query response: `ReError`
matthiaskrgr opened this issue · 7 comments
Code
trait Lt<'_> {
type T = ();
}
impl<'f> Lt<'a> for () {
type T = ();
}
fn main() {
let v:<() as Lt<'_>>::T = ();
}
Meta
rustc --version --verbose
:
rustc 1.70.0-nightly (7b4f48927 2023-03-12)
binary: rustc
commit-hash: 7b4f48927dce585f747a58083b45ab62b9d73a53
commit-date: 2023-03-12
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7
Error output
error[E0637]: `'_` cannot be used here
--> 6.rs:3:10
|
3 | trait Lt<'_> {
| ^^ `'_` is a reserved lifetime name
error[E0261]: use of undeclared lifetime name `'a`
--> 6.rs:6:13
|
6 | impl<'f> Lt<'a> for () {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `'a,`
error[E0658]: associated type defaults are unstable
--> 6.rs:4:5
|
4 | type T = ();
| ^^^^^^^^^^^^
|
= note: see issue #29661 <https://github.com/rust-lang/rust/issues/29661> for more information
= help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable
Backtrace
error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:237:17: unexpected region in query response: `ReError`
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
0: 0x7f671eb6651a - std::backtrace_rs::backtrace::libunwind::trace::hf7d75cca16fd1b61
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f671eb6651a - std::backtrace_rs::backtrace::trace_unsynchronized::hf5ec95734aab509d
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f671eb6651a - std::sys_common::backtrace::_print_fmt::he95113413355c8cd
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f671eb6651a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h072d12f2e69ca92b
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f671ebc9c5e - core::fmt::write::h1d23f16415e96af2
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/core/src/fmt/mod.rs:1232:17
5: 0x7f671eb59275 - std::io::Write::write_fmt::hcf1e413fde4ffcd5
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/io/mod.rs:1684:15
6: 0x7f671eb662e5 - std::sys_common::backtrace::_print::h6b2b14bedd5177e7
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:47:5
7: 0x7f671eb662e5 - std::sys_common::backtrace::print::h09ccebfbcd382e89
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:34:9
8: 0x7f671eb6905f - std::panicking::default_hook::{{closure}}::h4ee055db778febc2
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/panicking.rs:271:22
9: 0x7f671eb68d9b - std::panicking::default_hook::ha74f60e3a15d95fb
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/panicking.rs:290:9
10: 0x7f6721e97085 - rustc_driver_impl[d355a67661263e47]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f671eb6989d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7f34603beb945e8f
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/alloc/src/boxed.rs:2002:9
12: 0x7f671eb6989d - std::panicking::rust_panic_with_hook::h4b5d379936d4932f
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/panicking.rs:696:13
13: 0x7f6722402371 - std[e52d7c968ed01318]::panicking::begin_panic::<rustc_errors[45159b7f7e36021d]::ExplicitBug>::{closure#0}
14: 0x7f67223fdaa6 - std[e52d7c968ed01318]::sys_common::backtrace::__rust_end_short_backtrace::<std[e52d7c968ed01318]::panicking::begin_panic<rustc_errors[45159b7f7e36021d]::ExplicitBug>::{closure#0}, !>
15: 0x7f6722486046 - std[e52d7c968ed01318]::panicking::begin_panic::<rustc_errors[45159b7f7e36021d]::ExplicitBug>
16: 0x7f6722451e06 - std[e52d7c968ed01318]::panic::panic_any::<rustc_errors[45159b7f7e36021d]::ExplicitBug>
17: 0x7f672244d966 - <rustc_errors[45159b7f7e36021d]::HandlerInner>::bug::<&alloc[fc860cae0dfa1ab1]::string::String>
18: 0x7f672244d630 - <rustc_errors[45159b7f7e36021d]::Handler>::bug::<&alloc[fc860cae0dfa1ab1]::string::String>
19: 0x7f6722439a9b - rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt::<rustc_span[f8bdfaef83e46314]::span_encoding::Span>::{closure#0}
20: 0x7f67224384fa - rustc_middle[a96ac5d591578447]::ty::context::tls::with_opt::<rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt<rustc_span[f8bdfaef83e46314]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7f67224384c6 - rustc_middle[a96ac5d591578447]::ty::context::tls::with_context_opt::<rustc_middle[a96ac5d591578447]::ty::context::tls::with_opt<rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt<rustc_span[f8bdfaef83e46314]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7f67224399e6 - rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt::<rustc_span[f8bdfaef83e46314]::span_encoding::Span>
23: 0x7f67204b44b3 - rustc_middle[a96ac5d591578447]::util::bug::bug_fmt
24: 0x7f67217bad67 - <rustc_infer[8071ebb96624e335]::infer::canonical::canonicalizer::CanonicalizeUserTypeAnnotation as rustc_infer[8071ebb96624e335]::infer::canonical::canonicalizer::CanonicalizeMode>::canonicalize_free_region
25: 0x7f671fe7892d - <rustc_infer[8071ebb96624e335]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[ef90c9bcaa805a1f]::fold::FallibleTypeFolder<rustc_middle[a96ac5d591578447]::ty::context::TyCtxt>>::try_fold_region
26: 0x7f671fe768d9 - <&rustc_middle[a96ac5d591578447]::ty::list::List<rustc_middle[a96ac5d591578447]::ty::subst::GenericArg> as rustc_type_ir[ef90c9bcaa805a1f]::fold::TypeFoldable<rustc_middle[a96ac5d591578447]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[8071ebb96624e335]::infer::canonical::canonicalizer::Canonicalizer>
27: 0x7f671fe71dc1 - <rustc_infer[8071ebb96624e335]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[ef90c9bcaa805a1f]::fold::TypeFolder<rustc_middle[a96ac5d591578447]::ty::context::TyCtxt>>::fold_ty
28: 0x7f672022b039 - <rustc_infer[8071ebb96624e335]::infer::InferCtxt>::canonicalize_user_type_annotation::<rustc_middle[a96ac5d591578447]::ty::typeck_results::UserType>
29: 0x7f671ff53c02 - <rustc_hir_typeck[8554c3125ad8338a]::gather_locals::GatherLocalsVisitor as rustc_hir[4aa57babd8685147]::intravisit::Visitor>::visit_local
30: 0x7f671ff5398d - <rustc_hir_typeck[8554c3125ad8338a]::gather_locals::GatherLocalsVisitor as rustc_hir[4aa57babd8685147]::intravisit::Visitor>::visit_expr
31: 0x7f6720d9e5bd - rustc_hir_typeck[8554c3125ad8338a]::check::check_fn
32: 0x7f6720d86a8e - rustc_hir_typeck[8554c3125ad8338a]::typeck
33: 0x7f672090a536 - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::typeck, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
34: 0x7f6721623822 - rustc_data_structures[cc19bc993ab9b64]::sync::par_for_each_in::<&[rustc_span[f8bdfaef83e46314]::def_id::LocalDefId], <rustc_middle[a96ac5d591578447]::hir::map::Map>::par_body_owners<rustc_hir_typeck[8554c3125ad8338a]::typeck_item_bodies::{closure#0}>::{closure#0}>
35: 0x7f67216235df - rustc_hir_typeck[8554c3125ad8338a]::typeck_item_bodies
36: 0x7f67216a0237 - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::typeck_item_bodies, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
37: 0x7f672169ff0c - <rustc_query_impl[217bee59c5548bf5]::Queries as rustc_middle[a96ac5d591578447]::ty::query::QueryEngine>::typeck_item_bodies
38: 0x7f67201b00c6 - <rustc_session[7e23441c2db8ce4a]::session::Session>::time::<(), rustc_hir_analysis[357075c2c3fc2a7b]::check_crate::{closure#7}>
39: 0x7f67201acda8 - rustc_hir_analysis[357075c2c3fc2a7b]::check_crate
40: 0x7f67201a2d12 - rustc_interface[6bf42eb308c32713]::passes::analysis
41: 0x7f67216ab71c - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::analysis, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
42: 0x7f67216ab410 - <rustc_query_impl[217bee59c5548bf5]::Queries as rustc_middle[a96ac5d591578447]::ty::query::QueryEngine>::analysis
43: 0x7f67214d02f9 - <rustc_middle[a96ac5d591578447]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>
44: 0x7f67210c8498 - rustc_span[f8bdfaef83e46314]::with_source_map::<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_interface[6bf42eb308c32713]::interface::run_compiler<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
45: 0x7f67210bf70c - std[e52d7c968ed01318]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6bf42eb308c32713]::util::run_in_thread_pool_with_globals<rustc_interface[6bf42eb308c32713]::interface::run_compiler<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}>::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>
46: 0x7f67210bf13a - <<std[e52d7c968ed01318]::thread::Builder>::spawn_unchecked_<rustc_interface[6bf42eb308c32713]::util::run_in_thread_pool_with_globals<rustc_interface[6bf42eb308c32713]::interface::run_compiler<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}>::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>::{closure#1} as core[125d846441ac421f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
47: 0x7f671eb73793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc0a50816e1eb2bba
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/alloc/src/boxed.rs:1988:9
48: 0x7f671eb73793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb2f83fc2049033c3
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/alloc/src/boxed.rs:1988:9
49: 0x7f671eb73793 - std::sys::unix::thread::Thread::new::thread_start::hce5861512f8bf7ea
at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys/unix/thread.rs:108:17
50: 0x7f671e905bb5 - <unknown>
51: 0x7f671e987d90 - <unknown>
52: 0x0 - <unknown>
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.70.0-nightly (7b4f48927 2023-03-12) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0261, E0637, E0658.
For more information about an error, try `rustc --explain E0261`.
searched nightlies: from nightly-2023-01-01 to nightly-2023-03-11
regressed nightly: nightly-2023-03-09
searched commit range: e3dfeea...900c354
regressed commit: 7c306f6
bisected with cargo-bisect-rustc v0.6.4
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --access github --timeout 30 --start 2023-01-01 --end 2023-03-11 --regress ice
This is "due" to 7c306f6, but probably ReError
needs to be passed through silently in the canonicalization code.
reduced via treereduce
trait Lt<'_> {
type T = ();
}
impl<> Lt<> () {}
fn main() {
let v:<() as Lt<>>::T = ();
}
reduced via treereduce
I'd argue that repro is worse than the one provided at the top of the issue, even if it's a few bytes shorter. It introduces a bit of superfluous syntax/unnecessary syntax errors.
Here's a denser minimization that avoids the syntax errors (except for the one that actually is the root-cause of the issue):
trait Lt<'a> {
type T;
}
impl Lt<'missing> for () {
// ^^^^^^^^
type T = ();
}
fn main() {
let v:<() as Lt>::T = ();
}
haha, the original snipped looked like this
#![feature(unboxed_closures)]
trait Lt<'_> {
type T = ();
}
impl<'f> Lt<'unboxed_closures> for () {
type T = ();
}
fn main() {
let v:<() as Lt<'_>>::T = ();
}
but I though it looked a little too weird :)
I'd argue that repro is worse than the one provided at the top of the issue, even if it's a few bytes shorter. It introduces a bit of superfluous syntax/unnecessary syntax errors.
Sorry for the off-topic comment: In response to this feedback I made a wrapper for treereduce that avoids introducing unrelated issues. It also runs rustfmt
for you (when it doesn't remove the ICE), and can output a nice Markdown comment with the reduced program. https://github.com/langston-barrett/icemelter