diff options
| -rw-r--r-- | src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs | 6 | ||||
| -rw-r--r-- | src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs | 4 | ||||
| -rw-r--r-- | src/librustc/session/mod.rs | 7 | ||||
| -rw-r--r-- | src/librustc_borrowck/borrowck/mod.rs | 22 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/move_errors.rs | 13 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mutability_errors.rs | 10 | ||||
| -rw-r--r-- | src/librustc_passes/ast_validation.rs | 3 | ||||
| -rw-r--r-- | src/librustc_passes/loops.rs | 7 | ||||
| -rw-r--r-- | src/librustc_resolve/lib.rs | 9 | ||||
| -rw-r--r-- | src/librustc_typeck/check/cast.rs | 20 | ||||
| -rw-r--r-- | src/librustc_typeck/check/compare_method.rs | 4 | ||||
| -rw-r--r-- | src/librustc_typeck/check/method/probe.rs | 3 | ||||
| -rw-r--r-- | src/librustc_typeck/check/method/suggest.rs | 12 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 12 | ||||
| -rw-r--r-- | src/librustc_typeck/check/op.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/config.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 |
18 files changed, 107 insertions, 50 deletions
diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 4e26a4178b9..05af9cffd45 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -13,6 +13,7 @@ use infer::error_reporting::nice_region_error::NiceRegionError; use ty; use util::common::ErrorReported; +use errors::Applicability; impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { /// When given a `ConcreteFailure` for a function with arguments containing a named region and @@ -111,10 +112,11 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { E0621, "explicit lifetime required in {}", error_var - ).span_suggestion( + ).span_suggestion_with_applicability( new_ty_span, &format!("add explicit lifetime `{}` to {}", named, span_label_var), - new_ty.to_string() + new_ty.to_string(), + Applicability::Unspecified, ) .span_label(span, format!("lifetime `{}` required", named)) .emit(); diff --git a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs index d25dcd5b045..722c699ec59 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -14,6 +14,7 @@ use infer::error_reporting::nice_region_error::NiceRegionError; use infer::lexical_region_resolve::RegionResolutionError; use ty::{BoundRegion, FreeRegion, RegionKind}; use util::common::ErrorReported; +use errors::Applicability; impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { /// Print the error message for lifetime errors when the return type is a static impl Trait. @@ -61,7 +62,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { _ => "'_".to_owned(), }; if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(return_sp) { - err.span_suggestion( + err.span_suggestion_with_applicability( return_sp, &format!( "you can add a constraint to the return type to make it last \ @@ -69,6 +70,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { lifetime, ), format!("{} + {}", snippet, lifetime_name), + Applicability::Unspecified, ); } err.emit(); diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 619262abb0b..013cba5a332 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -28,7 +28,7 @@ use rustc_data_structures::base_n; use rustc_data_structures::sync::{self, Lrc, Lock, LockCell, OneThread, Once, RwLock}; use syntax::ast::NodeId; -use errors::{self, DiagnosticBuilder, DiagnosticId}; +use errors::{self, DiagnosticBuilder, DiagnosticId, Applicability}; use errors::emitter::{Emitter, EmitterWriter}; use syntax::edition::Edition; use syntax::json::JsonEmitter; @@ -431,8 +431,9 @@ impl Session { diag_builder.span_note(span, message); } DiagnosticBuilderMethod::SpanSuggestion(suggestion) => { - let span = span_maybe.expect("span_suggestion needs a span"); - diag_builder.span_suggestion(span, message, suggestion); + let span = span_maybe.expect("span_suggestion_* needs a span"); + diag_builder.span_suggestion_with_applicability(span, message, suggestion, + Applicability::Unspecified); } } } diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 828364734f4..0f07e1415bf 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -45,7 +45,7 @@ use rustc_data_structures::sync::Lrc; use std::hash::{Hash, Hasher}; use syntax::ast; use syntax_pos::{MultiSpan, Span}; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, Applicability}; use rustc::hir; use rustc::hir::intravisit::{self, Visitor}; @@ -867,10 +867,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { }) = cmt.cat { db.note(fn_closure_msg); } else { - db.span_suggestion(sp, msg, suggestion); + db.span_suggestion_with_applicability( + sp, msg, suggestion, Applicability::Unspecified); } } else { - db.span_suggestion(sp, msg, suggestion); + db.span_suggestion_with_applicability( + sp, msg, suggestion, Applicability::Unspecified); } } _ => { @@ -1236,10 +1238,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { let let_span = self.tcx.hir.span(node_id); let suggestion = suggest_ref_mut(self.tcx, let_span); if let Some(replace_str) = suggestion { - db.span_suggestion( + db.span_suggestion_with_applicability( let_span, "use a mutable reference instead", replace_str, + Applicability::Unspecified, ); } } @@ -1292,11 +1295,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { )) = ty.map(|t| &t.node) { let borrow_expr_id = self.tcx.hir.get_parent_node(borrowed_node_id); - db.span_suggestion( + db.span_suggestion_with_applicability( self.tcx.hir.span(borrow_expr_id), "consider removing the `&mut`, as it is an \ immutable binding to a mutable reference", - snippet + snippet, + Applicability::Unspecified, ); } else { db.span_suggestion_with_applicability( @@ -1326,12 +1330,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { &cmt_path_or_string, capture_span, Origin::Ast) - .span_suggestion(err.span, + .span_suggestion_with_applicability(err.span, &format!("to force the closure to take ownership of {} \ (and any other referenced variables), \ use the `move` keyword", cmt_path_or_string), - suggestion) + suggestion, + Applicability::Unspecified, + ) .emit(); self.signal_error(); } diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index 290c7032388..5bba05a7b21 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -11,7 +11,7 @@ use core::unicode::property::Pattern_White_Space; use rustc::mir::*; use rustc::ty; -use rustc_errors::DiagnosticBuilder; +use rustc_errors::{DiagnosticBuilder,Applicability}; use syntax_pos::Span; use borrow_check::MirBorrowckCtxt; @@ -350,16 +350,18 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // expressions `a[b]`, which roughly desugar to // `*Index::index(&a, b)` or // `*IndexMut::index_mut(&mut a, b)`. - err.span_suggestion( + err.span_suggestion_with_applicability( span, "consider removing the `*`", snippet[1..].to_owned(), + Applicability::Unspecified, ); } else { - err.span_suggestion( + err.span_suggestion_with_applicability( span, "consider borrowing here", format!("&{}", snippet), + Applicability::Unspecified, ); } @@ -420,10 +422,11 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { suggestions.sort_unstable_by_key(|&(span, _, _)| span); suggestions.dedup_by_key(|&mut (span, _, _)| span); for (span, to_remove, suggestion) in suggestions { - err.span_suggestion( + err.span_suggestion_with_applicability( span, &format!("consider removing the `{}`", to_remove), - suggestion + suggestion, + Applicability::Unspecified, ); } } diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 78ab772d9ad..8a31d7c91b9 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -22,6 +22,7 @@ use borrow_check::MirBorrowckCtxt; use util::borrowck_errors::{BorrowckErrors, Origin}; use util::collect_writes::FindAssignments; use util::suggest_ref_mut; +use rustc_errors::Applicability; #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub(super) enum AccessKind { @@ -227,10 +228,11 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { assert_eq!(local_decl.mutability, Mutability::Not); err.span_label(span, format!("cannot {ACT}", ACT = act)); - err.span_suggestion( + err.span_suggestion_with_applicability( local_decl.source_info.span, "consider changing this to be mutable", format!("mut {}", local_decl.name.unwrap()), + Applicability::Unspecified, ); } @@ -257,10 +259,11 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { _, ) = pat.node { - err.span_suggestion( + err.span_suggestion_with_applicability( upvar_ident.span, "consider changing this to be mutable", format!("mut {}", upvar_ident.name), + Applicability::Unspecified, ); } } @@ -351,10 +354,11 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { }; if let Some((err_help_span, suggested_code)) = suggestion { - err.span_suggestion( + err.span_suggestion_with_applicability( err_help_span, &format!("consider changing this to be a mutable {}", pointer_desc), suggested_code, + Applicability::Unspecified, ); } diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 2ee5415018f..9e97b297f30 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -182,8 +182,9 @@ impl<'a> AstValidator<'a> { ); if let Ok(snippet) = self.session.source_map().span_to_snippet(span) { - err.span_suggestion( + err.span_suggestion_with_applicability( span, "consider adding parentheses", format!("({})", snippet), + Applicability::Unspecified, ); } diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 61c2ac161bb..5cbdae60c26 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -16,6 +16,7 @@ use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::{self, Node, Destination}; use syntax::ast; use syntax_pos::Span; +use errors::Applicability; #[derive(Clone, Copy, Debug, PartialEq)] enum LoopKind { @@ -140,11 +141,13 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { .span_label(e.span, "can only break with a value inside \ `loop` or breakable block") - .span_suggestion(e.span, + .span_suggestion_with_applicability(e.span, &format!("instead, use `break` on its own \ without a value inside this `{}` loop", kind.name()), - "break".to_string()) + "break".to_string(), + Applicability::Unspecified, + ) .emit(); } } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 10dddfed6a5..48972ff386c 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3299,9 +3299,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { err.span_label(base_span, "expecting a type here because of type ascription"); if line_sp != line_base_sp { - err.span_suggestion_short(sp, + err.span_suggestion_short_with_applicability(sp, "did you mean to use `;` here instead?", - ";".to_string()); + ";".to_string(), + Applicability::Unspecified, + ); } break; } else if snippet.trim().len() != 0 { @@ -4826,7 +4828,8 @@ fn show_candidates(err: &mut DiagnosticBuilder, *candidate = format!("use {};\n{}", candidate, additional_newline); } - err.span_suggestions(span, &msg, path_strings); + err.span_suggestions_with_applicability(span, &msg, path_strings, + Applicability::Unspecified); } else { let mut msg = msg; msg.push(':'); diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index ebe0c279aaf..5d9802839eb 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -40,7 +40,7 @@ use super::FnCtxt; -use errors::DiagnosticBuilder; +use errors::{DiagnosticBuilder,Applicability}; use hir::def_id::DefId; use lint; use rustc::hir; @@ -299,9 +299,11 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { err.note("The type information given here is insufficient to check whether \ the pointer cast is valid"); if unknown_cast_to { - err.span_suggestion_short(self.cast_span, + err.span_suggestion_short_with_applicability(self.cast_span, "consider giving more type information", - String::new()); + String::new(), + Applicability::Unspecified, + ); } err.emit(); } @@ -327,9 +329,11 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { if self.cast_ty.is_trait() { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { Ok(s) => { - err.span_suggestion(self.cast_span, + err.span_suggestion_with_applicability(self.cast_span, "try casting to a reference instead", - format!("&{}{}", mtstr, s)); + format!("&{}{}", mtstr, s), + Applicability::Unspecified, + ); } Err(_) => { span_help!(err, self.cast_span, "did you mean `&{}{}`?", mtstr, tstr) @@ -346,9 +350,11 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { ty::Adt(def, ..) if def.is_box() => { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { Ok(s) => { - err.span_suggestion(self.cast_span, + err.span_suggestion_with_applicability(self.cast_span, "try casting to a `Box` instead", - format!("Box<{}>", s)); + format!("Box<{}>", s), + Applicability::Unspecified, + ); } Err(_) => span_help!(err, self.cast_span, "did you mean `Box<{}>`?", tstr), } diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 9aa2ba363ed..2c3abb47cff 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -16,6 +16,7 @@ use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use rustc::ty::error::{ExpectedFound, TypeError}; use rustc::ty::subst::{Subst, Substs}; use rustc::util::common::ErrorReported; +use errors::Applicability; use syntax_pos::Span; @@ -321,10 +322,11 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(trait_err_span) = trait_err_span { if let Ok(trait_err_str) = tcx.sess.source_map(). span_to_snippet(trait_err_span) { - diag.span_suggestion( + diag.span_suggestion_with_applicability( impl_err_span, "consider change the type to match the mutability in trait", format!("{}", trait_err_str), + Applicability::Unspecified, ); } } diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 85a437283fa..499daccf5e8 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -1064,7 +1064,8 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { "a method with this name may be added to the standard library in the future", ); - // FIXME: This should be a `span_suggestion` instead of `help`. However `self.span` only + // FIXME: This should be a `span_suggestion_with_applicability` instead of `help` + // However `self.span` only // highlights the method name, so we can't use it. Also consider reusing the code from // `report_method_error()`. diag.help(&format!( diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index abc32ed2ea0..453a7e1e72f 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -251,13 +251,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let snippet = tcx.sess.source_map().span_to_snippet(lit.span) .unwrap_or("<numeric literal>".to_string()); - err.span_suggestion(lit.span, + err.span_suggestion_with_applicability(lit.span, &format!("you must specify a concrete type for \ this numeric value, like `{}`", concrete_type), format!("{}_{}", snippet, - concrete_type)); + concrete_type), + Applicability::Unspecified, + ); } hir::ExprKind::Path(ref qpath) => { // local binding if let &hir::QPath::Resolved(_, ref path) = &qpath { @@ -281,13 +283,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty, .. })) => { - err.span_suggestion( + err.span_suggestion_with_applicability( // account for `let x: _ = 42;` // ^^^^ span.to(ty.as_ref().map(|ty| ty.span) .unwrap_or(span)), &msg, format!("{}: {}", snippet, concrete_type), + Applicability::Unspecified, ); } _ => { @@ -516,7 +519,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { format!("use {};\n{}", self.tcx.item_path_str(*did), additional_newline) }).collect(); - err.span_suggestions(span, &msg, path_strings); + err.span_suggestions_with_applicability(span, &msg, path_strings, + Applicability::Unspecified); } else { let limit = if candidates.len() == 5 { 5 } else { 4 }; for (i, trait_did) in candidates.iter().take(limit).enumerate() { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index aa27fe528e1..3b1f81a9eba 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3348,7 +3348,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let base = self.tcx.hir.node_to_pretty_string(base.id); let msg = format!("`{}` is a native pointer; try dereferencing it", base); let suggestion = format!("(*{}).{}", base, field); - err.span_suggestion(field.span, &msg, suggestion); + err.span_suggestion_with_applicability(field.span, &msg, suggestion, + Applicability::Unspecified); } _ => {} } @@ -4716,7 +4717,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { found: Ty<'tcx>, ) { if let Some((sp, msg, suggestion)) = self.check_ref(expr, found, expected) { - err.span_suggestion(sp, msg, suggestion); + err.span_suggestion_with_applicability(sp, msg, suggestion, + Applicability::Unspecified); } else if !self.check_for_cast(err, expr, found, expected) { let methods = self.get_conversion_methods(expr.span, expected, found); if let Ok(expr_text) = self.sess().source_map().span_to_snippet(expr.span) { @@ -4746,7 +4748,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }) .collect::<Vec<_>>(); if !suggestions.is_empty() { - err.span_suggestions(expr.span, "try using a conversion method", suggestions); + err.span_suggestions_with_applicability(expr.span, + "try using a conversion method", + suggestions, + Applicability::Unspecified, + ); } } } diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index 5004880ce47..a678981cf01 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -16,7 +16,7 @@ use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::TyKind::{Ref, Adt, Str, Uint, Never, Tuple, Char, Array}; use rustc::ty::adjustment::{Adjustment, Adjust, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::infer::type_variable::TypeVariableOrigin; -use errors; +use errors::{self,Applicability}; use syntax_pos::Span; use syntax::ast::Ident; use rustc::hir; @@ -444,9 +444,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { err.span_label(expr.span, "`+` can't be used to concatenate two `&str` strings"); match source_map.span_to_snippet(lhs_expr.span) { - Ok(lstring) => err.span_suggestion(lhs_expr.span, + Ok(lstring) => err.span_suggestion_with_applicability(lhs_expr.span, msg, - format!("{}.to_owned()", lstring)), + format!("{}.to_owned()", lstring), + Applicability::Unspecified, + ), _ => err.help(msg), }; } diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 63b70b12248..c3917488b98 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -16,6 +16,7 @@ use source_map::Spanned; use edition::Edition; use parse::{token, ParseSess}; use OneVector; +use errors::Applicability; use ptr::P; @@ -123,7 +124,11 @@ impl<'a> StripUnconfigured<'a> { let error = |span, msg, suggestion: &str| { let mut err = self.sess.span_diagnostic.struct_span_err(span, msg); if !suggestion.is_empty() { - err.span_suggestion(span, "expected syntax is", suggestion.into()); + err.span_suggestion_with_applicability(span, + "expected syntax is", + suggestion.into(), + Applicability::Unspecified, + ); } err.emit(); true diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 86247745c41..75f46f2e02c 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -32,6 +32,7 @@ use std::borrow::Cow; use std::collections::hash_map::Entry; use rustc_data_structures::sync::Lrc; +use errors::Applicability; pub struct ParserAnyMacro<'a> { parser: Parser<'a>, @@ -187,10 +188,11 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, if comma_span == DUMMY_SP { err.note("you might be missing a comma"); } else { - err.span_suggestion_short( + err.span_suggestion_short_with_applicability( comma_span, "missing comma here", ", ".to_string(), + Applicability::Unspecified, ); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 48e034b117f..458a5c6473f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3882,7 +3882,11 @@ impl<'a> Parser<'a> { if self.token == token::CloseDelim(token::Brace) { // If the struct looks otherwise well formed, recover and continue. if let Some(sp) = comma_sp { - err.span_suggestion_short(sp, "remove this comma", String::new()); + err.span_suggestion_short_with_applicability(sp, + "remove this comma", + String::new(), + Applicability::Unspecified, + ); } err.emit(); break; |
