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 with next-solver: thread 'rustc' panicked at compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:1733:65: called Option::unwrap() on a None value #132320

Open
823984418 opened this issue Oct 29, 2024 · 0 comments · May be fixed by #133558
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Comments

@823984418
Copy link
Contributor

Code

trait Foo {
    type Item;
    fn foo(&mut self);
}

impl Foo for () {
    type Item = Option<()>;

    fn foo(&mut self) {
        let _ = Self::Item::None;
    }
}

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (3f1be1ec7 2024-10-28)
binary: rustc
commit-hash: 3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777
commit-date: 2024-10-28
host: x86_64-pc-windows-msvc
release: 1.84.0-nightly
LLVM version: 19.1.1

Error output

thread 'rustc' panicked at compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:1733:65:                                                                                         
called `Option::unwrap()` on a `None` value
Backtrace

PS E:\code\rust_demo> $env:RUST_BACKTRACE=1    
PS E:\code\rust_demo> cargo run                
   Compiling rust_demo v0.1.0 (E:\code\rust_demo)
thread 'rustc' panicked at compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:1733:65:                                                                                         
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: std::panicking::begin_panic_handler                                                                                                                                          
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/std\src\panicking.rs:665
   1: core::panicking::panic_fmt
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/core\src\panicking.rs:75
   2: core::panicking::panic
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/core\src\panicking.rs:152
   3: core::option::unwrap_failed
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/core\src\option.rs:2008
   4: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::probe_generic_path_segments                                                                                         
   5: rustc_hir_typeck::typeck                                                                                                                                                     
   6: <<rustc_hir_typeck::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_ty 
   7: <<rustc_hir_typeck::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_ty 
   8: <<rustc_hir_typeck::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_ty 
   9: <<rustc_hir_typeck::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_ty 
  10: <<rustc_hir_typeck::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_ty 
  11: rustc_hir_typeck::typeck
  12: rustc_hir_typeck::typeck
  13: rustc_query_impl::plumbing::query_key_hash_verify_all
  14: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  15: rustc_query_impl::plumbing::query_key_hash_verify_all
  16: <rustc_hir_typeck::upvar::InferBorrowKind as rustc_hir_typeck::expr_use_visitor::Delegate>::borrow
  17: rustc_hir_analysis::check_crate                                                                                                                                              
  18: rustc_interface::passes::resolver_for_lowering_raw
  19: rustc_interface::passes::analysis
  20: rustc_ty_utils::ty::adt_sized_constraint
  21: rustc_ty_utils::ty::adt_sized_constraint
  22: rustc_query_impl::query_system
  23: _rust_alloc_error_handler
  24: _rust_alloc_error_handler
  25: _rust_alloc_error_handler
  26: alloc::boxed::impl$48::call_once
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/alloc\src\boxed.rs:2454
  27: alloc::boxed::impl$48::call_once
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/alloc\src\boxed.rs:2454
  28: std::sys::pal::windows::thread::impl$0::new::thread_start
             at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777\library/std\src\sys\pal\windows\thread.rs:55
  29: BaseThreadInitThunk
  30: RtlUserThreadStart
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: please make sure that you have updated to the latest nightly

note: please attach the file at `E:\code\rust_demo\rustc-ice-2024-10-29T12_26_30-2056.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z next-solver

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `<impl at src/main.rs:6:1: 6:16>::foo`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `rust_demo` (bin "rust_demo")

Caused by:
  process didn't exit successfully: `D:\Program Files\rust\rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name rust_demo --edition=2021 src/main.rs --error-
format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=179 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg cf
g(docsrs) --check-cfg "cfg(feature, values())" -C metadata=f204a4422c344f70 --out-dir E:\code\rust_demo\target\x86_64-pc-windows-msvc\debug\deps --target x86_64-pc-windows-msvc -C 
incremental=E:\code\rust_demo\target\x86_64-pc-windows-msvc\debug\incremental -L dependency=E:\code\rust_demo\target\x86_64-pc-windows-msvc\debug\deps -L dependency=E:\code\rust_demo\target\debug\deps -Znext-solver` (exit code: 101)

@823984418 823984418 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 Oct 29, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 29, 2024
@fmease fmease added requires-nightly This issue requires a nightly compiler in some way. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 29, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Nov 7, 2024
@lcnr lcnr linked a pull request Nov 28, 2024 that will close this issue
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants