@@ -364,14 +364,16 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
364364/// lints elsewhere in the compiler should call
365365/// `Session::add_lint()` instead.
366366pub fn raw_emit_lint ( sess : & Session ,
367+ lints : & LintStore ,
367368 lint : & ' static Lint ,
368369 lvlsrc : LevelSource ,
369370 span : Option < Span > ,
370371 msg : & str ) {
371- raw_struct_lint ( sess, lint, lvlsrc, span, msg) . emit ( ) ;
372+ raw_struct_lint ( sess, lints , lint, lvlsrc, span, msg) . emit ( ) ;
372373}
373374
374375pub fn raw_struct_lint < ' a > ( sess : & ' a Session ,
376+ lints : & LintStore ,
375377 lint : & ' static Lint ,
376378 lvlsrc : LevelSource ,
377379 span : Option < Span > ,
@@ -413,6 +415,18 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
413415 _ => sess. bug ( "impossible level in raw_emit_lint" ) ,
414416 } ;
415417
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+
416430 if let Some ( span) = def {
417431 err. span_note ( span, "lint level defined here" ) ;
418432 }
@@ -450,7 +464,7 @@ pub trait LintContext: Sized {
450464 Some ( pair) => pair,
451465 } ;
452466
453- raw_emit_lint ( & self . sess ( ) , lint, ( level, src) , span, msg) ;
467+ raw_emit_lint ( & self . sess ( ) , self . lints ( ) , lint, ( level, src) , span, msg) ;
454468 }
455469
456470 fn lookup ( & self ,
@@ -463,7 +477,7 @@ pub trait LintContext: Sized {
463477 Some ( pair) => pair,
464478 } ;
465479
466- raw_struct_lint ( & self . sess ( ) , lint, ( level, src) , span, msg)
480+ raw_struct_lint ( & self . sess ( ) , self . lints ( ) , lint, ( level, src) , span, msg)
467481 }
468482
469483 /// Emit a lint at the appropriate level, for a particular span.
0 commit comments