-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-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-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.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Description
auto-reduced (treereduce-rust):
trait FooMut {
type Baz: 'static;
fn bar<'a, I>(self, iterator: &'a I)
where
for<'b> &'b I: IntoIterator<Item = &'b &'a Self::Baz>;
}
struct DelegatingFooMut<T> {}
impl<T> FooMut for DelegatingFooMut<T>
where
T: FooMut,
{
type Baz = DelegatingBaz<T::Baz>;
fn bar<'a, I>(self, collection: &'a I)
where
for<'b> &'b I: IntoIterator,
{
let collection = collection.into_iter().map(|b| &b);
self.bar(collection)
}
}
struct DelegatingBaz<T>;
original:
trait FooMut {
type Baz: 'static;
fn bar<'a, I>(self, iterator: &'a I)
where
for<'b> &'b I: IntoIterator<Item = &'b &'a Self::Baz>;
}
struct DelegatingFooMut<T>
where
T: FooMut, {}
impl<T> FooMut for DelegatingFooMut<T>
where
T: FooMut,
{
type Baz = DelegatingBaz<T::Baz>;
fn bar<'a, I>(self, collection: &'a I)
where
for<'b> &'b I: IntoIterator,
{
let collection = collection.into_iter().map(|b| &b);
self.bar(collection)
}
}
struct DelegatingBaz<T>;
pub fn main() {}
Version information
rustc 1.90.0-nightly (1c6de2150 2025-07-16)
binary: rustc
commit-hash: 1c6de215099bbe33668de762f9591187f6c25eef
commit-date: 2025-07-16
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8
Possibly related line of code:
rust/compiler/rustc_infer/src/infer/region_constraints/mod.rs
Lines 462 to 474 in 1c6de21
) { | |
// cannot add constraints once regions are resolved | |
debug!("origin = {:#?}", origin); | |
match (sub.kind(), sup.kind()) { | |
(ReBound(..), _) | (_, ReBound(..)) => { | |
span_bug!(origin.span(), "cannot relate bound region: {:?} <= {:?}", sub, sup); | |
} | |
(_, ReStatic) => { | |
// all regions are subregions of static, so we can ignore this | |
} | |
(ReVar(sub_id), ReVar(sup_id)) => { | |
self.add_constraint(Constraint::VarSubVar(sub_id, sup_id), origin); |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs:22:25
|
22 | struct DelegatingBaz<T>;
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs`
error[E0392]: type parameter `T` is never used
--> /tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs:7:25
|
7 | struct DelegatingFooMut<T> {}
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
error[E0195]: lifetime parameters do not match the trait definition
--> /tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs:14:12
|
14 | fn bar<'a, I>(self, collection: &'a I)
| ^^
|
= note: lifetime parameters differ in whether they are early- or late-bound
note: `'a` differs between the trait and impl
--> /tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs:3:12
|
1 | trait FooMut {
| ------------ in this trait...
2 | type Baz: 'static;
3 | fn bar<'a, I>(self, iterator: &'a I)
| ^^ `'a` is early-bound
4 | where
5 | for<'b> &'b I: IntoIterator<Item = &'b &'a Self::Baz>;
| ------------------------ this lifetime bound makes `'a` early-bound
...
9 | / impl<T> FooMut for DelegatingFooMut<T>
10 | | where
11 | | T: FooMut,
| |______________- in this impl...
...
14 | fn bar<'a, I>(self, collection: &'a I)
| ^^ `'a` is late-bound
error[E0392]: type parameter `T` is never used
--> /tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs:22:22
|
22 | struct DelegatingBaz<T>;
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:468:17: cannot relate bound region: '^0.Named(DefId(0:8 ~ mvce[9174]::FooMut::bar::'b)) <= '?5
thread 'rustc' panicked at compiler/rustc_infer/src/infer/region_constraints/mod.rs:468:17:
Box<dyn Any>
stack backtrace:
0: 0x7b4d45ff9403 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfecc64209d1f083d
1: 0x7b4d46802877 - core::fmt::write::h2a210ef2ee328422
2: 0x7b4d45feef33 - std::io::Write::write_fmt::h958669e99a2dcc1b
3: 0x7b4d45ff9262 - std::sys::backtrace::BacktraceLock::print::hd76a629e9c354d1a
4: 0x7b4d45ffcd07 - std::panicking::default_hook::{{closure}}::ha5ca805082f016b7
5: 0x7b4d45ffc86b - std::panicking::default_hook::h954991efcc4f3cec
6: 0x7b4d45094523 - std[5063006013ba73a3]::panicking::update_hook::<alloc[31decb083fcbf252]::boxed::Box<rustc_driver_impl[d0e6b8b9dcfdbcef]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7b4d45ffd54e - std::panicking::rust_panic_with_hook::h1c54f234944551f2
8: 0x7b4d450ce111 - std[5063006013ba73a3]::panicking::begin_panic::<rustc_errors[f6bd045b92c5704b]::ExplicitBug>::{closure#0}
9: 0x7b4d450c30a6 - std[5063006013ba73a3]::sys::backtrace::__rust_end_short_backtrace::<std[5063006013ba73a3]::panicking::begin_panic<rustc_errors[f6bd045b92c5704b]::ExplicitBug>::{closure#0}, !>
10: 0x7b4d450c2f35 - std[5063006013ba73a3]::panicking::begin_panic::<rustc_errors[f6bd045b92c5704b]::ExplicitBug>
11: 0x7b4d450d7bf1 - <rustc_errors[f6bd045b92c5704b]::diagnostic::BugAbort as rustc_errors[f6bd045b92c5704b]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7b4d4564208c - <rustc_errors[f6bd045b92c5704b]::DiagCtxtHandle>::span_bug::<rustc_span[21ad9ac73572669a]::span_encoding::Span, alloc[31decb083fcbf252]::string::String>
13: 0x7b4d456d65b7 - rustc_middle[2691867c5197ffb4]::util::bug::opt_span_bug_fmt::<rustc_span[21ad9ac73572669a]::span_encoding::Span>::{closure#0}
14: 0x7b4d456b6ada - rustc_middle[2691867c5197ffb4]::ty::context::tls::with_opt::<rustc_middle[2691867c5197ffb4]::util::bug::opt_span_bug_fmt<rustc_span[21ad9ac73572669a]::span_encoding::Span>::{closure#0}, !>::{closure#0}
15: 0x7b4d456b694b - rustc_middle[2691867c5197ffb4]::ty::context::tls::with_context_opt::<rustc_middle[2691867c5197ffb4]::ty::context::tls::with_opt<rustc_middle[2691867c5197ffb4]::util::bug::opt_span_bug_fmt<rustc_span[21ad9ac73572669a]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
16: 0x7b4d42d44767 - rustc_middle[2691867c5197ffb4]::util::bug::span_bug_fmt::<rustc_span[21ad9ac73572669a]::span_encoding::Span>
17: 0x7b4d469125f4 - rustc_type_ir[e2a9117d91bef9a6]::relate::structurally_relate_tys::<rustc_middle[2691867c5197ffb4]::ty::context::TyCtxt, rustc_infer[6a9be856b777fd19]::infer::relate::type_relating::TypeRelating>::{closure#0}
18: 0x7b4d46906ea6 - <rustc_infer[6a9be856b777fd19]::infer::relate::type_relating::TypeRelating as rustc_type_ir[e2a9117d91bef9a6]::relate::TypeRelation<rustc_middle[2691867c5197ffb4]::ty::context::TyCtxt>>::tys
19: 0x7b4d46fce23b - <rustc_trait_selection[b677d31ba289951a]::traits::engine::ObligationCtxt>::eq::<rustc_middle[2691867c5197ffb4]::ty::Ty>
20: 0x7b4d45e6d9be - <rustc_trait_selection[b677d31ba289951a]::error_reporting::TypeErrCtxt>::point_at_chain::<rustc_span[21ad9ac73572669a]::ErrorGuaranteed>
21: 0x7b4d45e6ab1b - <rustc_trait_selection[b677d31ba289951a]::error_reporting::TypeErrCtxt>::note_function_argument_obligation::<rustc_span[21ad9ac73572669a]::ErrorGuaranteed>
22: 0x7b4d45e60567 - <rustc_trait_selection[b677d31ba289951a]::error_reporting::TypeErrCtxt>::note_obligation_cause_code::<rustc_span[21ad9ac73572669a]::ErrorGuaranteed, rustc_middle[2691867c5197ffb4]::ty::predicate::Predicate>
23: 0x7b4d45e2a0d5 - <rustc_trait_selection[b677d31ba289951a]::error_reporting::TypeErrCtxt>::note_obligation_cause
24: 0x7b4d45e7892d - <rustc_trait_selection[b677d31ba289951a]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
25: 0x7b4d46a99f41 - <rustc_hir_typeck[265d0d08d07618d]::fn_ctxt::FnCtxt>::try_structurally_resolve_type
26: 0x7b4d47566610 - <rustc_hir_typeck[265d0d08d07618d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
27: 0x7b4d4755f7ab - <rustc_hir_typeck[265d0d08d07618d]::fn_ctxt::FnCtxt>::check_argument_types
28: 0x7b4d47568e78 - <rustc_hir_typeck[265d0d08d07618d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
29: 0x7b4d4754d54c - <rustc_hir_typeck[265d0d08d07618d]::fn_ctxt::FnCtxt>::check_expr_block
30: 0x7b4d4756793b - <rustc_hir_typeck[265d0d08d07618d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
31: 0x7b4d475583bb - rustc_hir_typeck[265d0d08d07618d]::check::check_fn
32: 0x7b4d47a3f1b7 - rustc_hir_typeck[265d0d08d07618d]::typeck_with_inspect::{closure#0}
33: 0x7b4d47a2bbb0 - rustc_query_impl[876323bf6c893e3a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[876323bf6c893e3a]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2691867c5197ffb4]::query::erase::Erased<[u8; 8usize]>>
34: 0x7b4d46a50e2e - rustc_query_system[5227141d7cc7c8f2]::query::plumbing::try_execute_query::<rustc_query_impl[876323bf6c893e3a]::DynamicConfig<rustc_data_structures[cbda6e031a2b752d]::vec_cache::VecCache<rustc_span[21ad9ac73572669a]::def_id::LocalDefId, rustc_middle[2691867c5197ffb4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[5227141d7cc7c8f2]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[876323bf6c893e3a]::plumbing::QueryCtxt, false>
35: 0x7b4d46a507c9 - rustc_query_impl[876323bf6c893e3a]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
36: 0x7b4d46df94db - rustc_hir_analysis[ebd647d899a7c63b]::check_crate
37: 0x7b4d471f431d - rustc_interface[f65689421b54b96b]::passes::analysis
38: 0x7b4d471f3f2f - rustc_query_impl[876323bf6c893e3a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[876323bf6c893e3a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2691867c5197ffb4]::query::erase::Erased<[u8; 0usize]>>
39: 0x7b4d478a117c - rustc_query_system[5227141d7cc7c8f2]::query::plumbing::try_execute_query::<rustc_query_impl[876323bf6c893e3a]::DynamicConfig<rustc_query_system[5227141d7cc7c8f2]::query::caches::SingleCache<rustc_middle[2691867c5197ffb4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[876323bf6c893e3a]::plumbing::QueryCtxt, false>
40: 0x7b4d478a0d44 - rustc_query_impl[876323bf6c893e3a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
41: 0x7b4d47b136cb - rustc_interface[f65689421b54b96b]::passes::create_and_enter_global_ctxt::<core[1f172d27a6a395fa]::option::Option<rustc_interface[f65689421b54b96b]::queries::Linker>, rustc_driver_impl[d0e6b8b9dcfdbcef]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
42: 0x7b4d47b01594 - rustc_interface[f65689421b54b96b]::interface::run_compiler::<(), rustc_driver_impl[d0e6b8b9dcfdbcef]::run_compiler::{closure#0}>::{closure#1}
43: 0x7b4d479d77f8 - std[5063006013ba73a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f65689421b54b96b]::util::run_in_thread_with_globals<rustc_interface[f65689421b54b96b]::util::run_in_thread_pool_with_globals<rustc_interface[f65689421b54b96b]::interface::run_compiler<(), rustc_driver_impl[d0e6b8b9dcfdbcef]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
44: 0x7b4d479d74d6 - <<std[5063006013ba73a3]::thread::Builder>::spawn_unchecked_<rustc_interface[f65689421b54b96b]::util::run_in_thread_with_globals<rustc_interface[f65689421b54b96b]::util::run_in_thread_pool_with_globals<rustc_interface[f65689421b54b96b]::interface::run_compiler<(), rustc_driver_impl[d0e6b8b9dcfdbcef]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[1f172d27a6a395fa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x7b4d479dd57d - std::sys::pal::unix::thread::Thread::new::thread_start::he4bc8e8616f31d56
46: 0x7b4d412a57eb - <unknown>
47: 0x7b4d4132918c - <unknown>
48: 0x0 - <unknown>
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.90.0-nightly (1c6de2150 2025-07-16) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.TMRK74peGta5/rustc_testrunner_tmpdir_reporting.ceno8eeAjDuO/mvce.rs:9:1: 11:15>::bar`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0195, E0392, E0601.
For more information about an error, try `rustc --explain E0195`.
Metadata
Metadata
Assignees
Labels
C-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-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.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.