File tree 1 file changed +17
-11
lines changed
compiler/rustc_parse/src/parser
1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -340,21 +340,27 @@ impl<'a> Parser<'a> {
340
340
let _ = self . parse_generics ( ) . map ( |generic| {
341
341
// at this point, token should be Ident with the fn name
342
342
343
- // FIXME: shreys the span should be the span of where the gneeric SHOULD go.
344
343
// FIXME: shreys what does this look like with invalid generic
345
344
// FIXME: shreys - what to do if no snippet? probably just HELP not suggestion
346
-
347
- let snippet = match self . sess . source_map ( ) . span_to_snippet ( generic. span ) {
348
- Ok ( snippet) => snippet,
349
- _ => "" . to_string ( ) ,
345
+ debug ! ( ?generic. span) ;
346
+
347
+ match self . sess . source_map ( ) . span_to_snippet ( generic. span ) {
348
+ Ok ( _snippet) => match self . sess . source_map ( ) . span_to_snippet ( self . token . span ) {
349
+ Ok ( ident) => {
350
+ err. span_suggestion (
351
+ generic. span . to ( self . token . span ) ,
352
+ "help: place the generic parameter list after the function name:" ,
353
+ format ! ( " {ident}{_snippet}" ) ,
354
+ Applicability :: MachineApplicable ,
355
+ ) ;
356
+ }
357
+ Err ( _) => todo ! ( ) //FIXME: shreys - what to do here?
358
+ }
359
+ Err ( _) => todo ! ( ) , //FIXME: shreys - what to do here?
360
+
350
361
} ;
351
362
352
- err. span_suggestion (
353
- self . token . span . to ( generic. span . shrink_to_hi ( ) ) ,
354
- "help: place the generic parameter list after the function name:" ,
355
- snippet,
356
- Applicability :: MachineApplicable ,
357
- ) ;
363
+
358
364
} ) ;
359
365
}
360
366
You can’t perform that action at this time.
0 commit comments