File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/librustc_parse/parser Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -383,10 +383,7 @@ impl<'a> Parser<'a> {
383
383
let is_negative = self . eat ( & token:: Not ) ;
384
384
let question = if self . eat ( & token:: Question ) { Some ( self . prev_span ) } else { None } ;
385
385
if self . token . is_lifetime ( ) {
386
- if let Some ( question_span) = question {
387
- self . span_err ( question_span,
388
- "`?` may only modify trait bounds, not lifetime bounds" ) ;
389
- }
386
+ self . error_opt_out_lifetime ( question) ;
390
387
bounds. push ( GenericBound :: Outlives ( self . expect_lifetime ( ) ) ) ;
391
388
if has_parens {
392
389
let inner_span = inner_lo. to ( self . prev_span ) ;
@@ -473,6 +470,13 @@ impl<'a> Parser<'a> {
473
470
return Ok ( bounds) ;
474
471
}
475
472
473
+ fn error_opt_out_lifetime ( & self , question : Option < Span > ) {
474
+ if let Some ( span) = question {
475
+ self . struct_span_err ( span, "`?` may only modify trait bounds, not lifetime bounds" )
476
+ . emit ( ) ;
477
+ }
478
+ }
479
+
476
480
pub ( super ) fn parse_late_bound_lifetime_defs ( & mut self ) -> PResult < ' a , Vec < GenericParam > > {
477
481
if self . eat_keyword ( kw:: For ) {
478
482
self . expect_lt ( ) ?;
You can’t perform that action at this time.
0 commit comments