-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
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) ❄️T-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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)
Description
auto-reduced (treereduce-rust):
//@compile-flags: --edition=2024 -Znext-solver=globally
pub trait Foo: Sync {
fn run<'a, 'b: 'a, T: Sync>(&'a self, _: &'b T) -> impl Future + 'a;
}
pub trait FooExt: Foo {
fn run_via<'a, 'b: 'a, T: Sync>(&'a self, t: &'b T) -> impl Future + 'a + Send {
async move {
self.run(t).await;
}
}
}original:
// Repro for <https://github.com/rust-lang/rust/issues/111105#issue-1692860759>.
//@ check-pass
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
use negative_token::*;
pub trait Foo: Sync {
fn run<'a, 'b: 'a, T: Sync>(&'a self, _: &'b T) -> impl Future<Output = ()> + 'a + ;
}
pub trait FooExt: Foo {
fn run_via<'a, 'b: 'a, T: Sync>(&'a self, t: &'b T) -> impl Future<Output = ()> + 'a + Send {
async move {
// asks for an unspecified lifetime to outlive itself? weird diagnostics
self.run(t).await;
}
}
}
fn main() {}Version information
rustc 1.95.0-nightly (621d76794 2026-01-18)
binary: rustc
commit-hash: 621d76794c76fc21c0a6151fbc090120e0230a91
commit-date: 2026-01-18
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8
Possibly related line of code:
rust/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
Lines 274 to 286 in 621d767
| hidden_ty.ty | |
| } else { | |
| let hir_ty = tcx.type_of_opaque_hir_typeck(def_id); | |
| if let Err(guar) = hir_ty.skip_binder().error_reported() { | |
| EarlyBinder::bind(Ty::new_error(tcx, guar)) | |
| } else { | |
| assert!(!tcx.next_trait_solver_globally()); | |
| hir_ty | |
| } | |
| } | |
| } | |
| Err(guar) => EarlyBinder::bind(Ty::new_error(tcx, guar)), | |
| }, |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024 -Znext-solver=globally
Program output
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.x8GG9kfvgbbd/rustc_testrunner_tmpdir_reporting.jPPPY2ZbxUsj/mvce.rs:11:2
|
11 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.x8GG9kfvgbbd/rustc_testrunner_tmpdir_reporting.jPPPY2ZbxUsj/mvce.rs`
thread 'rustc' (1737656) panicked at /rustc-dev/621d76794c76fc21c0a6151fbc090120e0230a91/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs:280:25:
assertion failed: !tcx.next_trait_solver_globally()
stack backtrace:
0: 0x7f460b633fd3 - <<std[287527946f71f0bc]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[7477a31a1a34cc49]::fmt::Display>::fmt
1: 0x7f460bc0e2c8 - core[7477a31a1a34cc49]::fmt::write
2: 0x7f460b64a9c6 - <std[287527946f71f0bc]::sys::stdio::unix::Stderr as std[287527946f71f0bc]::io::Write>::write_fmt
3: 0x7f460b60a048 - std[287527946f71f0bc]::panicking::default_hook::{closure#0}
4: 0x7f460b627703 - std[287527946f71f0bc]::panicking::default_hook
5: 0x7f460a5fbb8a - std[287527946f71f0bc]::panicking::update_hook::<alloc[979041e9952e771b]::boxed::Box<rustc_driver_impl[517260a07841a630]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f460b6279e2 - std[287527946f71f0bc]::panicking::panic_with_hook
7: 0x7f460b60a13a - std[287527946f71f0bc]::panicking::panic_handler::{closure#0}
8: 0x7f460b600dc9 - std[287527946f71f0bc]::sys::backtrace::__rust_end_short_backtrace::<std[287527946f71f0bc]::panicking::panic_handler::{closure#0}, !>
9: 0x7f460b60bbdd - __rustc[5ec7081ce87b032f]::rust_begin_unwind
10: 0x7f460810cfbc - core[7477a31a1a34cc49]::panicking::panic_fmt
11: 0x7f4607de10a2 - core[7477a31a1a34cc49]::panicking::panic
12: 0x7f460db4572c - rustc_hir_analysis[1a80394817eddfdd]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit.cold
13: 0x7f460cc14042 - rustc_hir_analysis[1a80394817eddfdd]::collect::type_of::type_of_opaque
14: 0x7f460cc13f47 - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 8usize]>>
15: 0x7f460bc173c5 - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_query_system[b7e73caa2c2ad9a]::query::caches::DefIdCache<rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
16: 0x7f460c5d90db - rustc_query_impl[f20b8284200e680a]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
17: 0x7f460c5bd8b6 - rustc_hir_analysis[1a80394817eddfdd]::collect::type_of::type_of
18: 0x7f460bd75c26 - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 8usize]>>
19: 0x7f460bc173c5 - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_query_system[b7e73caa2c2ad9a]::query::caches::DefIdCache<rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
20: 0x7f460bc16f6f - rustc_query_impl[f20b8284200e680a]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
21: 0x7f460cc14abb - rustc_hir_analysis[1a80394817eddfdd]::check::check::check_opaque
22: 0x7f460c39b904 - rustc_hir_analysis[1a80394817eddfdd]::check::check::check_item_type
23: 0x7f460c39379c - rustc_hir_analysis[1a80394817eddfdd]::check::wfcheck::check_well_formed
24: 0x7f460c39376b - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 1usize]>>
25: 0x7f460c3931e3 - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_data_structures[e0d8483206daafa2]::vec_cache::VecCache<rustc_span[851f35e07e3c2dd4]::def_id::LocalDefId, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[b7e73caa2c2ad9a]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
26: 0x7f460c392cd6 - rustc_query_impl[f20b8284200e680a]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
27: 0x7f460c3904d1 - rustc_hir_analysis[1a80394817eddfdd]::check::wfcheck::check_type_wf
28: 0x7f460c39035d - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 1usize]>>
29: 0x7f460cda3e85 - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_query_system[b7e73caa2c2ad9a]::query::caches::SingleCache<rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
30: 0x7f460cda3b36 - rustc_query_impl[f20b8284200e680a]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
31: 0x7f460c73f316 - rustc_hir_analysis[1a80394817eddfdd]::check_crate
32: 0x7f460bd493db - rustc_interface[5c48368f5debe80d]::passes::analysis
33: 0x7f460bd49035 - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 0usize]>>
34: 0x7f460cda4be3 - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_query_system[b7e73caa2c2ad9a]::query::caches::SingleCache<rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
35: 0x7f460cda49ce - rustc_query_impl[f20b8284200e680a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
36: 0x7f460cf82c11 - <rustc_interface[5c48368f5debe80d]::passes::create_and_enter_global_ctxt<core[7477a31a1a34cc49]::option::Option<rustc_interface[5c48368f5debe80d]::queries::Linker>, rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[7477a31a1a34cc49]::ops::function::FnOnce<(&rustc_session[eb79e6d3104f29ae]::session::Session, rustc_middle[725063e074f29df]::ty::context::CurrentGcx, alloc[979041e9952e771b]::sync::Arc<rustc_data_structures[e0d8483206daafa2]::jobserver::Proxy>, &std[287527946f71f0bc]::sync::once_lock::OnceLock<rustc_middle[725063e074f29df]::ty::context::GlobalCtxt>, &rustc_data_structures[e0d8483206daafa2]::sync::worker_local::WorkerLocal<rustc_middle[725063e074f29df]::arena::Arena>, &rustc_data_structures[e0d8483206daafa2]::sync::worker_local::WorkerLocal<rustc_hir[7eac7792dedc1861]::Arena>, rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
37: 0x7f460cdf5d34 - rustc_interface[5c48368f5debe80d]::interface::run_compiler::<(), rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}>::{closure#1}
38: 0x7f460cd5aa3a - std[287527946f71f0bc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5c48368f5debe80d]::util::run_in_thread_with_globals<rustc_interface[5c48368f5debe80d]::util::run_in_thread_pool_with_globals<rustc_interface[5c48368f5debe80d]::interface::run_compiler<(), rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
39: 0x7f460cd5a7fe - <std[287527946f71f0bc]::thread::lifecycle::spawn_unchecked<rustc_interface[5c48368f5debe80d]::util::run_in_thread_with_globals<rustc_interface[5c48368f5debe80d]::util::run_in_thread_pool_with_globals<rustc_interface[5c48368f5debe80d]::interface::run_compiler<(), rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[7477a31a1a34cc49]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
40: 0x7f460cd5c5c4 - <std[287527946f71f0bc]::sys::thread::unix::Thread>::new::thread_start
41: 0x7f460669698b - <unknown>
42: 0x7f460671a9cc - <unknown>
43: 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.95.0-nightly (621d76794 2026-01-18) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir
query stack during panic:
#0 [type_of_opaque] computing type of opaque `FooExt::run_via::{opaque#0}`
#1 [type_of] computing type of `FooExt::run_via::{opaque#0}`
#2 [check_well_formed] checking that `FooExt::run_via::{opaque#0}` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0601`.
@rustbot label +WG-trait-system-refactor
Reactions are currently unavailable
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) ❄️T-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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)