-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-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.
Description
auto-reduced (treereduce-rust):
#![feature(inherent_associated_types)]
struct Foo<T>(T);
impl<'a> Foo<fn(&())> {
type Assoc = &'a ();
}
fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
original:
#![feature(inherent_associated_types)]
#![feature(inherent_associated_types)]
// Check that we don't crash when printing inherent projections in diagnostics.
struct Foo<T>(T);
impl<'a> Foo<fn(& ())> {
type Assoc = &'a ();
}
fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {} //~ ERROR `main` function has wrong type
Version information
rustc 1.91.0-nightly (8e2ed71ef 2025-09-12)
binary: rustc
commit-hash: 8e2ed71effd5f81bff319c0c7adaca42084e2a71
commit-date: 2025-09-12
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.1
Possibly related line of code:
rust/compiler/rustc_borrowck/src/region_infer/mod.rs
Lines 1761 to 1773 in 8e2ed71
..path[best_choice] | |
} | |
} else { | |
path[best_choice] | |
}; | |
assert!( | |
!matches!( | |
best_constraint.category, | |
ConstraintCategory::OutlivesUnnameablePlaceholder(_) | |
), | |
"Illegal placeholder constraint blamed; should have redirected to other region relation" | |
); |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.XMXxmSTCf6Ug/rustc_testrunner_tmpdir_reporting.qrZtQYvCdou4/mvce.rs:1:12
|
1 | #![feature(inherent_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
--> /tmp/icemaker_global_tempdir.XMXxmSTCf6Ug/rustc_testrunner_tmpdir_reporting.qrZtQYvCdou4/mvce.rs:5:6
|
5 | impl<'a> Foo<fn(&())> {
| ^^ unconstrained lifetime parameter
error[E0308]: mismatched types
--> /tmp/icemaker_global_tempdir.XMXxmSTCf6Ug/rustc_testrunner_tmpdir_reporting.qrZtQYvCdou4/mvce.rs:9:12
|
9 | fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected struct `Foo<for<'a> fn(&'a ())>`
found struct `Foo<for<'a> fn(&'a ())>`
error[E0580]: `main` function has wrong type
--> /tmp/icemaker_global_tempdir.XMXxmSTCf6Ug/rustc_testrunner_tmpdir_reporting.qrZtQYvCdou4/mvce.rs:9:1
|
9 | fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected signature `fn()`
found signature `fn(fn(&()))`
thread 'rustc' (1111115) panicked at compiler/rustc_borrowck/src/region_infer/mod.rs:1767:9:
Illegal placeholder constraint blamed; should have redirected to other region relation
stack backtrace:
0: 0x7fbea2db1d93 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h69f84197283f92f2
1: 0x7fbea3401b18 - core::fmt::write::hac51afc447b71987
2: 0x7fbea2d66aa1 - std::io::Write::write_fmt::h7914652380e8da3b
3: 0x7fbea2d77cc2 - std::sys::backtrace::BacktraceLock::print::he6531a518b7afaed
4: 0x7fbea2d7dc09 - std::panicking::default_hook::{{closure}}::h4766ac8d31f0938d
5: 0x7fbea2d7d733 - std::panicking::default_hook::hc214b0cee38d0644
6: 0x7fbea1dc62b7 - std[1517c6b2b7ad33c0]::panicking::update_hook::<alloc[e8dcfcd713f5b5b9]::boxed::Box<rustc_driver_impl[f40c8d47e6531829]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7fbea2d7e02f - std::panicking::panic_with_hook::hac95cd1be6a69487
8: 0x7fbea2d7ddb6 - std::panicking::panic_handler::{{closure}}::h71edd8dc49b8a93b
9: 0x7fbea2d77df9 - std::sys::backtrace::__rust_end_short_backtrace::h028726c52dd94f61
10: 0x7fbea2d584dd - __rustc[c3017cc57a982af5]::rust_begin_unwind
11: 0x7fbe9f4c39f0 - core::panicking::panic_fmt::h9dca6dd2c2c3cf5b
12: 0x7fbea42c0080 - <rustc_borrowck[cf86fedb87f30a8f]::region_infer::RegionInferenceContext>::best_blame_constraint
13: 0x7fbea1b13481 - <rustc_borrowck[cf86fedb87f30a8f]::MirBorrowckCtxt>::report_region_errors
14: 0x7fbe9fe5bd2c - rustc_borrowck[cf86fedb87f30a8f]::borrowck_check_region_constraints
15: 0x7fbea465eab2 - <rustc_borrowck[cf86fedb87f30a8f]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
16: 0x7fbea46561d7 - rustc_borrowck[cf86fedb87f30a8f]::mir_borrowck
17: 0x7fbea4655fb5 - rustc_query_impl[c1b7fe2d2380a2f3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1b7fe2d2380a2f3]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4d64447825fbb932]::query::erase::Erased<[u8; 8usize]>>
18: 0x7fbea35e35c5 - rustc_query_system[8bcbb518a438fd56]::query::plumbing::try_execute_query::<rustc_query_impl[c1b7fe2d2380a2f3]::DynamicConfig<rustc_data_structures[838be9b3682db453]::vec_cache::VecCache<rustc_span[c40e2ad170baf06]::def_id::LocalDefId, rustc_middle[4d64447825fbb932]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[8bcbb518a438fd56]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c1b7fe2d2380a2f3]::plumbing::QueryCtxt, false>
19: 0x7fbea35e2dc9 - rustc_query_impl[c1b7fe2d2380a2f3]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
20: 0x7fbea35ede42 - <rustc_middle[4d64447825fbb932]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[9c243299d9070ddc]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
21: 0x7fbea35eb6d9 - rustc_interface[9c243299d9070ddc]::passes::analysis
22: 0x7fbea35eab8b - rustc_query_impl[c1b7fe2d2380a2f3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1b7fe2d2380a2f3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4d64447825fbb932]::query::erase::Erased<[u8; 0usize]>>
23: 0x7fbea44075a0 - rustc_query_system[8bcbb518a438fd56]::query::plumbing::try_execute_query::<rustc_query_impl[c1b7fe2d2380a2f3]::DynamicConfig<rustc_query_system[8bcbb518a438fd56]::query::caches::SingleCache<rustc_middle[4d64447825fbb932]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c1b7fe2d2380a2f3]::plumbing::QueryCtxt, false>
24: 0x7fbea44071f6 - rustc_query_impl[c1b7fe2d2380a2f3]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
25: 0x7fbea474ec23 - rustc_interface[9c243299d9070ddc]::passes::create_and_enter_global_ctxt::<core[fbb2f6aea0caeac7]::option::Option<rustc_interface[9c243299d9070ddc]::queries::Linker>, rustc_driver_impl[f40c8d47e6531829]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
26: 0x7fbea468eebe - rustc_interface[9c243299d9070ddc]::interface::run_compiler::<(), rustc_driver_impl[f40c8d47e6531829]::run_compiler::{closure#0}>::{closure#1}
27: 0x7fbea45f12f8 - std[1517c6b2b7ad33c0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[9c243299d9070ddc]::util::run_in_thread_with_globals<rustc_interface[9c243299d9070ddc]::util::run_in_thread_pool_with_globals<rustc_interface[9c243299d9070ddc]::interface::run_compiler<(), rustc_driver_impl[f40c8d47e6531829]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
28: 0x7fbea45f0fc8 - <<std[1517c6b2b7ad33c0]::thread::Builder>::spawn_unchecked_<rustc_interface[9c243299d9070ddc]::util::run_in_thread_with_globals<rustc_interface[9c243299d9070ddc]::util::run_in_thread_pool_with_globals<rustc_interface[9c243299d9070ddc]::interface::run_compiler<(), rustc_driver_impl[f40c8d47e6531829]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[fbb2f6aea0caeac7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
29: 0x7fbea45f728d - std::sys::thread::unix::Thread::new::thread_start::h7cbbbba756171d4a
30: 0x7fbe9de969cb - <unknown>
31: 0x7fbe9df1aa0c - <unknown>
32: 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: please make sure that you have updated to the latest nightly
note: rustc 1.91.0-nightly (8e2ed71ef 2025-09-12) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0308, E0580.
For more information about an error, try `rustc --explain E0207`.
@rustbot label +F-inherent_associated_types +F-inherent_associated_types
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-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.