rust-lang / rust

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

Rustc panics with unwrap on Result on Err value: PlaceBuilder {...} #94882

Closed Lol3rrr closed 8 months ago

Lol3rrr commented 2 years ago

Code

<code>

The Code currently only exists on my custom OS Project, which is rather large and I will try to produce a smaller example in the coming Days, but in the mean time the full code can be found in this repo.

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (335ffbfa5 2022-03-11)
binary: rustc
commit-hash: 335ffbfa547df94ac236f5c56130cecf99c8d82b
commit-date: 2022-03-11
host: aarch64-apple-darwin
release: 1.61.0-nightly
LLVM version: 14.0.0

Error output

<output>

Im not exactly sure what the difference between the Error and the Backtrace is in this Case, because it just panics on a Thread, can update if more information is needed

Backtrace

``` thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: PlaceBuilder { base: Upvar { var_hir_id: HirId { owner: DefId(0:192 ~ rucoonos[e72e]::kernel::{impl#0}::get_rsdt_entries), local_id: 27 }, closure_def_id: DefId(0:194 ~ rucoonos[e72e]::kernel::{impl#0}::get_rsdt_entries::{closure#0}), closure_kind: FnMut }, projection: [Deref] }', compiler/rustc_mir_build/src/build/expr/as_place.rs:303:69 stack backtrace: 0: 0x102ac66c8 - ::fmt::h0e3b7b62ff438a87 1: 0x102b15cc4 - core::fmt::write::h861c00eee0917184 2: 0x102ab9950 - std::io::Write::write_fmt::hac803542aea73937 3: 0x102ac9488 - std::panicking::default_hook::{{closure}}::had1c822168f7b455 4: 0x102ac9164 - ___umodti3 5: 0x109c27b3c - rustc_driver[cec1b2f1f471d767]::DEFAULT_HOOK::{closure#0}::{closure#0} 6: 0x102ac9b64 - std::panicking::rust_panic_with_hook::h51234b973c0ae8b6 7: 0x102ac99bc - std::panicking::begin_panic_handler::{{closure}}::hcbae14a9f156eca5 8: 0x102ac6ba4 - std::sys_common::backtrace::__rust_end_short_backtrace::h8459f32d2895cbb8 9: 0x102ac9714 - _rust_begin_unwind 10: 0x102b44078 - core::panicking::panic_fmt::h78e9e8c98c0a1a5b 11: 0x102b4411c - core::result::unwrap_failed::he742f0b52386971c 12: 0x10c496b80 - ::into_place 13: 0x10c470118 - ::as_read_only_place 14: 0x10c4752cc - ::expr_into_dest 15: 0x10c474430 - ::as_temp_inner 16: 0x10c46f80c - ::as_operand 17: 0x10c46febc - ::as_call_operand 18: 0x10c49b2bc - > as core[f207860729abbb87]::iter::traits::iterator::Iterator>::fold::<(), core[f207860729abbb87]::iter::adapters::map::map_fold::expr_into_dest::{closure#3}, core[f207860729abbb87]::iter::traits::iterator::Iterator::for_each::call as alloc[5ac291e32a014fd7]::vec::spec_extend::SpecExtend>, ::expr_into_dest::{closure#3}>>>::spec_extend::{closure#0}>::{closure#0}>::{closure#0}> 19: 0x10c4b5ff8 - as alloc[5ac291e32a014fd7]::vec::spec_from_iter::SpecFromIter>, ::expr_into_dest::{closure#3}>>>::from_iter 20: 0x10c474e24 - ::expr_into_dest 21: 0x10c483ec4 - ::in_scope::<::expr_into_dest::{closure#0}::{closure#0}, ()> 22: 0x10c4751d4 - ::expr_into_dest 23: 0x10c46eaf4 - ::ast_block_stmts 24: 0x10c4836a4 - ::in_scope::<::ast_block::{closure#2}::{closure#0}, ()> 25: 0x10c475f64 - ::expr_into_dest 26: 0x10c483ec4 - ::in_scope::<::expr_into_dest::{closure#0}::{closure#0}, ()> 27: 0x10c4751d4 - ::expr_into_dest 28: 0x10c483ec4 - ::in_scope::<::expr_into_dest::{closure#0}::{closure#0}, ()> 29: 0x10c4751d4 - ::expr_into_dest 30: 0x10c46bed4 - rustc_mir_build[b37d5e05ae945448]::build::construct_fn::, core[f207860729abbb87]::iter::adapters::map::Map>, rustc_mir_build[b37d5e05ae945448]::build::mir_build::{closure#1}::{closure#0}>>> 31: 0x10c4cd2f0 - ::enter:: 32: 0x10c46a8fc - rustc_mir_build[b37d5e05ae945448]::build::mir_built 33: 0x10caefe4c - ::with_deps::<>::with_task_impl, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>::{closure#0}, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal> 34: 0x10cb5073c - >::with_task::, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal> 35: 0x10c94be84 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>> 36: 0x10ca296bc - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 37: 0x10cc2929c - ::mir_built 38: 0x10be97aa0 - rustc_mir_transform[371423e12b40b9df]::check_unsafety::unsafety_check_result 39: 0x10be945ec - >::call_once 40: 0x10cb5d658 - >::with_task:: 41: 0x10c95bfd4 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::> 42: 0x10ca03d88 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 43: 0x10be962ac - ::visit_rvalue 44: 0x10be97ba4 - rustc_mir_transform[371423e12b40b9df]::check_unsafety::unsafety_check_result 45: 0x10be945ec - >::call_once 46: 0x10cb5d658 - >::with_task:: 47: 0x10c95bfd4 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::> 48: 0x10ca03d88 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 49: 0x10be9e824 - rustc_mir_transform[371423e12b40b9df]::mir_const 50: 0x10caefe4c - ::with_deps::<>::with_task_impl, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>::{closure#0}, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal> 51: 0x10cb5073c - >::with_task::, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal> 52: 0x10c94be84 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>> 53: 0x10ca29828 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 54: 0x10cc292d8 - ::mir_const 55: 0x10be9f0b4 - rustc_mir_transform[371423e12b40b9df]::mir_promoted 56: 0x10caeff20 - ::with_deps::<>::with_task_impl, (&rustc_data_structures[c8bf790fc1a513cb]::steal::Steal, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>)>::{closure#0}, (&rustc_data_structures[c8bf790fc1a513cb]::steal::Steal, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>)> 57: 0x10cb50b3c - >::with_task::, (&rustc_data_structures[c8bf790fc1a513cb]::steal::Steal, &rustc_data_structures[c8bf790fc1a513cb]::steal::Steal>)> 58: 0x10c9e9e14 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 59: 0x10cc29428 - ::mir_promoted 60: 0x10c5fa7f0 - rustc_borrowck[d1378c39f644c876]::mir_borrowck 61: 0x10c5de3b0 - >::call_once 62: 0x10cb5d208 - >::with_task:: 63: 0x10c95b31c - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::> 64: 0x10c9e949c - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 65: 0x10c18b958 - rustc_typeck[af8f2b698ab9d9c3]::collect::type_of::type_of 66: 0x10cb649d8 - >::with_task:: 67: 0x10c973078 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::> 68: 0x10ca27730 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 69: 0x10c1dc6c4 - rustc_typeck[af8f2b698ab9d9c3]::check::check::check_item_type 70: 0x10c155160 - ::visit_item_likes_in_module:: 71: 0x10c1e07fc - rustc_typeck[af8f2b698ab9d9c3]::check::check::check_mod_item_types 72: 0x10cb5df00 - >::with_task:: 73: 0x10c95d91c - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::> 74: 0x10c9fe294 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 75: 0x10c153b48 - ::for_each_module:: 76: 0x10c0d5490 - ::time::<(), rustc_typeck[af8f2b698ab9d9c3]::check_crate::{closure#6}> 77: 0x10c0d4ff8 - rustc_typeck[af8f2b698ab9d9c3]::check_crate 78: 0x109d10998 - rustc_interface[9ef54a0254148c6e]::passes::analysis 79: 0x10cb7ca18 - >::with_task::> 80: 0x10c99181c - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::try_execute_query::>> 81: 0x10ca27878 - rustc_query_system[7c0f1b07d3feb58e]::query::plumbing::get_query:: 82: 0x109c14188 - ::enter::> 83: 0x109bc5fc0 - ::enter::, rustc_errors[50a1034c68026d26]::ErrorGuaranteed>> 84: 0x109be3c80 - rustc_span[b0496855f7b53c19]::with_source_map::, rustc_interface[9ef54a0254148c6e]::interface::create_compiler_and_run, rustc_driver[cec1b2f1f471d767]::run_compiler::{closure#1}>::{closure#1}> 85: 0x109bc7944 - rustc_interface[9ef54a0254148c6e]::interface::create_compiler_and_run::, rustc_driver[cec1b2f1f471d767]::run_compiler::{closure#1}> 86: 0x109bbf914 - >::set::, rustc_driver[cec1b2f1f471d767]::run_compiler::{closure#1}>::{closure#0}, core[f207860729abbb87]::result::Result<(), rustc_errors[50a1034c68026d26]::ErrorGuaranteed>> 87: 0x109bbc58c - std[2e288d1f06d78e3c]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[cec1b2f1f471d767]::run_compiler::{closure#1}>::{closure#0}, core[f207860729abbb87]::result::Result<(), rustc_errors[50a1034c68026d26]::ErrorGuaranteed>>::{closure#0}, core[f207860729abbb87]::result::Result<(), rustc_errors[50a1034c68026d26]::ErrorGuaranteed>> 88: 0x109bea14c - <::spawn_unchecked_, rustc_driver[cec1b2f1f471d767]::run_compiler::{closure#1}>::{closure#0}, core[f207860729abbb87]::result::Result<(), rustc_errors[50a1034c68026d26]::ErrorGuaranteed>>::{closure#0}, core[f207860729abbb87]::result::Result<(), rustc_errors[50a1034c68026d26]::ErrorGuaranteed>>::{closure#1} as core[f207860729abbb87]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 89: 0x102ad27c8 - std::sys::unix::thread::Thread::new::thread_start::h31aa346fa54e82a3 90: 0x1b8d25240 - __pthread_deallocate 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.61.0-nightly (335ffbfa5 2022-03-11) running on aarch64-apple-darwin note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental -Z unstable-options note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [mir_built] building MIR for `kernel::::get_rsdt_entries::{closure#0}` #1 [unsafety_check_result] unsafety-checking `kernel::::get_rsdt_entries::{closure#0}` #2 [unsafety_check_result] unsafety-checking `kernel::::get_rsdt_entries` #3 [mir_const] processing MIR for `kernel::::get_rsdt_entries` #4 [mir_promoted] processing `kernel::::get_rsdt_entries` #5 [mir_borrowck] borrow-checking `kernel::::get_rsdt_entries` #6 [type_of] computing type of `kernel::::get_rsdt_entries::{opaque#0}` #7 [check_mod_item_types] checking item types in module `kernel` #8 [analysis] running analysis passes on this crate end of query stack ```

Enselic commented 8 months ago

Triage: A minimal reproducer is needed to make progress here. Feel free to re-open after providing one. Closing for now.