Skip to content

Commit dd83c57

Browse files
committed
add crashes tests for overlapping spans
1 parent a2b4833 commit dd83c57

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

tests/crashes/146261.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This is part of series of regression tests for some diagnostics ICEs encountered in the wild with
2+
// suggestions having overlapping parts under https://github.com/rust-lang/rust/pull/146121.
3+
4+
//@ needs-rustc-debug-assertions
5+
//@ known-bug: #146261
6+
7+
enum U {
8+
B(),
9+
}
10+
11+
fn main() {
12+
A(U::C)
13+
}

tests/crashes/146706.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is part of series of regression tests for some diagnostics ICEs encountered in the wild with
2+
// suggestions having overlapping parts under https://github.com/rust-lang/rust/pull/146121.
3+
4+
//@ needs-rustc-debug-assertions
5+
//@ known-bug: #146706
6+
7+
type Alias<'a, T> = Foo<T>;
8+
9+
enum Foo<T> {
10+
Bar { t: T },
11+
}
12+
13+
fn main() {
14+
Alias::Bar::<u32> { t: 0 };
15+
}

tests/crashes/147973.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This is part of series of regression tests for some diagnostics ICEs encountered in the wild with
2+
// suggestions having overlapping parts under https://github.com/rust-lang/rust/pull/146121.
3+
// This is one MCVE from the beta crater run regressions from issue 147973.
4+
5+
//@ needs-rustc-debug-assertions
6+
//@ known-bug: #147973
7+
8+
//@ aux-build: overlapping_spans_helper.rs
9+
extern crate overlapping_spans_helper;
10+
11+
fn main() {
12+
let _name = Some(1);
13+
overlapping_spans_helper::do_loop!(_name);
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Auxiliary lib for the issue 147973 regression test with ICEs due to overlapping spans.
2+
3+
#[macro_export]
4+
macro_rules! identity {
5+
($x:ident) => {
6+
$x
7+
};
8+
}
9+
10+
#[macro_export]
11+
macro_rules! do_loop {
12+
($x:ident) => {
13+
for $crate::identity!($x) in $x {}
14+
};
15+
}

0 commit comments

Comments
 (0)