File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
src/librustc_parse/parser Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1141,14 +1141,7 @@ impl<'a> Parser<'a> {
1141
1141
} ) ;
1142
1142
if let Some ( token) = & recovered {
1143
1143
self . bump ( ) ;
1144
- self . struct_span_err ( token. span , "float literals must have an integer part" )
1145
- . span_suggestion (
1146
- token. span ,
1147
- "must have an integer part" ,
1148
- pprust:: token_to_string ( token) ,
1149
- Applicability :: MachineApplicable ,
1150
- )
1151
- . emit ( ) ;
1144
+ self . error_float_lits_must_have_int_part ( & token) ;
1152
1145
}
1153
1146
}
1154
1147
@@ -1177,6 +1170,17 @@ impl<'a> Parser<'a> {
1177
1170
}
1178
1171
}
1179
1172
1173
+ fn error_float_lits_must_have_int_part ( & self , token : & Token ) {
1174
+ self . struct_span_err ( token. span , "float literals must have an integer part" )
1175
+ . span_suggestion (
1176
+ token. span ,
1177
+ "must have an integer part" ,
1178
+ pprust:: token_to_string ( token) ,
1179
+ Applicability :: MachineApplicable ,
1180
+ )
1181
+ . emit ( ) ;
1182
+ }
1183
+
1180
1184
fn report_lit_error ( & self , err : LitError , lit : token:: Lit , span : Span ) {
1181
1185
// Checks if `s` looks like i32 or u1234 etc.
1182
1186
fn looks_like_width_suffix ( first_chars : & [ char ] , s : & str ) -> bool {
You can’t perform that action at this time.
0 commit comments