File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -449,6 +449,7 @@ E0764: include_str!("./error_codes/E0764.md"),
449449E0765 : include_str!( "./error_codes/E0765.md" ) ,
450450E0766 : include_str!( "./error_codes/E0766.md" ) ,
451451E0767 : include_str!( "./error_codes/E0767.md" ) ,
452+ E0768 : include_str!( "./error_codes/E0768.md" ) ,
452453;
453454// E0006, // merged with E0005
454455// E0008, // cannot bind by-move into a pattern guard
Original file line number Diff line number Diff line change 1+ A number in a non-decimal base has no digits.
2+
3+ Erroneous code example:
4+
5+ ``` compile_fail,E0768
6+ let s: i32 = 0b; // error!
7+ ```
8+
9+ To fix this error, add the missing digits:
10+
11+ ```
12+ let s: i32 = 0b1; // ok!
13+ ```
Original file line number Diff line number Diff line change @@ -391,7 +391,14 @@ impl<'a> StringReader<'a> {
391391 }
392392 rustc_lexer:: LiteralKind :: Int { base, empty_int } => {
393393 return if empty_int {
394- self . err_span_ ( start, suffix_start, "no valid digits found for number" ) ;
394+ self . sess
395+ . span_diagnostic
396+ . struct_span_err_with_code (
397+ self . mk_sp ( start, suffix_start) ,
398+ "no valid digits found for number" ,
399+ error_code ! ( E0768 ) ,
400+ )
401+ . emit ( ) ;
395402 ( token:: Integer , sym:: integer ( 0 ) )
396403 } else {
397404 self . validate_int_literal ( base, start, suffix_start) ;
You can’t perform that action at this time.
0 commit comments