@@ -364,14 +364,16 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
364
364
/// lints elsewhere in the compiler should call
365
365
/// `Session::add_lint()` instead.
366
366
pub fn raw_emit_lint ( sess : & Session ,
367
+ lints : & LintStore ,
367
368
lint : & ' static Lint ,
368
369
lvlsrc : LevelSource ,
369
370
span : Option < Span > ,
370
371
msg : & str ) {
371
- raw_struct_lint ( sess, lint, lvlsrc, span, msg) . emit ( ) ;
372
+ raw_struct_lint ( sess, lints , lint, lvlsrc, span, msg) . emit ( ) ;
372
373
}
373
374
374
375
pub fn raw_struct_lint < ' a > ( sess : & ' a Session ,
376
+ lints : & LintStore ,
375
377
lint : & ' static Lint ,
376
378
lvlsrc : LevelSource ,
377
379
span : Option < Span > ,
@@ -413,6 +415,18 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
413
415
_ => sess. bug ( "impossible level in raw_emit_lint" ) ,
414
416
} ;
415
417
418
+ // Check for future incompatibility lints and issue a stronger warning.
419
+ let future_incompat_lints = & lints. lint_groups [ builtin:: FUTURE_INCOMPATIBLE ] ;
420
+ let this_id = LintId :: of ( lint) ;
421
+ if future_incompat_lints. 0 . iter ( ) . any ( |& id| id == this_id) {
422
+ let msg = "this lint will become a HARD ERROR in a future release!" ;
423
+ if let Some ( sp) = span {
424
+ err. span_note ( sp, msg) ;
425
+ } else {
426
+ err. note ( msg) ;
427
+ }
428
+ }
429
+
416
430
if let Some ( span) = def {
417
431
err. span_note ( span, "lint level defined here" ) ;
418
432
}
@@ -450,7 +464,7 @@ pub trait LintContext: Sized {
450
464
Some ( pair) => pair,
451
465
} ;
452
466
453
- raw_emit_lint ( & self . sess ( ) , lint, ( level, src) , span, msg) ;
467
+ raw_emit_lint ( & self . sess ( ) , self . lints ( ) , lint, ( level, src) , span, msg) ;
454
468
}
455
469
456
470
fn lookup ( & self ,
@@ -463,7 +477,7 @@ pub trait LintContext: Sized {
463
477
Some ( pair) => pair,
464
478
} ;
465
479
466
- raw_struct_lint ( & self . sess ( ) , lint, ( level, src) , span, msg)
480
+ raw_struct_lint ( & self . sess ( ) , self . lints ( ) , lint, ( level, src) , span, msg)
467
481
}
468
482
469
483
/// Emit a lint at the appropriate level, for a particular span.
0 commit comments