@@ -363,8 +363,12 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
363
363
/// in trans that run after the main lint pass is finished. Most
364
364
/// lints elsewhere in the compiler should call
365
365
/// `Session::add_lint()` instead.
366
- pub fn raw_emit_lint ( sess : & Session , lint : & ' static Lint ,
367
- lvlsrc : LevelSource , span : Option < Span > , msg : & str ) {
366
+ pub fn raw_emit_lint ( sess : & Session ,
367
+ lints : & LintStore ,
368
+ lint : & ' static Lint ,
369
+ lvlsrc : LevelSource ,
370
+ span : Option < Span > ,
371
+ msg : & str ) {
368
372
let ( mut level, source) = lvlsrc;
369
373
if level == Allow { return }
370
374
@@ -399,6 +403,18 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
399
403
_ => sess. bug ( "impossible level in raw_emit_lint" ) ,
400
404
}
401
405
406
+ // Check for future incompatibility lints and issue a stronger warning.
407
+ let future_incompat_lints = & lints. lint_groups [ builtin:: FUTURE_INCOMPATIBLE ] ;
408
+ let this_id = LintId :: of ( lint) ;
409
+ if future_incompat_lints. 0 . iter ( ) . any ( |& id| id == this_id) {
410
+ let msg = "this lint will become a HARD ERROR in a future release!" ;
411
+ if let Some ( sp) = span {
412
+ sess. span_note ( sp, msg) ;
413
+ } else {
414
+ sess. note ( msg) ;
415
+ }
416
+ }
417
+
402
418
if let Some ( span) = def {
403
419
sess. span_note ( span, "lint level defined here" ) ;
404
420
}
@@ -428,7 +444,7 @@ pub trait LintContext: Sized {
428
444
Some ( & pair) => pair,
429
445
} ;
430
446
431
- raw_emit_lint ( & self . sess ( ) , lint, ( level, src) , span, msg) ;
447
+ raw_emit_lint ( & self . sess ( ) , self . lints ( ) , lint, ( level, src) , span, msg) ;
432
448
}
433
449
434
450
/// Emit a lint at the appropriate level, for a particular span.
0 commit comments