File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -479,7 +479,20 @@ impl<'a> StringReader<'a> {
479
479
}
480
480
481
481
self . with_str_from ( start, |string| {
482
- Some ( Symbol :: intern ( string) )
482
+ if string == "_" {
483
+ self . sess . span_diagnostic
484
+ . struct_span_warn ( mk_sp ( start, self . pos ) ,
485
+ "underscore literal suffix is not allowed" )
486
+ . warn ( "this was previously accepted by the compiler but is \
487
+ being phased out; it will become a hard error in \
488
+ a future release!")
489
+ . note ( "for more information, see issue #42326 \
490
+ <https://github.com/rust-lang/rust/issues/42326>")
491
+ . emit ( ) ;
492
+ None
493
+ } else {
494
+ Some ( Symbol :: intern ( string) )
495
+ }
483
496
} )
484
497
}
485
498
Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
fn main ( ) {
12
- let a = "Foo" _; //~ ERROR string literal with a suffix is invalid
12
+ let _ = "Foo" _;
13
+ //~^ WARNING underscore literal suffix is not allowed
14
+ //~| WARNING this was previously accepted
15
+ //~| NOTE issue #42326
13
16
}
17
+
18
+ FAIL
19
+ //~^ ERROR
20
+ //~| NOTE
You can’t perform that action at this time.
0 commit comments