add crashes tests for overlapping spans

This commit is contained in:
Rémy Rakic
2025-10-23 16:33:56 +00:00
parent a2b48332ba
commit dd83c57674
4 changed files with 57 additions and 0 deletions

13
tests/crashes/146261.rs Normal file
View File

@@ -0,0 +1,13 @@
// This is part of series of regression tests for some diagnostics ICEs encountered in the wild with
// suggestions having overlapping parts under https://github.com/rust-lang/rust/pull/146121.
//@ needs-rustc-debug-assertions
//@ known-bug: #146261
enum U {
B(),
}
fn main() {
A(U::C)
}

15
tests/crashes/146706.rs Normal file
View File

@@ -0,0 +1,15 @@
// This is part of series of regression tests for some diagnostics ICEs encountered in the wild with
// suggestions having overlapping parts under https://github.com/rust-lang/rust/pull/146121.
//@ needs-rustc-debug-assertions
//@ known-bug: #146706
type Alias<'a, T> = Foo<T>;
enum Foo<T> {
Bar { t: T },
}
fn main() {
Alias::Bar::<u32> { t: 0 };
}

14
tests/crashes/147973.rs Normal file
View File

@@ -0,0 +1,14 @@
// This is part of series of regression tests for some diagnostics ICEs encountered in the wild with
// suggestions having overlapping parts under https://github.com/rust-lang/rust/pull/146121.
// This is one MCVE from the beta crater run regressions from issue 147973.
//@ needs-rustc-debug-assertions
//@ known-bug: #147973
//@ aux-build: overlapping_spans_helper.rs
extern crate overlapping_spans_helper;
fn main() {
let _name = Some(1);
overlapping_spans_helper::do_loop!(_name);
}

View File

@@ -0,0 +1,15 @@
// Auxiliary lib for the issue 147973 regression test with ICEs due to overlapping spans.
#[macro_export]
macro_rules! identity {
($x:ident) => {
$x
};
}
#[macro_export]
macro_rules! do_loop {
($x:ident) => {
for $crate::identity!($x) in $x {}
};
}