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: non_lifetime_binders: resolve_bound_vars.rs: called Option::unwrap() on a None value #108177

Closed
fmease opened this issue Feb 17, 2023 · 1 comment · Fixed by #108554
Closed
Assignees
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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

@fmease
Copy link
Member

fmease commented Feb 17, 2023

Code

#![feature(non_lifetime_binders)]
#![allow(incomplete_features)]
#![crate_type = "lib"]

pub fn f<T>() where for<U> (T, U): Copy {}

Meta

Latest master (f722b24):

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs:1012:75
Backtrace

stack backtrace:
   0:     0x7f6f3cf08a87 - std::backtrace_rs::backtrace::trace_unsynchronized::h8317dca8f1569d65
   1:     0x7f6f3ceb83f7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf47fa547ae6f40de
   2:     0x7f6f3cf5d4c7 - core::fmt::write::h485466f956dc1ae8
   3:     0x7f6f3cec4471 - std::io::Write::write_fmt::hee9856a9efbff71e
   4:     0x7f6f3ceb825b - std::sys_common::backtrace::print::h5738de0db63ef2a1
   5:     0x7f6f3cecfcb7 - std::panicking::default_hook::{{closure}}::h885f531b4751288f
   6:     0x7f6f3cecfa5f - std::panicking::default_hook::h272acffc233193d2
   7:     0x7f6f3d8bef1f - rustc_driver_impl[383832fff9fc1ae2]::DEFAULT_HOOK::{closure#0}::{closure#0}
   8:     0x7f6f3ced0224 - std::panicking::rust_panic_with_hook::h27b56f6e5ce0ef73
   9:     0x7f6f3cedac12 - std::panicking::begin_panic_handler::{{closure}}::h65ad7d4b3d4fcd12
  10:     0x7f6f3cedab8c - std::sys_common::backtrace::__rust_end_short_backtrace::h5f5e0232bacf8eba
  11:     0x7f6f3cecfd91 - rust_begin_unwind
  12:     0x7f6f3ceb7863 - core::panicking::panic_fmt::h840d3096004ea8aa
  13:     0x7f6f3ceb78fd - core::panicking::panic::h44f322ea34a0a111
  14:     0x7f6f3df9d5e1 - rustc_hir_analysis[5ce09c444f4c43fa]::collect::resolve_bound_vars::object_lifetime_default
  15:     0x7f6f3f18d8b5 - rustc_query_system[85fae218c4b5e286]::query::plumbing::try_execute_query::<rustc_query_impl[b2e96c3a56899231]::queries::object_lifetime_default, rustc_query_impl[b2e96c3a56899231]::plumbing::QueryCtxt>
  16:     0x7f6f3f22ebaa - rustc_query_system[85fae218c4b5e286]::query::plumbing::get_query::<rustc_query_impl[b2e96c3a56899231]::queries::object_lifetime_default, rustc_query_impl[b2e96c3a56899231]::plumbing::QueryCtxt, rustc_middle[7fc7b7fa12a8a9f0]::dep_graph::dep_node::DepKind>
  17:     0x7f6f3ef98255 - <rustc_query_impl[b2e96c3a56899231]::Queries as rustc_middle[7fc7b7fa12a8a9f0]::ty::query::QueryEngine>::object_lifetime_default
  18:     0x7f6f3f6a27a2 - <rustc_metadata[55333ad787d3e40f]::rmeta::encoder::EncodeContext>::encode_def_ids
  19:     0x7f6f3f69b86e - <rustc_metadata[55333ad787d3e40f]::rmeta::encoder::EncodeContext>::encode_crate_root
  20:     0x7f6f3f6a9225 - rustc_metadata[55333ad787d3e40f]::rmeta::encoder::encode_metadata_impl
  21:     0x7f6f3f66397c - rustc_data_structures[e27b60ba834a6fde]::sync::join::<rustc_metadata[55333ad787d3e40f]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[55333ad787d3e40f]::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
  22:     0x7f6f3f6a8165 - rustc_metadata[55333ad787d3e40f]::rmeta::encoder::encode_metadata
  23:     0x7f6f3f6ab131 - rustc_metadata[55333ad787d3e40f]::fs::encode_and_write_metadata
  24:     0x7f6f3d91e548 - rustc_interface[e6910dbe0eaa341d]::passes::start_codegen
  25:     0x7f6f3d9f5cf2 - <rustc_middle[7fc7b7fa12a8a9f0]::ty::context::GlobalCtxt>::enter::<<rustc_interface[e6910dbe0eaa341d]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[78a717fb536b413e]::result::Result<alloc[7138004fb0811b07]::boxed::Box<dyn core[78a717fb536b413e]::any::Any>, rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>
  26:     0x7f6f3d9ed00b - <rustc_interface[e6910dbe0eaa341d]::queries::Query<alloc[7138004fb0811b07]::boxed::Box<dyn core[78a717fb536b413e]::any::Any>>>::compute::<<rustc_interface[e6910dbe0eaa341d]::queries::Queries>::ongoing_codegen::{closure#0}>
  27:     0x7f6f3d8c5d14 - <rustc_interface[e6910dbe0eaa341d]::interface::Compiler>::enter::<rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}::{closure#2}, core[78a717fb536b413e]::result::Result<core[78a717fb536b413e]::option::Option<rustc_interface[e6910dbe0eaa341d]::queries::Linker>, rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>
  28:     0x7f6f3d8f0510 - rustc_span[d57cf0485e9b06ce]::with_source_map::<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  29:     0x7f6f3d8702b6 - <scoped_tls[b966ac58386d5624]::ScopedKey<rustc_span[d57cf0485e9b06ce]::SessionGlobals>>::set::<rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>
  30:     0x7f6f3d901827 - std[3bf57732816ce612]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e6910dbe0eaa341d]::util::run_in_thread_pool_with_globals<rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>
  31:     0x7f6f3d901f04 - <core[78a717fb536b413e]::panic::unwind_safe::AssertUnwindSafe<<std[3bf57732816ce612]::thread::Builder>::spawn_unchecked_<rustc_interface[e6910dbe0eaa341d]::util::run_in_thread_pool_with_globals<rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#1}::{closure#0}> as core[78a717fb536b413e]::ops::function::FnOnce<()>>::call_once
  32:     0x7f6f3d8f458e - std[3bf57732816ce612]::panicking::try::<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, core[78a717fb536b413e]::panic::unwind_safe::AssertUnwindSafe<<std[3bf57732816ce612]::thread::Builder>::spawn_unchecked_<rustc_interface[e6910dbe0eaa341d]::util::run_in_thread_pool_with_globals<rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#1}::{closure#0}>>
  33:     0x7f6f3d8fd08b - std[3bf57732816ce612]::panic::catch_unwind::<core[78a717fb536b413e]::panic::unwind_safe::AssertUnwindSafe<<std[3bf57732816ce612]::thread::Builder>::spawn_unchecked_<rustc_interface[e6910dbe0eaa341d]::util::run_in_thread_pool_with_globals<rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#1}::{closure#0}>, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>
  34:     0x7f6f3d903166 - <<std[3bf57732816ce612]::thread::Builder>::spawn_unchecked_<rustc_interface[e6910dbe0eaa341d]::util::run_in_thread_pool_with_globals<rustc_interface[e6910dbe0eaa341d]::interface::run_compiler<core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>, rustc_driver_impl[383832fff9fc1ae2]::run_compiler::{closure#1}>::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[78a717fb536b413e]::result::Result<(), rustc_errors[740418f3d2bf4004]::ErrorGuaranteed>>::{closure#1} as core[78a717fb536b413e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f6f3cf10838 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa8d67098fec2471
  36:     0x7f6f3cedbcba - std::sys::unix::thread::Thread::new::thread_start::hb51be3c5a4172ca9
  37:     0x7f6f3cce18fd - <unknown>
  38:     0x7f6f3cd63a60 - <unknown>
  39:                0x0 - <unknown>

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.69.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [object_lifetime_default] looking up lifetime defaults for generic parameter `f::U`
end of query stack

CC @compiler-errors

@fmease fmease 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 17, 2023
@compiler-errors
Copy link
Member

It clearly says "incomplete features", of course it's supposed to ICE 🤣

I'll fix this while I'm at it.

@compiler-errors compiler-errors self-assigned this Feb 17, 2023
@estebank estebank added the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Feb 18, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Feb 28, 2023
…default, r=oli-obk

Only look for param in item's generics if it actually comes from generics

Record whether a `hir::GenericParam` comes from an item's generics, or from a `for<...>` binder. Then, only look for the param in `object_lifetime_default` if it actually comes from the item's generics.

Fixes rust-lang#108177
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 28, 2023
…default, r=oli-obk

Only look for param in item's generics if it actually comes from generics

Record whether a `hir::GenericParam` comes from an item's generics, or from a `for<...>` binder. Then, only look for the param in `object_lifetime_default` if it actually comes from the item's generics.

Fixes rust-lang#108177
@bors bors closed this as completed in 19604c2 Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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
Development

Successfully merging a pull request may close this issue.

3 participants