rust-lang / rust-lang/rust

ICE error: Assertion failed in compiler/rustc_hir_typeck/src/method/probe.rs:1008:17

Open
#146,353 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-trait_alias I-ICE S-bug-has-test S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(trait_alias)]

use std::mem::{MaybeUninit};
const BIG_CHAIN = MaybeUninit::uninit();

pub trait NeverSend = !Send;
Meta

rustc --version --verbose:

rustc 1.91.0-nightly (12eb345e5 2025-09-07)
binary: rustc
commit-hash: 12eb345e5593a10e61b4aef766076c8bd552fea6
commit-date: 2025-09-07
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Error output
error: negative bounds are not supported
 --> test.rc:6:23
  |
6 | pub trait NeverSend = !Send;
  |                       ^

error[E0601]: `main` function not found in crate `test`
 --> test.rc:6:29
  |
6 | pub trait NeverSend = !Send;
  |                             ^ consider adding a `main` function to `test.rc`


thread 'rustc' (1833949) panicked at compiler/rustc_hir_typeck/src/method/probe.rs:1008:17:
assertion `left == right` failed
  left: Negative
 right: Positive
Backtrace

stack backtrace:
   0:     0x7fb1e31c3033 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2ad4b81e0a1d141a
   1:     0x7fb1e38019d8 - core::fmt::write::hb0774556d3dc7b30
   2:     0x7fb1e3177e51 - std::io::Write::write_fmt::hbc4aae9967b6aa1f
   3:     0x7fb1e3188f12 - std::sys::backtrace::BacktraceLock::print::h009225ea673dcb39
   4:     0x7fb1e318ee99 - std::panicking::default_hook::{{closure}}::h0ee7758b43152b02
   5:     0x7fb1e318e9c3 - std::panicking::default_hook::hd7f22928c5f2b4e9
   6:     0x7fb1e21e90c5 - std[4955be27840904f9]::panicking::update_hook::<alloc[205488731dce6b4a]::boxed::Box<rustc_driver_impl[26f42f34adb8177b]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fb1e318f2bf - std::panicking::panic_with_hook::hb199e027d0d73c56
   8:     0x7fb1e318f07a - std::panicking::panic_handler::{{closure}}::h89e27a9e26d6abc9
   9:     0x7fb1e3189059 - std::sys::backtrace::__rust_end_short_backtrace::h4bc0c30a574c3838
  10:     0x7fb1e316988d - __rustc[ef8cadc59785fc73]::rust_begin_unwind
  11:     0x7fb1df8cf270 - core::panicking::panic_fmt::hb0ee001753087495
  12:     0x7fb1e1bddec3 - core::panicking::assert_failed_inner::h101c476149ff1899
  13:     0x7fb1e2f14a33 - core[dc33fea427b8ae3c]::panicking::assert_failed::<rustc_type_ir[3c2d8bd6038ac218]::predicate::PredicatePolarity, rustc_type_ir[3c2d8bd6038ac218]::predicate::PredicatePolarity>
  14:     0x7fb1e410c0a8 - <rustc_hir_typeck[a729fa17c49a9425]::method::probe::ProbeContext>::assemble_extension_candidates_for_trait
  15:     0x7fb1e411f749 - <rustc_hir_typeck[a729fa17c49a9425]::fn_ctxt::FnCtxt>::probe_for_name
  16:     0x7fb1e4445d98 - <rustc_hir_typeck[a729fa17c49a9425]::fn_ctxt::FnCtxt>::check_expr_path
  17:     0x7fb1e457b219 - <rustc_hir_typeck[a729fa17c49a9425]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18:     0x7fb1e3a3f32e - <rustc_hir_typeck[a729fa17c49a9425]::fn_ctxt::FnCtxt>::check_expr_call
  19:     0x7fb1e457c277 - <rustc_hir_typeck[a729fa17c49a9425]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  20:     0x7fb1e3c7f737 - rustc_hir_typeck[a729fa17c49a9425]::typeck_with_inspect::{closure#0}
  21:     0x7fb1e3c7a4f6 - rustc_query_impl[a53c7e3147e2afca]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a53c7e3147e2afca]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7fb1e39dea45 - rustc_query_system[f188b7b83fb6d746]::query::plumbing::try_execute_query::<rustc_query_impl[a53c7e3147e2afca]::DynamicConfig<rustc_data_structures[9410bdb10db28c4b]::vec_cache::VecCache<rustc_span[9207591e1bacc259]::def_id::LocalDefId, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[f188b7b83fb6d746]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[a53c7e3147e2afca]::plumbing::QueryCtxt, false>
  23:     0x7fb1e39de489 - rustc_query_impl[a53c7e3147e2afca]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7fb1e23a9a4a - rustc_hir_analysis[5ea282e177d0be67]::collect::type_of::infer_placeholder_type
  25:     0x7fb1e3fd373c - rustc_hir_analysis[5ea282e177d0be67]::collect::type_of::type_of
  26:     0x7fb1e3817326 - rustc_query_impl[a53c7e3147e2afca]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a53c7e3147e2afca]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 8usize]>>
  27:     0x7fb1e3815fb9 - rustc_query_system[f188b7b83fb6d746]::query::plumbing::try_execute_query::<rustc_query_impl[a53c7e3147e2afca]::DynamicConfig<rustc_query_system[f188b7b83fb6d746]::query::caches::DefIdCache<rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a53c7e3147e2afca]::plumbing::QueryCtxt, false>
  28:     0x7fb1e3815b5d - rustc_query_impl[a53c7e3147e2afca]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7fb1e41c053b - rustc_hir_analysis[5ea282e177d0be67]::check::check::check_item_type
  30:     0x7fb1e41bab5b - rustc_hir_analysis[5ea282e177d0be67]::check::wfcheck::check_well_formed
  31:     0x7fb1e41bab23 - rustc_query_impl[a53c7e3147e2afca]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a53c7e3147e2afca]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7fb1e41ba363 - rustc_query_system[f188b7b83fb6d746]::query::plumbing::try_execute_query::<rustc_query_impl[a53c7e3147e2afca]::DynamicConfig<rustc_data_structures[9410bdb10db28c4b]::vec_cache::VecCache<rustc_span[9207591e1bacc259]::def_id::LocalDefId, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[f188b7b83fb6d746]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[a53c7e3147e2afca]::plumbing::QueryCtxt, false>
  33:     0x7fb1e41b9e82 - rustc_query_impl[a53c7e3147e2afca]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7fb1e41b5f2f - rustc_hir_analysis[5ea282e177d0be67]::check::wfcheck::check_type_wf
  35:     0x7fb1e41b5e25 - rustc_query_impl[a53c7e3147e2afca]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a53c7e3147e2afca]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7fb1e48d4e48 - rustc_query_system[f188b7b83fb6d746]::query::plumbing::try_execute_query::<rustc_query_impl[a53c7e3147e2afca]::DynamicConfig<rustc_query_system[f188b7b83fb6d746]::query::caches::SingleCache<rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a53c7e3147e2afca]::plumbing::QueryCtxt, false>
  37:     0x7fb1e48d4c0e - rustc_query_impl[a53c7e3147e2afca]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7fb1e42229b9 - rustc_hir_analysis[5ea282e177d0be67]::check_crate
  39:     0x7fb1e39d62be - rustc_interface[304babcac9c0794b]::passes::analysis
  40:     0x7fb1e39d5f8b - rustc_query_impl[a53c7e3147e2afca]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a53c7e3147e2afca]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 0usize]>>
  41:     0x7fb1e48db8e6 - rustc_query_system[f188b7b83fb6d746]::query::plumbing::try_execute_query::<rustc_query_impl[a53c7e3147e2afca]::DynamicConfig<rustc_query_system[f188b7b83fb6d746]::query::caches::SingleCache<rustc_middle[c20b1833d2103cd4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a53c7e3147e2afca]::plumbing::QueryCtxt, false>
  42:     0x7fb1e48db53c - rustc_query_impl[a53c7e3147e2afca]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7fb1e4a8bc63 - rustc_interface[304babcac9c0794b]::passes::create_and_enter_global_ctxt::<core[dc33fea427b8ae3c]::option::Option<rustc_interface[304babcac9c0794b]::queries::Linker>, rustc_driver_impl[26f42f34adb8177b]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  44:     0x7fb1e4a7b97e - rustc_interface[304babcac9c0794b]::interface::run_compiler::<(), rustc_driver_impl[26f42f34adb8177b]::run_compiler::{closure#0}>::{closure#1}
  45:     0x7fb1e49cc078 - std[4955be27840904f9]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[304babcac9c0794b]::util::run_in_thread_with_globals<rustc_interface[304babcac9c0794b]::util::run_in_thread_pool_with_globals<rustc_interface[304babcac9c0794b]::interface::run_compiler<(), rustc_driver_impl[26f42f34adb8177b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  46:     0x7fb1e49cbd5c - <<std[4955be27840904f9]::thread::Builder>::spawn_unchecked_<rustc_interface[304babcac9c0794b]::util::run_in_thread_with_globals<rustc_interface[304babcac9c0794b]::util::run_in_thread_pool_with_globals<rustc_interface[304babcac9c0794b]::interface::run_compiler<(), rustc_driver_impl[26f42f34adb8177b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[dc33fea427b8ae3c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7fb1e49d23cd - std::sys::pal::unix::thread::Thread::new::thread_start::h131e81087b96dc19
  48:     0x7fb1de46bac3 - <unknown>
  49:     0x7fb1de4fd850 - <unknown>
  50:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ICE with the provided trait-alias example on the reported nightly compiler, then start at compiler/rustc_hir_typeck/src/method/probe.rs:1008:17 and the assemble_extension_candidates_for_trait entry point named in the backtrace. Trace how the negative predicate reaches the assertion. Done means the example reports its errors without an internal compiler panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.