rust-lang / rust

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

Compiler error after struct move #114540

Open Fesaa opened 1 year ago

Fesaa commented 1 year ago

Code

I'm pretty new to Rust, so will take me a while before I am through the "Rust Bug Minimization Patterns" article, the error happened after I moved a struct around. I've made it a singular commit in my project; https://github.com/Fesaa/CubepanionAPI/commit/7d742fbd6d866431280cdea1ba4f0e2a9eec197d

I'll try and make it smaller, but I don't know when. And thought it'd be better if I had something to start with instead of no report.

todo

Meta

rustc --version --verbose:

rustc 1.70.0 (90c541806 2023-05-31) (built from a source tarball)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: aarch64-apple-darwin
release: 1.70.0
LLVM version: 16.0.2

Error output

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: {OpaqueTypeKey { def_id: DefId(0:1475 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard::{opaque#0}), substs: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/leaderboard_api/routes/game.rs:6:71: 6:85 (#705), ty: _ }, origin: AsyncFn(DefId(0:130 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard)) }, OpaqueTypeKey { def_id: DefId(0:1476 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard::{opaque#0}::{opaque#0}), substs: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/leaderboard_api/routes/game.rs:6:86: 16:2 (#0), ty: _ }, origin: FnReturn(DefId(0:130 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard)) }}
Backtrace

``` ameliah➜~/GitHub/leaderboard_api(master)» RUST_BACKTRACE=1 cargo build [14:03:46] Compiling cubepanion_api v0.1.0 (/Users/ameliah/GitHub/leaderboard_api) thread 'rustc' panicked at 'Failed to extract DefId: opt_local_def_id_to_hir_id 6d2a6efd4a854d58-d12b435744edee4d', compiler/rustc_middle/src/dep_graph/dep_node.rs:181:17 stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2: as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0} 3: ::def_path_hash_to_def_id 4: as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id 5: ::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode)>>::call_once 6: >::try_mark_previous_green:: 7: >::try_mark_previous_green:: 8: >::try_mark_previous_green:: 9: >::try_mark_previous_green:: 10: >::try_mark_previous_green:: 11: >::try_mark_previous_green:: 12: >::try_mark_previous_green:: 13: >::try_mark_previous_green:: 14: >::try_mark_previous_green:: 15: >::try_mark_previous_green:: 16: >>::with::::{closure#1}, core::option::Option<(rustc_middle::query::erase::Erased<[u8; 2]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>>::{closure#0}, core::option::Option<(rustc_middle::query::erase::Erased<[u8; 2]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>> 17: rustc_query_system::query::plumbing::try_execute_query:: 18: ::evaluate_obligation 19: ::evaluate_obligation 20: ::evaluate_obligation_no_overflow 21: ::process_trait_obligation 22: ::process_obligation 23: >::process_obligations:: 24: ::select_where_possible 25: ::check_argument_types 26: ::confirm_builtin_call 27: ::check_call 28: ::check_expr_kind 29: ::check_expr_with_expectation_and_args 30: ::check_match::{closure#0} 31: ::check_expr_kind 32: ::check_expr_with_expectation_and_args 33: ::check_match::{closure#0} 34: ::check_expr_kind 35: ::check_expr_with_expectation_and_args 36: ::check_block_with_expected 37: ::check_expr_kind 38: ::check_expr_with_expectation_and_args 39: ::check_expr_kind 40: ::check_expr_with_expectation_and_args 41: ::check_block_with_expected 42: ::check_expr_kind 43: ::check_expr_with_expectation_and_args 44: ::check_return_expr 45: rustc_hir_typeck::check::check_fn 46: ::check_expr_closure 47: ::check_expr_kind 48: ::check_expr_with_expectation_and_args 49: ::check_return_expr 50: rustc_hir_typeck::check::check_fn 51: rustc_hir_typeck::typeck 52: >>::with::::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)> 53: rustc_query_system::query::plumbing::try_execute_query:: 54: rustc_query_system::query::plumbing::force_query:: 55: ::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode)>>::call_once 56: >::try_mark_previous_green:: 57: >::try_mark_previous_green:: 58: >::try_mark_previous_green:: 59: >::try_mark_previous_green:: 60: >::try_mark_previous_green:: 61: >::try_mark_previous_green:: 62: >::try_mark_previous_green:: 63: >::try_mark_previous_green:: 64: >::try_mark_previous_green:: 65: >::try_mark_green:: 66: rustc_query_system::query::plumbing::ensure_must_run:: 67: ::check_mod_item_types 68: ::time::<(), rustc_hir_analysis::check_crate::{closure#6}> 69: rustc_hir_analysis::check_crate 70: rustc_interface::passes::analysis 71: >>::with::::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex)> 72: rustc_query_system::query::plumbing::try_execute_query:: 73: ::analysis 74: >::enter::, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}> 75: ::enter::, rustc_span::ErrorGuaranteed>> 76: rustc_span::set_source_map::, rustc_interface::interface::run_compiler, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}> note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: 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.70.0 (90c541806 2023-05-31) (built from a source tarball) running on aarch64-apple-darwin note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED] note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [evaluate_obligation] evaluating trait selection obligation `actix::address::channel::AddressSender: actix::address::channel::Sender` #1 [typeck] type-checking `leaderboard_api::routes::game::::register::get_leaderboard` #2 [analysis] running analysis passes on this crate end of query stack there was a panic while trying to force a dep node try_mark_green dep node stack: #0 opt_def_kind(thread 'rustc' panicked at 'Failed to extract DefId: opt_def_kind 6d2a6efd4a854d58-d12b435744edee4d', compiler/rustc_middle/src/dep_graph/dep_node.rs:181:17 stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2: as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0} 3: ::def_path_hash_to_def_id 4: ::debug_node 5: core::fmt::write 6: <&std::io::stdio::Stderr as std::io::Write>::write_fmt 7: std::io::stdio::_eprint 8: rustc_query_system::dep_graph::graph::print_markframe_trace:: 9: >::try_mark_previous_green:: 10: >::try_mark_previous_green:: 11: >::try_mark_previous_green:: 12: >::try_mark_previous_green:: 13: >::try_mark_previous_green:: 14: >::try_mark_previous_green:: 15: >::try_mark_previous_green:: 16: >::try_mark_previous_green:: 17: >::try_mark_previous_green:: 18: >::try_mark_previous_green:: 19: >>::with::::{closure#1}, core::option::Option<(rustc_middle::query::erase::Erased<[u8; 2]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>>::{closure#0}, core::option::Option<(rustc_middle::query::erase::Erased<[u8; 2]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>> 20: rustc_query_system::query::plumbing::try_execute_query:: 21: ::evaluate_obligation 22: ::evaluate_obligation 23: ::evaluate_obligation_no_overflow 24: ::process_trait_obligation 25: ::process_obligation 26: >::process_obligations:: 27: ::select_where_possible 28: ::check_argument_types 29: ::confirm_builtin_call 30: ::check_call 31: ::check_expr_kind 32: ::check_expr_with_expectation_and_args 33: ::check_match::{closure#0} 34: ::check_expr_kind 35: ::check_expr_with_expectation_and_args 36: ::check_match::{closure#0} 37: ::check_expr_kind 38: ::check_expr_with_expectation_and_args 39: ::check_block_with_expected 40: ::check_expr_kind 41: ::check_expr_with_expectation_and_args 42: ::check_expr_kind 43: ::check_expr_with_expectation_and_args 44: ::check_block_with_expected 45: ::check_expr_kind 46: ::check_expr_with_expectation_and_args 47: ::check_return_expr 48: rustc_hir_typeck::check::check_fn 49: ::check_expr_closure 50: ::check_expr_kind 51: ::check_expr_with_expectation_and_args 52: ::check_return_expr 53: rustc_hir_typeck::check::check_fn 54: rustc_hir_typeck::typeck 55: >>::with::::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)> 56: rustc_query_system::query::plumbing::try_execute_query:: 57: rustc_query_system::query::plumbing::force_query:: 58: ::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode)>>::call_once 59: >::try_mark_previous_green:: 60: >::try_mark_previous_green:: 61: >::try_mark_previous_green:: 62: >::try_mark_previous_green:: 63: >::try_mark_previous_green:: 64: >::try_mark_previous_green:: 65: >::try_mark_previous_green:: 66: >::try_mark_previous_green:: 67: >::try_mark_previous_green:: 68: >::try_mark_green:: 69: rustc_query_system::query::plumbing::ensure_must_run:: 70: ::check_mod_item_types 71: ::time::<(), rustc_hir_analysis::check_crate::{closure#6}> 72: rustc_hir_analysis::check_crate 73: rustc_interface::passes::analysis 74: >>::with::::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex)> 75: rustc_query_system::query::plumbing::try_execute_query:: 76: ::analysis 77: >::enter::, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}> 78: ::enter::, rustc_span::ErrorGuaranteed>> 79: rustc_span::set_source_map::, rustc_interface::interface::run_compiler, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}> note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: 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.70.0 (90c541806 2023-05-31) (built from a source tarball) running on aarch64-apple-darwin note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED] note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [evaluate_obligation] evaluating trait selection obligation `actix::address::channel::AddressSender: actix::address::channel::Sender` #1 [typeck] type-checking `leaderboard_api::routes::game::::register::get_leaderboard` #2 [analysis] running analysis passes on this crate end of query stack there was a panic while trying to force a dep node try_mark_green dep node stack: #0 thir_body(872adbf97e4171-b2d54e392c34dddf) #1 check_match(cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard) #2 mir_built(872adbf97e4171-b2d54e392c34dddf) #3 unsafety_check_result(cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard) #4 mir_const(872adbf97e4171-b2d54e392c34dddf) #5 mir_promoted(872adbf97e4171-b2d54e392c34dddf) #6 mir_borrowck(cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard) #7 type_of(cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard::{opaque#0}) #8 check_mod_item_types(cubepanion_api[6d2a]::leaderboard_api::routes::game) end of try_mark_green dep node stack error: internal compiler error: no errors encountered even though `delay_span_bug` issued error: internal compiler error: {OpaqueTypeKey { def_id: DefId(0:1475 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard::{opaque#0}), substs: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/leaderboard_api/routes/game.rs:6:71: 6:85 (#705), ty: _ }, origin: AsyncFn(DefId(0:130 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard)) }, OpaqueTypeKey { def_id: DefId(0:1476 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard::{opaque#0}::{opaque#0}), substs: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/leaderboard_api/routes/game.rs:6:86: 16:2 (#0), ty: _ }, origin: FnReturn(DefId(0:130 ~ cubepanion_api[6d2a]::leaderboard_api::routes::game::{impl#0}::register::get_leaderboard)) }} | = note: delayed at 0: std::backtrace::Backtrace::create 1: ::emit_diagnostic 2: ::delay_span_bug:: 3: ::drop 4: core::ptr::drop_in_place:: 5: rustc_hir_typeck::typeck 6: >>::with::::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)> 7: rustc_query_system::query::plumbing::try_execute_query:: 8: rustc_query_system::query::plumbing::force_query:: 9: ::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode)>>::call_once 10: >::try_mark_previous_green:: 11: >::try_mark_previous_green:: 12: >::try_mark_previous_green:: 13: >::try_mark_previous_green:: 14: >::try_mark_previous_green:: 15: >::try_mark_previous_green:: 16: >::try_mark_previous_green:: 17: >::try_mark_previous_green:: 18: >::try_mark_previous_green:: 19: >::try_mark_green:: 20: rustc_query_system::query::plumbing::ensure_must_run:: 21: ::check_mod_item_types 22: ::time::<(), rustc_hir_analysis::check_crate::{closure#6}> 23: rustc_hir_analysis::check_crate 24: rustc_interface::passes::analysis 25: >>::with::::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex)> 26: rustc_query_system::query::plumbing::try_execute_query:: 27: ::analysis 28: >::enter::, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}> 29: ::enter::, rustc_span::ErrorGuaranteed>> 30: rustc_span::set_source_map::, rustc_interface::interface::run_compiler, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 31: std::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>> 32: <::spawn_unchecked_, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 33: std::sys::unix::thread::Thread::new::thread_start 34: __pthread_joiner_wake 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 (90c541806 2023-05-31) (built from a source tarball) running on aarch64-apple-darwin note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED] note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack thread panicked while panicking. aborting. error: could not compile `cubepanion_api` (bin "cubepanion_api") Caused by: process didn't exit successfully: `rustc --crate-name cubepanion_api --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=202 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=4ac8671ed5b4432e -C extra-filename=-4ac8671ed5b4432e --out-dir /Users/ameliah/GitHub/leaderboard_api/target/debug/deps -C incremental=/Users/ameliah/GitHub/leaderboard_api/target/debug/incremental -L dependency=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps --extern actix=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libactix-d2d824103586fcf4.rlib --extern actix_extensible_rate_limit=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libactix_extensible_rate_limit-75f868a6bdf7848b.rlib --extern actix_web=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libactix_web-a3d67834d4eeb64c.rlib --extern diesel=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libdiesel-ab39ed3a32de7556.rlib --extern regex=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libregex-854aba79ef1b05c7.rlib --extern serde=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libserde-53e3be529ba81295.rlib --extern toml=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libtoml-a64d0305e9118d2e.rlib --extern uuid=/Users/ameliah/GitHub/leaderboard_api/target/debug/deps/libuuid-f1f792f5962bfbe6.rlib -L native=/Users/ameliah/GitHub/leaderboard_api/target/debug/build/zstd-sys-bdf4a29673482a1e/out -L native=/opt/homebrew/opt/libpq/lib` (signal: 6, SIGABRT: process abort signal) ```

chenyukang commented 1 year ago

did cargo clean resolve the panic?

Fesaa commented 1 year ago

Yes, appears so