@@ -45,7 +45,7 @@ use rustc_data_structures::sync::Lrc;
45
45
use std:: hash:: { Hash , Hasher } ;
46
46
use syntax:: ast;
47
47
use syntax_pos:: { MultiSpan , Span } ;
48
- use errors:: { Applicability , DiagnosticBuilder , DiagnosticId } ;
48
+ use errors:: { Applicability , DiagnosticBuilder , DiagnosticId , Applicability } ;
49
49
50
50
use rustc:: hir;
51
51
use rustc:: hir:: intravisit:: { self , Visitor } ;
@@ -867,10 +867,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
867
867
} ) = cmt. cat {
868
868
db. note ( fn_closure_msg) ;
869
869
} else {
870
- db. span_suggestion ( sp, msg, suggestion) ;
870
+ db. span_suggestion_with_applicability (
871
+ sp, msg, suggestion, Applicability :: Unspecified ) ;
871
872
}
872
873
} else {
873
- db. span_suggestion ( sp, msg, suggestion) ;
874
+ db. span_suggestion_with_applicability (
875
+ sp, msg, suggestion, Applicability :: Unspecified ) ;
874
876
}
875
877
}
876
878
_ => {
@@ -1236,10 +1238,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1236
1238
let let_span = self . tcx . hir . span ( node_id) ;
1237
1239
let suggestion = suggest_ref_mut ( self . tcx , let_span) ;
1238
1240
if let Some ( replace_str) = suggestion {
1239
- db. span_suggestion (
1241
+ db. span_suggestion_with_applicability (
1240
1242
let_span,
1241
1243
"use a mutable reference instead" ,
1242
1244
replace_str,
1245
+ Applicability :: Unspecified ,
1243
1246
) ;
1244
1247
}
1245
1248
}
@@ -1292,11 +1295,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1292
1295
) ) = ty. map ( |t| & t. node )
1293
1296
{
1294
1297
let borrow_expr_id = self . tcx . hir . get_parent_node ( borrowed_node_id) ;
1295
- db. span_suggestion (
1298
+ db. span_suggestion_with_applicability (
1296
1299
self . tcx . hir . span ( borrow_expr_id) ,
1297
1300
"consider removing the `&mut`, as it is an \
1298
1301
immutable binding to a mutable reference",
1299
- snippet
1302
+ snippet,
1303
+ Applicability :: Unspecified ,
1300
1304
) ;
1301
1305
} else {
1302
1306
db. span_suggestion_with_applicability (
@@ -1326,12 +1330,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1326
1330
& cmt_path_or_string,
1327
1331
capture_span,
1328
1332
Origin :: Ast )
1329
- . span_suggestion ( err. span ,
1333
+ . span_suggestion_with_applicability ( err. span ,
1330
1334
& format ! ( "to force the closure to take ownership of {} \
1331
1335
(and any other referenced variables), \
1332
1336
use the `move` keyword",
1333
1337
cmt_path_or_string) ,
1334
- suggestion)
1338
+ suggestion,
1339
+ Applicability :: Unspecified ,
1340
+ )
1335
1341
. emit ( ) ;
1336
1342
self . signal_error ( ) ;
1337
1343
}
0 commit comments