-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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) ❄️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.
Description
auto-reduced (treereduce-rust):
trait Foo: Sized {
}
fn foo<'a,'b,T>(x: &'a T, y: &'b T)
where &str : Foo,
{
match 42_u8 {
-10..
}
}
original:
trait Foo: Sized {
fn foo(self);
}
fn foo<'a,'b,T>(x: &'a T, y: &'b T)
where &str : Foo, //~ ERROR type annotations needed
&'b T : Foo
{
match 42_u8 {
-10..253 => {}
//~^ ERROR `u8: Neg` is not satisfied
_ => {}
}
match 'A' {
-'\0'..'a' => {}
//~^ ERROR `char: Neg` is not satisfied
_ => {}
}
}
fn main() { }Version information
rustc 1.93.0-nightly (1ef7943ee 2025-11-05)
binary: rustc
commit-hash: 1ef7943ee607160a564655b6596f83670ef95df5
commit-date: 2025-11-05
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.3
Possibly related line of code:
rust/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
Lines 46 to 58 in 1ef7943
| ) -> Box<Pat<'tcx>> { | |
| let mut convert = ConstToPat::new(self, id, span, c); | |
| match c.kind() { | |
| ty::ConstKind::Unevaluated(uv) => convert.unevaluated_to_pat(uv, ty), | |
| ty::ConstKind::Value(cv) => convert.valtree_to_pat(cv.valtree, cv.ty), | |
| _ => span_bug!(span, "Invalid `ConstKind` for `const_to_pat`: {:?}", c), | |
| } | |
| } | |
| } | |
| struct ConstToPat<'tcx> { | |
| tcx: TyCtxt<'tcx>, |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> /tmp/icemaker_global_tempdir.QrZg22quQJrL/rustc_testrunner_tmpdir_reporting.BuKVsJ3GMQgY/mvce.rs:6:11
|
6 | where &str : Foo,
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here
|
6 | where for<'a> &'a str : Foo,
| +++++++ ++
error: `match` arm with no body
--> /tmp/icemaker_global_tempdir.QrZg22quQJrL/rustc_testrunner_tmpdir_reporting.BuKVsJ3GMQgY/mvce.rs:10:9
|
10 | -10..
| ^^^^^
|
help: add a body after the pattern
|
10 | -10.. => { todo!() }
| ++++++++++++++
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.QrZg22quQJrL/rustc_testrunner_tmpdir_reporting.BuKVsJ3GMQgY/mvce.rs:16:2
|
16 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.QrZg22quQJrL/rustc_testrunner_tmpdir_reporting.BuKVsJ3GMQgY/mvce.rs`
error: internal compiler error: compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:52:18: Invalid `ConstKind` for `const_to_pat`: {const error}
--> /tmp/icemaker_global_tempdir.QrZg22quQJrL/rustc_testrunner_tmpdir_reporting.BuKVsJ3GMQgY/mvce.rs:10:9
|
10 | -10..
| ^^^
thread 'rustc' (292298) panicked at compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:52:18:
Box<dyn Any>
stack backtrace:
0: 0x7efd8625b9f3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6d82c1afff976903
1: 0x7efd86a01afc - core::fmt::write::hb1e7ca88b6a3936e
2: 0x7efd86210643 - std::io::Write::write_fmt::hc04a1e5003ed78ae
3: 0x7efd86221b72 - std::sys::backtrace::BacktraceLock::print::ha2430613ee79d059
4: 0x7efd86227bc9 - std::panicking::default_hook::{{closure}}::hdbd2db9e5c303cf6
5: 0x7efd862276f3 - std::panicking::default_hook::hed93c70cba5fdcf0
6: 0x7efd8522b881 - std[b39a7fdbd75bd60b]::panicking::update_hook::<alloc[7b7dcd0daa518623]::boxed::Box<rustc_driver_impl[c465687f568b7810]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7efd86227fef - std::panicking::panic_with_hook::h3862d766c2cec19b
8: 0x7efd85268301 - std[b39a7fdbd75bd60b]::panicking::begin_panic::<rustc_errors[6530766ff18959da]::ExplicitBug>::{closure#0}
9: 0x7efd8525a546 - std[b39a7fdbd75bd60b]::sys::backtrace::__rust_end_short_backtrace::<std[b39a7fdbd75bd60b]::panicking::begin_panic<rustc_errors[6530766ff18959da]::ExplicitBug>::{closure#0}, !>
10: 0x7efd8525a2b4 - std[b39a7fdbd75bd60b]::panicking::begin_panic::<rustc_errors[6530766ff18959da]::ExplicitBug>
11: 0x7efd85279641 - <rustc_errors[6530766ff18959da]::diagnostic::BugAbort as rustc_errors[6530766ff18959da]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7efd857dc92c - <rustc_errors[6530766ff18959da]::DiagCtxtHandle>::span_bug::<rustc_span[8023b26f37643d7f]::span_encoding::Span, alloc[7b7dcd0daa518623]::string::String>
13: 0x7efd857ffe87 - rustc_middle[af5fcdb43930440b]::util::bug::opt_span_bug_fmt::<rustc_span[8023b26f37643d7f]::span_encoding::Span>::{closure#0}
14: 0x7efd8580018a - rustc_middle[af5fcdb43930440b]::ty::context::tls::with_opt::<rustc_middle[af5fcdb43930440b]::util::bug::opt_span_bug_fmt<rustc_span[8023b26f37643d7f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
15: 0x7efd857f0f8b - rustc_middle[af5fcdb43930440b]::ty::context::tls::with_context_opt::<rustc_middle[af5fcdb43930440b]::ty::context::tls::with_opt<rustc_middle[af5fcdb43930440b]::util::bug::opt_span_bug_fmt<rustc_span[8023b26f37643d7f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
16: 0x7efd83ad7647 - rustc_middle[af5fcdb43930440b]::util::bug::span_bug_fmt::<rustc_span[8023b26f37643d7f]::span_encoding::Span>
17: 0x7efd875997d0 - <rustc_mir_build[505dfeb92b70c2c]::thir::pattern::PatCtxt>::const_to_pat
18: 0x7efd875a2150 - <rustc_mir_build[505dfeb92b70c2c]::thir::pattern::PatCtxt>::lower_pat_expr
19: 0x7efd87592643 - <rustc_mir_build[505dfeb92b70c2c]::thir::pattern::PatCtxt>::lower_pattern_range_endpoint
20: 0x7efd875928b9 - <rustc_mir_build[505dfeb92b70c2c]::thir::pattern::PatCtxt>::lower_pattern_range
21: 0x7efd8759eb4d - <rustc_mir_build[505dfeb92b70c2c]::thir::pattern::PatCtxt>::lower_pattern
22: 0x7efd8759c41d - <rustc_mir_build[505dfeb92b70c2c]::thir::cx::ThirBuildCx>::pattern_from_hir
23: 0x7efd875ac59d - <rustc_mir_build[505dfeb92b70c2c]::thir::cx::ThirBuildCx>::mirror_expr
24: 0x7efd875acfec - <rustc_mir_build[505dfeb92b70c2c]::thir::cx::ThirBuildCx>::mirror_expr
25: 0x7efd875a5eb8 - rustc_mir_build[505dfeb92b70c2c]::thir::cx::thir_body
26: 0x7efd875a50f6 - rustc_query_impl[cd4c0b4f54bb78f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cd4c0b4f54bb78f9]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[af5fcdb43930440b]::query::erase::Erased<[u8; 16usize]>>
27: 0x7efd8748c76a - rustc_query_system[de79018bae44308f]::query::plumbing::try_execute_query::<rustc_query_impl[cd4c0b4f54bb78f9]::DynamicConfig<rustc_data_structures[56ce653e1fdbf49e]::vec_cache::VecCache<rustc_span[8023b26f37643d7f]::def_id::LocalDefId, rustc_middle[af5fcdb43930440b]::query::erase::Erased<[u8; 16usize]>, rustc_query_system[de79018bae44308f]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[cd4c0b4f54bb78f9]::plumbing::QueryCtxt, false>
28: 0x7efd8748c3da - rustc_query_impl[cd4c0b4f54bb78f9]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
29: 0x7efd86e50e28 - rustc_mir_build[505dfeb92b70c2c]::check_unsafety::check_unsafety
30: 0x7efd86e50c23 - rustc_query_impl[cd4c0b4f54bb78f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cd4c0b4f54bb78f9]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[af5fcdb43930440b]::query::erase::Erased<[u8; 0usize]>>
31: 0x7efd86e4f8bf - rustc_query_system[de79018bae44308f]::query::plumbing::try_execute_query::<rustc_query_impl[cd4c0b4f54bb78f9]::DynamicConfig<rustc_data_structures[56ce653e1fdbf49e]::vec_cache::VecCache<rustc_span[8023b26f37643d7f]::def_id::LocalDefId, rustc_middle[af5fcdb43930440b]::query::erase::Erased<[u8; 0usize]>, rustc_query_system[de79018bae44308f]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[cd4c0b4f54bb78f9]::plumbing::QueryCtxt, false>
32: 0x7efd86e4f63d - rustc_query_impl[cd4c0b4f54bb78f9]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
33: 0x7efd86e4e726 - <rustc_middle[af5fcdb43930440b]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[fc6bbb25df376fcd]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
34: 0x7efd86e4c098 - rustc_interface[fc6bbb25df376fcd]::passes::analysis
35: 0x7efd86e4b533 - rustc_query_impl[cd4c0b4f54bb78f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cd4c0b4f54bb78f9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[af5fcdb43930440b]::query::erase::Erased<[u8; 0usize]>>
36: 0x7efd87a9b094 - rustc_query_system[de79018bae44308f]::query::plumbing::try_execute_query::<rustc_query_impl[cd4c0b4f54bb78f9]::DynamicConfig<rustc_query_system[de79018bae44308f]::query::caches::SingleCache<rustc_middle[af5fcdb43930440b]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[cd4c0b4f54bb78f9]::plumbing::QueryCtxt, false>
37: 0x7efd87a9accc - rustc_query_impl[cd4c0b4f54bb78f9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
38: 0x7efd87cc388a - <rustc_interface[fc6bbb25df376fcd]::passes::create_and_enter_global_ctxt<core[140e253ac64cf52a]::option::Option<rustc_interface[fc6bbb25df376fcd]::queries::Linker>, rustc_driver_impl[c465687f568b7810]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[140e253ac64cf52a]::ops::function::FnOnce<(&rustc_session[17610c57aa18718f]::session::Session, rustc_middle[af5fcdb43930440b]::ty::context::CurrentGcx, alloc[7b7dcd0daa518623]::sync::Arc<rustc_data_structures[56ce653e1fdbf49e]::jobserver::Proxy>, &std[b39a7fdbd75bd60b]::sync::once_lock::OnceLock<rustc_middle[af5fcdb43930440b]::ty::context::GlobalCtxt>, &rustc_data_structures[56ce653e1fdbf49e]::sync::worker_local::WorkerLocal<rustc_middle[af5fcdb43930440b]::arena::Arena>, &rustc_data_structures[56ce653e1fdbf49e]::sync::worker_local::WorkerLocal<rustc_hir[3aa2ece47329a02f]::Arena>, rustc_driver_impl[c465687f568b7810]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
39: 0x7efd87be7533 - rustc_interface[fc6bbb25df376fcd]::interface::run_compiler::<(), rustc_driver_impl[c465687f568b7810]::run_compiler::{closure#0}>::{closure#1}
40: 0x7efd8786f0b8 - std[b39a7fdbd75bd60b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fc6bbb25df376fcd]::util::run_in_thread_with_globals<rustc_interface[fc6bbb25df376fcd]::util::run_in_thread_pool_with_globals<rustc_interface[fc6bbb25df376fcd]::interface::run_compiler<(), rustc_driver_impl[c465687f568b7810]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
41: 0x7efd8786ed8a - <<std[b39a7fdbd75bd60b]::thread::Builder>::spawn_unchecked_<rustc_interface[fc6bbb25df376fcd]::util::run_in_thread_with_globals<rustc_interface[fc6bbb25df376fcd]::util::run_in_thread_pool_with_globals<rustc_interface[fc6bbb25df376fcd]::interface::run_compiler<(), rustc_driver_impl[c465687f568b7810]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[140e253ac64cf52a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
42: 0x7efd8787022f - std::sys::thread::unix::Thread::new::thread_start::he514622d3d7ba65c
43: 0x7efd812969cb - <unknown>
44: 0x7efd8131aa0c - <unknown>
45: 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.93.0-nightly (1ef7943ee 2025-11-05) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [thir_body] building THIR for `foo`
#1 [check_unsafety] unsafety-checking `foo`
#2 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0601, E0637.
For more information about an error, try `rustc --explain E0601`.
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.