Skip to content

[ICE]: outlives clauses should not error outside borrowck #161527

Closed

Description

@matthiaskrgr

snippet:

auto trait Z<'a, T: ?Sized>
where
    T: Z<'a, u16>,

    for<'b> <T as Z<'b, u16>>::W: 'a,
{
    type W: ?A;
}

Version information

rustc 1.100.0-nightly (b0ca9c712 2026-08-22)
binary: rustc
commit-hash: b0ca9c712455d865c3bf0bf5325a3e79677a2d97
commit-date: 2026-08-22
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0

Possibly related line of code:

// not selection error.
span_bug!(span, "coerce requirement gave wrong error: `{:?}`", predicate)
}
ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(..))
| ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(..)) => {
span_bug!(
span,
"outlives clauses should not error outside borrowck. obligation: `{:?}`",
obligation
)
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0567]: auto traits cannot have generic parameters
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:1:13
  |
1 | auto trait Z<'a, T: ?Sized>
  |            -^^^^^^^^^^^^^^^
  |            |
  |            auto trait cannot have generic parameters

error[E0568]: auto traits cannot have super traits or lifetime bounds
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:2:1
  |
1 |   auto trait Z<'a, T: ?Sized>
  |              - auto traits cannot have super traits or lifetime bounds
2 | / where
3 | |     T: Z<'a, u16>,
4 | |
5 | |     for<'b> <T as Z<'b, u16>>::W: 'a,
  | |_____________________________________^

error[E0380]: auto traits cannot have associated items
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:7:10
  |
1 | auto trait Z<'a, T: ?Sized>
  |            - auto traits cannot have associated items
...
7 |     type W: ?A;
  |          ^

error[E0405]: cannot find trait `A` in this scope
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:7:14
  |
7 |     type W: ?A;
  |              ^ not found in this scope

error[E0658]: auto traits are experimental and possibly buggy
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:1:1
  |
1 | / auto trait Z<'a, T: ?Sized>
2 | | where
3 | |     T: Z<'a, u16>,
... |
7 | |     type W: ?A;
8 | | }
  | |_^
  |
  = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
  = help: add `#![feature(auto_traits)]` to the crate attributes to enable
  = note: this compiler was built on 2026-08-22; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:8:2
  |
8 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs`

error: internal compiler error: /rustc-dev/b0ca9c712455d865c3bf0bf5325a3e79677a2d97/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:662:25: outlives clauses should not error outside borrowck. obligation: `Obligation(predicate=Binder { value: OutlivesClause(Alias(No, Alias { kind: Projection { def_id: DefId(0:7 ~ mvce[ec7e]::Z::W) }, args: [u16, '^0.Named(DefId(0:6 ~ mvce[ec7e]::Z::'b)), u16], .. }), 'a/#1), bound_vars: [Region(BrNamed(DefId(0:6 ~ mvce[ec7e]::Z::'b)))] }, depth=0)`
 --> /tmp/icemaker_global_tempdir.CjoRe9eOM8ET/rustc_testrunner_tmpdir_reporting.7sTUMMU08N7Q/mvce.rs:3:8
  |
3 |     T: Z<'a, u16>,
  |        ^^^^^^^^^^


thread 'rustc' (3796211) panicked at /rustc-dev/b0ca9c712455d865c3bf0bf5325a3e79677a2d97/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:662:25:
Box<dyn Any>
stack backtrace:
   0:     0x7faf0b9fc246 - <<std[29541300fb290a5d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[460910d47b72e8ee]::fmt::Display>::fmt
   1:     0x7faf0c00b023 - core[460910d47b72e8ee]::fmt::write
   2:     0x7faf0ba1172c - <std[29541300fb290a5d]::sys::stdio::unix::Stderr as core[460910d47b72e8ee]::io::write::Write>::write_fmt
   3:     0x7faf0b9cf61a - std[29541300fb290a5d]::panicking::default_hook::{closure#0}
   4:     0x7faf0b9f04a3 - std[29541300fb290a5d]::panicking::default_hook
   5:     0x7faf0a9a89aa - std[29541300fb290a5d]::panicking::update_hook::<alloc[e06df03e17637ff3]::boxed::Box<rustc_driver_impl[56abbf040ce8585c]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7faf0b9f0942 - std[29541300fb290a5d]::panicking::panic_with_hook
   7:     0x7faf0a9d6f24 - std[29541300fb290a5d]::panicking::begin_panic::<rustc_errors[fdbcaf08f64701c7]::ExplicitBug>::{closure#0}
   8:     0x7faf0a9cf9be - std[29541300fb290a5d]::sys::backtrace::__rust_end_short_backtrace::<std[29541300fb290a5d]::panicking::begin_panic<rustc_errors[fdbcaf08f64701c7]::ExplicitBug>::{closure#0}, !>
   9:     0x7faf0a9cda5e - std[29541300fb290a5d]::panicking::begin_panic::<rustc_errors[fdbcaf08f64701c7]::ExplicitBug>
  10:     0x7faf0a9e2961 - <rustc_errors[fdbcaf08f64701c7]::diagnostic::BugAbort as rustc_errors[fdbcaf08f64701c7]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7faf0af212fc - <rustc_errors[fdbcaf08f64701c7]::DiagCtxtHandle>::span_bug::<rustc_span[7b0e571682104a6f]::span_encoding::Span, alloc[e06df03e17637ff3]::string::String>
  12:     0x7faf0af4e946 - rustc_middle[9d9ea3708d6e93f5]::util::bug::opt_span_bug_fmt::<rustc_span[7b0e571682104a6f]::span_encoding::Span>::{closure#0}
  13:     0x7faf0af4ed62 - rustc_middle[9d9ea3708d6e93f5]::ty::context::tls::with_opt::<rustc_middle[9d9ea3708d6e93f5]::util::bug::opt_span_bug_fmt<rustc_span[7b0e571682104a6f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7faf0af3a860 - rustc_middle[9d9ea3708d6e93f5]::ty::context::tls::with_context_opt::<rustc_middle[9d9ea3708d6e93f5]::ty::context::tls::with_opt<rustc_middle[9d9ea3708d6e93f5]::util::bug::opt_span_bug_fmt<rustc_span[7b0e571682104a6f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7faf07e22a98 - rustc_middle[9d9ea3708d6e93f5]::util::bug::span_bug_fmt::<rustc_span[7b0e571682104a6f]::span_encoding::Span>
  16:     0x7faf0b81445a - <rustc_trait_selection[6d6a1773eb45fa07]::error_reporting::TypeErrCtxt>::report_selection_error
  17:     0x7faf0b835e11 - <rustc_trait_selection[6d6a1773eb45fa07]::error_reporting::TypeErrCtxt>::report_fulfillment_error
  18:     0x7faf0a2c4a6f - <rustc_trait_selection[6d6a1773eb45fa07]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  19:     0x7faf0c85f1fc - rustc_hir_analysis[30f31704cfa60f6c]::check::wfcheck::check_trait
  20:     0x7faf0cc01006 - rustc_hir_analysis[30f31704cfa60f6c]::check::check::check_item_type
  21:     0x7faf0cbf81a6 - rustc_hir_analysis[30f31704cfa60f6c]::check::wfcheck::check_well_formed
  22:     0x7faf0cbf8187 - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  23:     0x7faf0cbf77df - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_data_structures[ce2d1b2e5f4b9540]::vec_cache::VecCache<rustc_span[7b0e571682104a6f]::def_id::LocalDefId, rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[9d9ea3708d6e93f5]::dep_graph::graph::DepNodeIndex>, false>
  24:     0x7faf0cbf7571 - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  25:     0x7faf0cbf3420 - rustc_hir_analysis[30f31704cfa60f6c]::check::wfcheck::check_type_wf
  26:     0x7faf0cbf331b - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  27:     0x7faf0d211c49 - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::SingleCache<rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 1usize]>>, false>
  28:     0x7faf0d211a2d - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  29:     0x7faf0c878c64 - rustc_hir_analysis[30f31704cfa60f6c]::check_crate
  30:     0x7faf0cb2c0ba - rustc_interface[473d810ada35544b]::passes::analysis
  31:     0x7faf0d21354a - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::SingleCache<rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 0usize]>>, false>
  32:     0x7faf0d2132eb - rustc_query_impl[a298bd9aef25de82]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  33:     0x7faf0d385c6b - rustc_interface[473d810ada35544b]::interface::run_compiler::<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}
  34:     0x7faf0d3d7582 - std[29541300fb290a5d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[473d810ada35544b]::util::run_in_thread_with_globals<rustc_interface[473d810ada35544b]::util::run_in_thread_pool_with_globals<rustc_interface[473d810ada35544b]::interface::run_compiler<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  35:     0x7faf0d3d732d - <std[29541300fb290a5d]::thread::lifecycle::spawn_unchecked<rustc_interface[473d810ada35544b]::util::run_in_thread_with_globals<rustc_interface[473d810ada35544b]::util::run_in_thread_pool_with_globals<rustc_interface[473d810ada35544b]::interface::run_compiler<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[460910d47b72e8ee]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7faf0d3d4d87 - <std[29541300fb290a5d]::sys::thread::unix::Thread>::new::thread_start
  37:     0x7faf06697739 - <unknown>
  38:     0x7faf0671bedc - <unknown>
  39:                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.100.0-nightly (b0ca9c712 2026-08-22) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `Z` is well-formed
#1 [check_type_wf] checking that types are well-formed
#2 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 7 previous errors

Some errors have detailed explanations: E0380, E0405, E0567, E0568, E0601, E0658.
For more information about an error, try `rustc --explain E0380`.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Aug 22, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 22, 2026
  3. matthiaskrgr commented on Aug 22, 2026

    @matthiaskrgr
    MemberAuthor

    bit smaller

    trait Z<'a, T: ?Sized>
    where
        T: Z<'a, ()>,
        for<'b> <T as Z<'b, ()>>::W: 'a,
    {
        type W;
    }
    
    fn main() {}
  4. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 23, 2026
  5. moved this from needs triage to in progress in -Znext-solver=globallyon Aug 27, 2026
  6. moved this from in progress to needs triage in -Znext-solver=globallyon Aug 27, 2026
  7. added a commit that references this issue on Aug 31, 2026
    5b7da8f
  8. added a commit that references this issue on Aug 31, 2026
    85eaa63
  9. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 31, 2026
  10. added a commit that references this issue on Aug 31, 2026
    f797fd8
  11. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions