Skip to content

Commit a421cfe

Browse files
committed
Add regression test to ensure #[allow(unstable_name_collisions)] works
1 parent 680d9fc commit a421cfe

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/test/ui/inference/issue-81522.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Regression test for #81522.
2+
// Ensures that `#[allow(unstable_name_collisions)]` appended to things other than function
3+
// suppresses the corresponding diagnostics emitted from inside them.
4+
// But note that this attribute doesn't work for macro invocations if it is appended directly.
5+
6+
// aux-build:inference_unstable_iterator.rs
7+
// aux-build:inference_unstable_itertools.rs
8+
// run-pass
9+
10+
extern crate inference_unstable_iterator;
11+
extern crate inference_unstable_itertools;
12+
13+
#[allow(unused_imports)]
14+
use inference_unstable_iterator::IpuIterator;
15+
use inference_unstable_itertools::IpuItertools;
16+
17+
fn main() {
18+
// expression statement
19+
#[allow(unstable_name_collisions)]
20+
'x'.ipu_flatten();
21+
22+
// let statement
23+
#[allow(unstable_name_collisions)]
24+
let _ = 'x'.ipu_flatten();
25+
26+
// block expression
27+
#[allow(unstable_name_collisions)]
28+
{
29+
'x'.ipu_flatten();
30+
}
31+
}

0 commit comments

Comments
 (0)