rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.58k stars 12.74k forks source link

ICE: `Unexpected type Alias(...) for 'Field' projection `, edition 2021 #105819

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

Code

src/test/ui/type-alias-impl-trait/issue-96572-unconstrained.rs

#![feature(type_alias_impl_trait)]
// check-pass

fn main() {}

fn upvar() {
    #[derive(Copy, Clone)]
    struct Foo((u32, u32));

    type T = impl Copy;
    let foo: T = Foo((1u32, 2u32));
    let x = move || {
        let Foo((a, b)) = foo;
    };
}

Meta

rustc --version --verbose:

rustc 1.68.0-nightly (74699b82c 2022-12-17)
binary: rustc
commit-hash: 74699b82cac980b9fb423a4ec2f131209b6a7630
commit-date: 2022-12-17
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6

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 ```

jruderman commented 1 year ago

Regression in nightly-2022-03-31, perhaps from #94081 (CC @oli-obk)

Commits in range ``` commit[0] 2022-03-29UTC: Auto merge of #95448 - Dylan-DPC:rollup-wpj5yto, r=Dylan-DPC commit[1] 2022-03-30UTC: Auto merge of #95455 - RalfJung:miri, r=RalfJung commit[2] 2022-03-30UTC: Auto merge of #94081 - oli-obk:lazy_tait_take_two, r=nikomatsakis commit[3] 2022-03-30UTC: Auto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPC commit[4] 2022-03-30UTC: Auto merge of #95241 - Gankra:cleaned-provenance, r=workingjubilee commit[5] 2022-03-30UTC: Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se commit[6] 2022-03-30UTC: Auto merge of #95458 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright commit[7] 2022-03-30UTC: Auto merge of #95425 - nnethercote:yet-more-parse_tt-improvements, r=petrochenkov ```
matthiaskrgr commented 1 year ago

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}), []) forFieldprojection

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

jruderman commented 1 year ago

Indeed, the ICE changed in nightly-2022-12-17 due to #103880

matthiaskrgr commented 1 year ago

Update backtrace:

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', /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/compiler/rustc_errors/src/lib.rs:987:33 stack backtrace: 0: 0x7fce191653ca - std::backtrace_rs::backtrace::libunwind::trace::ha92ef9f6ccd5e56b at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7fce191653ca - std::backtrace_rs::backtrace::trace_unsynchronized::ha44c299690166f2b at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7fce191653ca - std::sys_common::backtrace::_print_fmt::h19cd3f39c344a33c at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7fce191653ca - ::fmt::h293cba156d45b475 at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7fce191c867e - core::fmt::write::h2a89c5a2cd2a0936 at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/core/src/fmt/mod.rs:1213:17 5: 0x7fce19155a15 - std::io::Write::write_fmt::h61b873d4305ed5fb at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/io/mod.rs:1682:15 6: 0x7fce19165195 - std::sys_common::backtrace::_print::he80b3ad6361d876c at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7fce19165195 - std::sys_common::backtrace::print::ha340fba9744b3a51 at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7fce19167f5f - std::panicking::default_hook::{{closure}}::hbb5472f169f46106 at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/panicking.rs:267:22 9: 0x7fce19167c9b - std::panicking::default_hook::h910b88c51274ec02 at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/panicking.rs:286:9 10: 0x7fce1c45ec54 - rustc_driver[639bbb82542a12c4]::DEFAULT_HOOK::{closure#0}::{closure#0} 11: 0x7fce1916879a - as core::ops::function::Fn>::call::hf5cbaf936ef8179d at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/alloc/src/boxed.rs:2002:9 12: 0x7fce1916879a - std::panicking::rust_panic_with_hook::h637d33e8738b38ce at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/panicking.rs:692:13 13: 0x7fce1c9c8521 - std[160d0d017ec6e0b8]::panicking::begin_panic::::{closure#0} 14: 0x7fce1c9c4fe6 - std[160d0d017ec6e0b8]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 15: 0x7fce1ca27686 - std[160d0d017ec6e0b8]::panicking::begin_panic:: 16: 0x7fce1c9e0366 - std[160d0d017ec6e0b8]::panic::panic_any:: 17: 0x7fce1c9dfd22 - ::span_bug:: 18: 0x7fce1c9ded77 - ::span_bug:: 19: 0x7fce1c9eed0b - rustc_middle[81963a276c0c8277]::util::bug::opt_span_bug_fmt::::{closure#0} 20: 0x7fce1c9ec09a - rustc_middle[81963a276c0c8277]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 21: 0x7fce1c9ec06a - rustc_middle[81963a276c0c8277]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 22: 0x7fce1c9eec46 - rustc_middle[81963a276c0c8277]::util::bug::opt_span_bug_fmt:: 23: 0x7fce1c9eec04 - rustc_middle[81963a276c0c8277]::util::bug::span_bug_fmt:: 24: 0x7fce1b97edd4 - <&mut rustc_middle[81963a276c0c8277]::ty::closure::symbols_for_closure_captures::{closure#0} as core[dd0ad632f08e6ea1]::ops::function::FnOnce<(&rustc_middle[81963a276c0c8277]::ty::closure::CapturedPlace,)>>::call_once 25: 0x7fce1b97e3ef - as alloc[3c9e883abe43a86f]::vec::spec_from_iter::SpecFromIter>, core[dd0ad632f08e6ea1]::slice::iter::Iter, ::closure_min_captures_flattened::{closure#0}::{closure#0}>>>, rustc_middle[81963a276c0c8277]::ty::closure::symbols_for_closure_captures::{closure#0}>>>::from_iter 26: 0x7fce1b97e1ec - rustc_middle[81963a276c0c8277]::ty::closure::symbols_for_closure_captures 27: 0x7fce1b9f87c7 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 28: 0x7fce1be4e6ff - ::symbols_for_closure_captures 29: 0x7fce1b5acc4f - rustc_mir_build[ff9628d6c6d389c5]::build::mir_built 30: 0x7fce1b24f415 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 31: 0x7fce1b58208d - rustc_mir_transform[137284fa802fab14]::check_unsafety::unsafety_check_result 32: 0x7fce1b39aa19 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 33: 0x7fce1be4fe44 - ::unsafety_check_result 34: 0x7fce1b584cce - rustc_mir_transform[137284fa802fab14]::check_unsafety::unsafety_check_result 35: 0x7fce1b39aa19 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 36: 0x7fce1b39735d - rustc_mir_transform[137284fa802fab14]::mir_const 37: 0x7fce1b395d61 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 38: 0x7fce1b38e1d9 - rustc_mir_transform[137284fa802fab14]::mir_promoted 39: 0x7fce1b38c6a4 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 40: 0x7fce1b38af48 - rustc_borrowck[e2111fe20b1902b8]::mir_borrowck 41: 0x7fce1ad7fd9d - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 42: 0x7fce1be512cd - ::mir_borrowck 43: 0x7fce1c57f36a - ::check 44: 0x7fce1c57ec57 - rustc_hir_analysis[dc2fdeeecccd2750]::collect::type_of::find_opaque_ty_constraints_for_tait 45: 0x7fce1bc86af9 - rustc_hir_analysis[dc2fdeeecccd2750]::collect::type_of::type_of 46: 0x7fce1ad46fd8 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::get_query:: 47: 0x7fce1b0101cb - rustc_hir_analysis[dc2fdeeecccd2750]::check::check::check_mod_item_types 48: 0x7fce1ba0a151 - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 49: 0x7fce1be5082d - ::check_mod_item_types 50: 0x7fce1aa8b097 - ::time::<(), rustc_hir_analysis[dc2fdeeecccd2750]::check_crate::{closure#6}> 51: 0x7fce1aa8a8a2 - rustc_hir_analysis[dc2fdeeecccd2750]::check_crate 52: 0x7fce1aa8a51b - rustc_interface[712fc5ea6eb72e1f]::passes::analysis 53: 0x7fce1bbc267e - rustc_query_system[485dd4ae9ee084f0]::query::plumbing::try_execute_query:: 54: 0x7fce1be4d6ba - ::analysis 55: 0x7fce1b6e4420 - ::enter::> 56: 0x7fce1b6e3221 - ::enter::, rustc_errors[ab114d7d6097e91e]::ErrorGuaranteed>> 57: 0x7fce1b6e12f4 - rustc_span[6badc9707177032f]::with_source_map::, rustc_interface[712fc5ea6eb72e1f]::interface::run_compiler, rustc_driver[639bbb82542a12c4]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 58: 0x7fce1b6e0e04 - >::set::, rustc_driver[639bbb82542a12c4]::run_compiler::{closure#1}>::{closure#0}, core[dd0ad632f08e6ea1]::result::Result<(), rustc_errors[ab114d7d6097e91e]::ErrorGuaranteed>> 59: 0x7fce1b6e0502 - std[160d0d017ec6e0b8]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[639bbb82542a12c4]::run_compiler::{closure#1}>::{closure#0}, core[dd0ad632f08e6ea1]::result::Result<(), rustc_errors[ab114d7d6097e91e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dd0ad632f08e6ea1]::result::Result<(), rustc_errors[ab114d7d6097e91e]::ErrorGuaranteed>> 60: 0x7fce1b6e02aa - <::spawn_unchecked_, rustc_driver[639bbb82542a12c4]::run_compiler::{closure#1}>::{closure#0}, core[dd0ad632f08e6ea1]::result::Result<(), rustc_errors[ab114d7d6097e91e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dd0ad632f08e6ea1]::result::Result<(), rustc_errors[ab114d7d6097e91e]::ErrorGuaranteed>>::{closure#1} as core[dd0ad632f08e6ea1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 61: 0x7fce19172bd3 - as core::ops::function::FnOnce>::call_once::h4dd19c0bc3e6367b at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/alloc/src/boxed.rs:1988:9 62: 0x7fce19172bd3 - as core::ops::function::FnOnce>::call_once::h379cba3f119da2fe at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/alloc/src/boxed.rs:1988:9 63: 0x7fce19172bd3 - std::sys::unix::thread::Thread::new::thread_start::hd739ff786112afe1 at /rustc/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/library/std/src/sys/unix/thread.rs:108:17 64: 0x7fce18f048fd - 65: 0x7fce18f86a60 - 66: 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 (5ce39f42b 2023-01-20) running on x86_64-unknown-linux-gnu query stack during panic: #0 [symbols_for_closure_captures] finding symbols for captures of closure `upvar::{closure#0}` in `upvar::{closure#0}` #1 [mir_built] building MIR for `upvar::{closure#0}` #2 [unsafety_check_result] unsafety-checking `upvar::{closure#0}` #3 [unsafety_check_result] unsafety-checking `upvar` #4 [mir_const] preparing `upvar` for borrow checking #5 [mir_promoted] processing MIR for `upvar` #6 [mir_borrowck] borrow-checking `upvar` #7 [type_of] computing type of `upvar::T::{opaque#0}` #8 [check_mod_item_types] checking item types in top-level module #9 [analysis] running analysis passes on this crate end of query stack error: aborting due to previous error ```

oli-obk commented 1 year ago

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.