@@ -84,7 +84,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WhileTrue {
8484 let msg = "denote infinite loops with `loop { ... }`" ;
8585 let condition_span = cx. tcx . sess . codemap ( ) . def_span ( e. span ) ;
8686 let mut err = cx. struct_span_lint ( WHILE_TRUE , condition_span, msg) ;
87- err. span_suggestion_short ( condition_span, "use `loop`" , "loop" . to_owned ( ) ) ;
87+ err. span_suggestion_short_with_applicability (
88+ condition_span,
89+ "use `loop`" ,
90+ "loop" . to_owned ( ) ,
91+ Applicability :: MachineApplicable
92+ ) ;
8893 err. emit ( ) ;
8994 }
9095 }
@@ -191,7 +196,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
191196 fieldpat. span ,
192197 & format ! ( "the `{}:` in this pattern is redundant" , ident) ) ;
193198 let subspan = cx. tcx . sess . codemap ( ) . span_through_char ( fieldpat. span , ':' ) ;
194- err. span_suggestion_short ( subspan, "remove this" , ident. to_string ( ) ) ;
199+ err. span_suggestion_short_with_applicability (
200+ subspan,
201+ "remove this" ,
202+ ident. to_string ( ) ,
203+ Applicability :: MachineApplicable
204+ ) ;
195205 err. emit ( ) ;
196206 }
197207 }
@@ -708,10 +718,11 @@ impl EarlyLintPass for BadRepr {
708718 | "i8" | "i16" | "i32" | "i64" | "i128" | "isize" => {
709719 // if the literal could have been a valid `repr` arg,
710720 // suggest the correct syntax
711- warn. span_suggestion (
721+ warn. span_suggestion_with_applicability (
712722 attr. span ,
713723 "give `repr` a hint" ,
714724 repr_str ( & lit. as_str ( ) ) ,
725+ Applicability :: MachineApplicable
715726 ) ;
716727 suggested = true ;
717728 }
@@ -779,7 +790,12 @@ impl EarlyLintPass for DeprecatedAttr {
779790 let msg = format ! ( "use of deprecated attribute `{}`: {}. See {}" ,
780791 name, reason, link) ;
781792 let mut err = cx. struct_span_lint ( DEPRECATED , attr. span , & msg) ;
782- err. span_suggestion_short ( attr. span , "remove this attribute" , "" . to_owned ( ) ) ;
793+ err. span_suggestion_short_with_applicability (
794+ attr. span ,
795+ "remove this attribute" ,
796+ "" . to_owned ( ) ,
797+ Applicability :: MachineApplicable
798+ ) ;
783799 err. emit ( ) ;
784800 }
785801 return ;
@@ -1201,7 +1217,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
12011217 }
12021218 } ;
12031219 if let Some ( replacement) = suggestion {
1204- err. span_suggestion ( vis. span , "try making it public" , replacement) ;
1220+ err. span_suggestion_with_applicability (
1221+ vis. span ,
1222+ "try making it public" ,
1223+ replacement,
1224+ Applicability :: MachineApplicable
1225+ ) ;
12051226 }
12061227 } ;
12071228
@@ -1225,9 +1246,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
12251246 it. span ,
12261247 "functions generic over \
12271248 types must be mangled") ;
1228- err. span_suggestion_short ( no_mangle_attr. span ,
1229- "remove this attribute" ,
1230- "" . to_owned ( ) ) ;
1249+ err. span_suggestion_short_with_applicability (
1250+ no_mangle_attr. span ,
1251+ "remove this attribute" ,
1252+ "" . to_owned ( ) ,
1253+ // Use of `#[no_mangle]` suggests FFI intent; correct
1254+ // fix may be to monomorphize source by hand
1255+ Applicability :: MaybeIncorrect
1256+ ) ;
12311257 err. emit ( ) ;
12321258 break ;
12331259 }
@@ -1257,9 +1283,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
12571283 . unwrap_or ( 0 ) as u32 ;
12581284 // `const` is 5 chars
12591285 let const_span = it. span . with_hi ( BytePos ( it. span . lo ( ) . 0 + start + 5 ) ) ;
1260- err. span_suggestion ( const_span,
1261- "try a static value" ,
1262- "pub static" . to_owned ( ) ) ;
1286+ err. span_suggestion_with_applicability (
1287+ const_span,
1288+ "try a static value" ,
1289+ "pub static" . to_owned ( ) ,
1290+ Applicability :: MachineApplicable
1291+ ) ;
12631292 err. emit ( ) ;
12641293 }
12651294 }
0 commit comments