Closed
Description
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)
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.The Rustc Trait System Refactor Initiative (-Znext-solver)This issue requires a nightly compiler in some way.