Closed matthiaskrgr closed 1 year ago
Regression in nightly-2022-03-31, perhaps from #94081 (CC @oli-obk)
That's weird, this showed up in my nightly ice gathering as something new (from yesterday to today) but I guess the ICE just changed?
with Beta, I get error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:172:25: Unexpected type Opaque(DefId(0:34 ~ issue_96572_unconstrained[e303]::upvar::T::{opaque#0}), []) for
Fieldprojection
with nightly I get error: internal compiler error: compiler/rustc_mir_build/src/build/expr/as_place.rs:438:18: couldn't create field type, unexpected base type: upvar::T
Indeed, the ICE changed in nightly-2022-12-17 due to #103880
Update backtrace:
```
error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:172:25: Unexpected type Alias(Opaque, AliasTy { substs: [], def_id: DefId(0:13 ~ c[e654]::upvar::T::{opaque#0}) }) for `Field` projection
--> c.rs:13:27
|
13 | let Foo((a, b)) = foo;
| ^^^
thread 'rustc' panicked at 'Box
This is because precise captures (the x
field of foo.x
instead of foo
in || foo.x.thing()
) only exists in the 2021 edition. We need to start registering OpaqueCast projections in HIR, too it seems.
Code
src/test/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
Meta
rustc --version --verbose
:Error output
rustc issue-96572-unconstrained.rs --edition=2021
Backtrace
``` error: internal compiler error: compiler/rustc_mir_build/src/build/expr/as_place.rs:438:18: couldn't create field type, unexpected base type: upvar::T thread 'rustc' panicked at 'Box', /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/compiler/rustc_errors/src/lib.rs:1576:9
stack backtrace:
0: 0x7fb515e3ec5a - std::backtrace_rs::backtrace::libunwind::trace::h2607aefc39696f6a
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7fb515e3ec5a - std::backtrace_rs::backtrace::trace_unsynchronized::hc144a75d57c2c7b3
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fb515e3ec5a - std::sys_common::backtrace::_print_fmt::h342ddc14684da589
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7fb515e3ec5a - ::fmt::hdc98134100963a2f
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fb511dc836e - core::fmt::write::h2470da262daef57b
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/core/src/fmt/mod.rs:1208:17
5: 0x7fb515e32e35 - std::io::Write::write_fmt::hbb84f5c56a9ffd7e
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/io/mod.rs:1682:15
6: 0x7fb515e3ea25 - std::sys_common::backtrace::_print::h09788334315e2227
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/sys_common/backtrace.rs:47:5
7: 0x7fb515e3ea25 - std::sys_common::backtrace::print::h91b882168c879aff
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/sys_common/backtrace.rs:34:9
8: 0x7fb515e40daf - std::panicking::default_hook::{{closure}}::h8265382c0fcd6c24
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/panicking.rs:267:22
9: 0x7fb515e40aeb - std::panicking::default_hook::hce97146ae255ffa1
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/panicking.rs:286:9
10: 0x7fb515066bd1 - >::call_once::{shim:vtable#0}
11: 0x7fb515e415ad - as core::ops::function::Fn>::call::hefea13a236451b00
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/alloc/src/boxed.rs:2032:9
12: 0x7fb515e415ad - std::panicking::rust_panic_with_hook::haad14347c6e2995e
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/panicking.rs:692:13
13: 0x7fb51550c6b1 - std[ffc5064dcb802758]::panicking::begin_panic::::{closure#0}
14: 0x7fb51550bf26 - std[ffc5064dcb802758]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
15: 0x7fb515568bf6 - std[ffc5064dcb802758]::panicking::begin_panic::
16: 0x7fb51550bd66 - std[ffc5064dcb802758]::panic::panic_any::
17: 0x7fb515509336 - ::bug::<&alloc[34db83fb13497f51]::string::String>
18: 0x7fb515508fa0 - ::bug::<&alloc[34db83fb13497f51]::string::String>
19: 0x7fb5155d0a9e - rustc_middle[4e38d5d2b9306e4d]::ty::context::tls::with_context_opt::::{closure#0}, ()>::{closure#0}, ()>
20: 0x7fb5155d0d66 - rustc_middle[4e38d5d2b9306e4d]::util::bug::opt_span_bug_fmt::
21: 0x7fb513314f33 - rustc_middle[4e38d5d2b9306e4d]::util::bug::bug_fmt
22: 0x7fb513528e5d - ::field
23: 0x7fb5135246e2 - ::expr_as_place
24: 0x7fb513524663 - ::expr_as_place
25: 0x7fb513530a78 - > as core[bbfcb7d5d352d6d8]::iter::traits::iterator::Iterator>::fold::<(), core[bbfcb7d5d352d6d8]::iter::adapters::map::map_fold::as_rvalue::{closure#4}, core[bbfcb7d5d352d6d8]::iter::traits::iterator::Iterator::for_each::call>::extend_trusted>, ::as_rvalue::{closure#4}>>::{closure#0}>::{closure#0}>::{closure#0}>
26: 0x7fb51352ffab - as alloc[34db83fb13497f51]::vec::spec_from_iter::SpecFromIter>, ::as_rvalue::{closure#4}>>>::from_iter
27: 0x7fb51350638a - ::as_rvalue
28: 0x7fb513514b04 - ::expr_into_dest
29: 0x7fb5135149dc - ::expr_into_dest
30: 0x7fb513535a8c - ::ast_block_stmts
31: 0x7fb51352ec88 - ::ast_block
32: 0x7fb513515898 - ::expr_into_dest
33: 0x7fb5135149dc - ::expr_into_dest
34: 0x7fb5135149dc - ::expr_into_dest
35: 0x7fb5140cfa47 - rustc_mir_build[734256960e97beec]::build::mir_built
36: 0x7fb5139cea3a - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::, &rustc_data_structures[53fd8e05c19798dc]::steal::Steal>>
37: 0x7fb5139da82a - rustc_mir_transform[94f81ae76961faa1]::check_unsafety::unsafety_check_result
38: 0x7fb5139d4866 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::>
39: 0x7fb5139d11f4 - rustc_mir_transform[94f81ae76961faa1]::mir_const
40: 0x7fb5139ced70 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::, &rustc_data_structures[53fd8e05c19798dc]::steal::Steal>>
41: 0x7fb513d9dc54 - rustc_mir_transform[94f81ae76961faa1]::mir_promoted
42: 0x7fb513d9c1fa - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::, (&rustc_data_structures[53fd8e05c19798dc]::steal::Steal, &rustc_data_structures[53fd8e05c19798dc]::steal::Steal>)>>
43: 0x7fb513d9aa4f - rustc_borrowck[533f25d0079c6f0f]::mir_borrowck
44: 0x7fb51402c92e - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::>
45: 0x7fb514a1839a - ::mir_borrowck
46: 0x7fb515191d77 - ::check
47: 0x7fb515191666 - rustc_hir_analysis[ae59112018bd4566]::collect::type_of::find_opaque_ty_constraints_for_tait
48: 0x7fb51486c75f - rustc_hir_analysis[ae59112018bd4566]::collect::type_of::type_of
49: 0x7fb51391aad7 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::get_query::
50: 0x7fb5141a8c19 - rustc_hir_analysis[ae59112018bd4566]::check::check::check_mod_item_types
51: 0x7fb513bd2b31 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::>
52: 0x7fb514457033 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::get_query::
53: 0x7fb5146fa555 - ::for_each_module::
54: 0x7fb5135d2752 - rustc_hir_analysis[ae59112018bd4566]::check_crate
55: 0x7fb5135d239b - rustc_interface[50801890e46a75d8]::passes::analysis
56: 0x7fb51482a9c7 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::try_execute_query::>>
57: 0x7fb51482a6c0 - rustc_query_system[f6b5e3aef1ad0eab]::query::plumbing::get_query::
58: 0x7fb5142f7193 - ::enter::>
59: 0x7fb5142f3543 - ::enter::, rustc_errors[a1afcc29edf9f643]::ErrorGuaranteed>>
60: 0x7fb5142ee558 - rustc_span[5fbaba9c6a6126d5]::with_source_map::, rustc_interface[50801890e46a75d8]::interface::run_compiler, rustc_driver[9ceb0128d4545407]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
61: 0x7fb5142ee045 - >::set::, rustc_driver[9ceb0128d4545407]::run_compiler::{closure#1}>::{closure#0}, core[bbfcb7d5d352d6d8]::result::Result<(), rustc_errors[a1afcc29edf9f643]::ErrorGuaranteed>>
62: 0x7fb5142ed632 - std[ffc5064dcb802758]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[9ceb0128d4545407]::run_compiler::{closure#1}>::{closure#0}, core[bbfcb7d5d352d6d8]::result::Result<(), rustc_errors[a1afcc29edf9f643]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bbfcb7d5d352d6d8]::result::Result<(), rustc_errors[a1afcc29edf9f643]::ErrorGuaranteed>>
63: 0x7fb51492829e - <::spawn_unchecked_, rustc_driver[9ceb0128d4545407]::run_compiler::{closure#1}>::{closure#0}, core[bbfcb7d5d352d6d8]::result::Result<(), rustc_errors[a1afcc29edf9f643]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bbfcb7d5d352d6d8]::result::Result<(), rustc_errors[a1afcc29edf9f643]::ErrorGuaranteed>>::{closure#1} as core[bbfcb7d5d352d6d8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
64: 0x7fb515e48823 - as core::ops::function::FnOnce>::call_once::h67a3660415c1c402
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/alloc/src/boxed.rs:2000:9
65: 0x7fb515e48823 - as core::ops::function::FnOnce>::call_once::he60abfaa26b4de0c
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/alloc/src/boxed.rs:2000:9
66: 0x7fb515e48823 - std::sys::unix::thread::Thread::new::thread_start::hd33ece6941cc9dcc
at /rustc/74699b82cac980b9fb423a4ec2f131209b6a7630/library/std/src/sys/unix/thread.rs:108:17
67: 0x7fb511b058fd -
68: 0x7fb511b87a60 -
69: 0x0 -
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.68.0-nightly (74699b82c 2022-12-17) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_built] building MIR for `upvar`
#1 [unsafety_check_result] unsafety-checking `upvar`
#2 [mir_const] preparing `upvar` for borrow checking
#3 [mir_promoted] processing MIR for `upvar`
#4 [mir_borrowck] borrow-checking `upvar`
#5 [type_of] computing type of `upvar::T::{opaque#0}`
#6 [check_mod_item_types] checking item types in top-level module
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
```