-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
rynewang/rust
#2Closed
Copy link
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-return_type_notation`#[feature(return_type_notation)]``#[feature(return_type_notation)]`F-trait_alias`#![feature(trait_alias)]``#![feature(trait_alias)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Context: It's HIR ty lowering's job to resolve+lower RTN. However, it needs the lifetime resolutions from RBV which runs before HIR ty lowering and which (unfortunately) sort of duplicates some of HIR ty lowering code to resolve RTN itself. Now, while HIR ty lowering can handle RTN where the trait that defines the assoc fn is behind a trait alias, RBV can't yet. As a result, HIR ty lowering lacks the necessary resolutions and ICEs.
Example reproducer:
#![feature(return_type_notation, trait_alias)]
trait Al = Tr;
trait Tr { fn f() -> impl Sized; }
fn f<T: Al<f(..): Copy>>() {}Compiler ICE message:
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: bad return type notation here
--> src/lib.rs:6:12
|
6 | fn f<T: Al<f(..): Copy>>() {}
| ^
|
Full compiler output (includes backtrace):
Details
warning: trait `Tr` is never used
--> src/lib.rs:4:7
|
4 | trait Tr { fn f() -> impl Sized; }
| ^^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
warning: function `f` is never used
--> src/lib.rs:6:4
|
6 | fn f<T: Al<f(..): Copy>>() {}
| ^
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: bad return type notation here
--> src/lib.rs:6:12
|
6 | fn f<T: Al<f(..): Copy>>() {}
| ^
|
note: delayed at /rustc-dev/db3e99bbab28c6ca778b13222becdea54533d908/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs:1889:26
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
4: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_path
5: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext>::visit_poly_trait_ref_inner
6: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_where_predicate
7: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_generics
8: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_fn
9: rustc_hir::intravisit::walk_item::<rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext>
10: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_item
11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::resolve_bound_vars::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 8]>>
12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_data_structures::vec_cache::VecCache<rustc_hir_id::OwnerId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}>, false>
13: rustc_query_impl::query_impl::resolve_bound_vars::get_query_non_incr::__rust_end_short_backtrace
14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::named_variable_map::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 8]>>
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_data_structures::vec_cache::VecCache<rustc_hir_id::OwnerId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}>, false>
16: rustc_query_impl::query_impl::named_variable_map::get_query_non_incr::__rust_end_short_backtrace
17: <rustc_middle::ty::context::TyCtxt>::named_bound_var
18: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty_param
19: rustc_hir_analysis::collect::predicates_of::gather_explicit_predicates_of
20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::explicit_predicates_of::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 24]>>
21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: true }}>, false>
22: rustc_query_impl::query_impl::explicit_predicates_of::get_query_non_incr::__rust_end_short_backtrace
23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::predicates_of::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 24]>>
24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}>, false>
25: rustc_query_impl::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
26: rustc_hir_analysis::check::check::check_item_type
27: rustc_hir_analysis::check::wfcheck::check_well_formed
28: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 1]>>
29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}>, false>
30: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
31: rustc_hir_analysis::check::wfcheck::check_type_wf
32: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 1]>>
33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}>, false>
34: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
35: rustc_hir_analysis::check_crate
36: rustc_interface::passes::analysis
37: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::make_query_vtable::{closure#1}::{closure#0}, rustc_middle::query::erase::ErasedData<[u8; 0]>>
38: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::SemiDynamicQueryDispatcher<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}>, false>
39: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
40: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
41: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
42: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
43: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
44: <std::sys::thread::unix::Thread>::new::thread_start
45: <unknown>
46: clone
--> src/lib.rs:6:12
|
6 | fn f<T: Al<f(..): Copy>>() {}
| ^
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 `/playground/rustc-ice-2026-02-05T08_31_41-26.txt` to your bug report
note: rustc 1.95.0-nightly (db3e99bba 2026-02-04) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
warning: `playground` (lib) generated 2 warnings
error: could not compile `playground` (lib); 2 warnings emitted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-return_type_notation`#[feature(return_type_notation)]``#[feature(return_type_notation)]`F-trait_alias`#![feature(trait_alias)]``#![feature(trait_alias)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.