Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: DefId::expect_local: DefId(20:3827 ~ picoserve[6f4f]::extract::FromRequest::from_request::{opaque#0}::'r) isn't local #120638

Closed
Ddystopia opened this issue Feb 4, 2024 · 2 comments · Fixed by #120707
Assignees
Labels
A-lifetimes Area: lifetime related C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Ddystopia
Copy link
Contributor

Ddystopia commented Feb 4, 2024

While I was trying to add lifetimes for picoserve's FromRequest I got into ICE

  1. https://github.com/Ddystopia/picoserve_example_ice
  2. https://github.com/Ddystopia/picoserve/tree/ice

(1.) had a dep of picoserve as 2.

That code isn't finished and should not compile yet

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (635124704 2024-01-27)
binary: rustc
commit-hash: 635124704849eeead4e3a7bb6e663c5351571d93
commit-date: 2024-01-27
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Error output

2.https://github.com/Ddystopia/picoserve/tree/ice has ice files

@Ddystopia Ddystopia added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 4, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 4, 2024
@Ddystopia
Copy link
Contributor Author

rustc 1.75.0 (82e1608 2023-12-21)
binary: rustc
commit-hash: 82e1608
commit-date: 2023-12-21
host: x86_64-unknown-linux-gnu
release: 1.75.0
LLVM version: 17.0.6

Here ICE is also present

@fmease
Copy link
Member

fmease commented Feb 4, 2024

Backtrace from one of the linked files pasted below for the sake of searchability and preservation:

Backtrace
thread 'rustc' panicked at compiler/rustc_middle/src/ty/context.rs:1196:53:
DefId::expect_local: `DefId(20:4150 ~ picoserve[5337]::extract::FromRequest::from_request::{opaque#0}::'r)` isn't local
stack backtrace:
   0:     0x7f911cd72aae - std::backtrace_rs::backtrace::libunwind::trace::hab3572c31eb20106
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f911cd72aae - std::backtrace_rs::backtrace::trace_unsynchronized::hcd9831b7ebc46561
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f911cd72aae - std::backtrace::Backtrace::create::h1c468a8b7345fb05
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/backtrace.rs:331:13
   3:     0x7f911cd729f0 - std::backtrace::Backtrace::force_capture::hcf64f1fadbc6c2e7
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/backtrace.rs:312:9
   4:     0x7f911fb4d403 - std[9b9743348aa3637e]::panicking::update_hook::<alloc[bafad8be7e602ddc]::boxed::Box<rustc_driver_impl[15253732b01127ee]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f911cd8e9c6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::he0826d83a3d5350a
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/alloc/src/boxed.rs:2029:9
   6:     0x7f911cd8e9c6 - std::panicking::rust_panic_with_hook::h48fa132e308b8b90
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/panicking.rs:785:13
   7:     0x7f911cd8e712 - std::panicking::begin_panic_handler::{{closure}}::h25d6c93d3d1459db
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/panicking.rs:659:13
   8:     0x7f911cd8bc06 - std::sys_common::backtrace::__rust_end_short_backtrace::h34a894d5da7b6896
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7f911cd8e464 - rust_begin_unwind
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/panicking.rs:647:5
  10:     0x7f911cdda7a5 - core::panicking::panic_fmt::he5ea86dee9f7da0f
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/core/src/panicking.rs:72:14
  11:     0x7f911ffc743d - <rustc_middle[16339a7d2af1bee1]::ty::context::TyCtxt>::is_suitable_region
  12:     0x7f911fdfc654 - <rustc_infer[807d9c5524fba0ff]::infer::error_reporting::nice_region_error::NiceRegionError>::try_report
  13:     0x7f911fdfb5d1 - <rustc_infer[807d9c5524fba0ff]::infer::error_reporting::TypeErrCtxt>::try_report_nice_region_error
  14:     0x7f911fe03f0d - <rustc_infer[807d9c5524fba0ff]::infer::error_reporting::TypeErrCtxt>::report_region_errors
  15:     0x7f9121815e15 - <rustc_trait_selection[e7284dd674d9b4a3]::traits::engine::ObligationCtxt>::resolve_regions_and_report_errors
  16:     0x7f9121269f0b - rustc_hir_analysis[479a66532c93313f]::check::check::check_impl_items_against_trait
  17:     0x7f9121803e79 - rustc_hir_analysis[479a66532c93313f]::check::wfcheck::check_well_formed
  18:     0x7f9121802df3 - rustc_query_impl[d449feea4892fbc5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d449feea4892fbc5]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[16339a7d2af1bee1]::query::erase::Erased<[u8; 1usize]>>
  19:     0x7f9121322582 - rustc_query_system[873bd36b90da509c]::query::plumbing::try_execute_query::<rustc_query_impl[d449feea4892fbc5]::DynamicConfig<rustc_query_system[873bd36b90da509c]::query::caches::VecCache<rustc_hir[7e12cea3d3789f56]::hir_id::OwnerId, rustc_middle[16339a7d2af1bee1]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d449feea4892fbc5]::plumbing::QueryCtxt, true>
  20:     0x7f9121e383c0 - <rustc_query_impl[d449feea4892fbc5]::plumbing::query_callback<rustc_query_impl[d449feea4892fbc5]::query_impl::check_well_formed::QueryType>::{closure#0} as core[2c84ace8ac8a7133]::ops::function::FnOnce<(rustc_middle[16339a7d2af1bee1]::ty::context::TyCtxt, rustc_query_system[873bd36b90da509c]::dep_graph::dep_node::DepNode)>>::call_once
  21:     0x7f9120e5880c - <rustc_query_system[873bd36b90da509c]::dep_graph::graph::DepGraphData<rustc_middle[16339a7d2af1bee1]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[d449feea4892fbc5]::plumbing::QueryCtxt>
  22:     0x7f9120e57975 - <rustc_query_system[873bd36b90da509c]::dep_graph::graph::DepGraphData<rustc_middle[16339a7d2af1bee1]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[d449feea4892fbc5]::plumbing::QueryCtxt>
  23:     0x7f9121a2321e - rustc_query_system[873bd36b90da509c]::query::plumbing::ensure_must_run::<rustc_query_impl[d449feea4892fbc5]::DynamicConfig<rustc_query_system[873bd36b90da509c]::query::caches::DefaultCache<rustc_span[f446feb06f8d21a5]::def_id::LocalModDefId, rustc_middle[16339a7d2af1bee1]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d449feea4892fbc5]::plumbing::QueryCtxt>
  24:     0x7f9121a23796 - rustc_query_impl[d449feea4892fbc5]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
  25:     0x7f9121122885 - rustc_middle[16339a7d2af1bee1]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[873bd36b90da509c]::query::caches::DefaultCache<rustc_span[f446feb06f8d21a5]::def_id::LocalModDefId, rustc_middle[16339a7d2af1bee1]::query::erase::Erased<[u8; 1usize]>>, ()>
  26:     0x7f9121123150 - rustc_hir_analysis[479a66532c93313f]::check_crate
  27:     0x7f91217c4d12 - rustc_interface[2c240f1a557fc091]::passes::analysis
  28:     0x7f91217c495f - rustc_query_impl[d449feea4892fbc5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d449feea4892fbc5]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[16339a7d2af1bee1]::query::erase::Erased<[u8; 1usize]>>
  29:     0x7f9121d931a7 - rustc_query_system[873bd36b90da509c]::query::plumbing::try_execute_query::<rustc_query_impl[d449feea4892fbc5]::DynamicConfig<rustc_query_system[873bd36b90da509c]::query::caches::SingleCache<rustc_middle[16339a7d2af1bee1]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d449feea4892fbc5]::plumbing::QueryCtxt, true>
  30:     0x7f9121d92daa - rustc_query_impl[d449feea4892fbc5]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  31:     0x7f9121b36a33 - rustc_interface[2c240f1a557fc091]::interface::run_compiler::<core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>, rustc_driver_impl[15253732b01127ee]::run_compiler::{closure#0}>::{closure#0}
  32:     0x7f912176c706 - std[9b9743348aa3637e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2c240f1a557fc091]::util::run_in_thread_with_globals<rustc_interface[2c240f1a557fc091]::util::run_in_thread_pool_with_globals<rustc_interface[2c240f1a557fc091]::interface::run_compiler<core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>, rustc_driver_impl[15253732b01127ee]::run_compiler::{closure#0}>::{closure#0}, core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>>::{closure#0}, core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>>
  33:     0x7f912176c533 - <<std[9b9743348aa3637e]::thread::Builder>::spawn_unchecked_<rustc_interface[2c240f1a557fc091]::util::run_in_thread_with_globals<rustc_interface[2c240f1a557fc091]::util::run_in_thread_pool_with_globals<rustc_interface[2c240f1a557fc091]::interface::run_compiler<core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>, rustc_driver_impl[15253732b01127ee]::run_compiler::{closure#0}>::{closure#0}, core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>>::{closure#0}, core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2c84ace8ac8a7133]::result::Result<(), rustc_span[f446feb06f8d21a5]::ErrorGuaranteed>>::{closure#1} as core[2c84ace8ac8a7133]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f911cd97fb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h81eeb26d82351c2e
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/alloc/src/boxed.rs:2015:9
  35:     0x7f911cd97fb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha4fb1b693e599c2e
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/alloc/src/boxed.rs:2015:9
  36:     0x7f911cd97fb5 - std::sys::pal::unix::thread::Thread::new::thread_start::hbbc84e063a1942c6
                               at /rustc/635124704849eeead4e3a7bb6e663c5351571d93/library/std/src/sys/pal/unix/thread.rs:108:17
  37:     0x7f911ca969eb - <unknown>
  38:     0x7f911cb1a7cc - <unknown>
  39:                0x0 - <unknown>


rustc version: 1.77.0-nightly (635124704 2024-01-27)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `<impl at examples/web_sockets/src/main.rs:23:1: 23:66>` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack

@saethlin saethlin added A-lifetimes Area: lifetime related and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 6, 2024
@compiler-errors compiler-errors self-assigned this Feb 6, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 6, 2024
…=nnethercote

Don't expect early-bound region to be local when reporting errors in RPITIT well-formedness

The implicit lifetime in the example code gets replaced with `ReError`, which fails a `sub_regions` check in the lexical region solver. Error reporting ends up calling `is_suitable_region` on an early bound region in the *trait* definition. This causes an ICE because we `expect_local()`.

This is kind of a bad explanation, but this code just makes diagnostics reporting a bit more gracefully fallible. If the reviewer wants a thorough investigation of exactly where we get this region outlives obligation, I can write one up. Doesn't really seem worth it, though, imo.

Fixes rust-lang#120638
Fixes rust-lang#120648
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 7, 2024
Rollup merge of rust-lang#120707 - compiler-errors:suitable-region, r=nnethercote

Don't expect early-bound region to be local when reporting errors in RPITIT well-formedness

The implicit lifetime in the example code gets replaced with `ReError`, which fails a `sub_regions` check in the lexical region solver. Error reporting ends up calling `is_suitable_region` on an early bound region in the *trait* definition. This causes an ICE because we `expect_local()`.

This is kind of a bad explanation, but this code just makes diagnostics reporting a bit more gracefully fallible. If the reviewer wants a thorough investigation of exactly where we get this region outlives obligation, I can write one up. Doesn't really seem worth it, though, imo.

Fixes rust-lang#120638
Fixes rust-lang#120648
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants