Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 4 pull requests #98047

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
.span_suggestion(
e.span,
"consider removing the trailing pattern",
String::new(),
"",
rustc_errors::Applicability::MachineApplicable,
)
.emit();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
.span_suggestion_verbose(
sp,
&format!("if you don't need to use the contents of {}, discard the tuple's remaining fields", ident),
"..".to_string(),
"..",
Applicability::MaybeIncorrect,
)
.emit();
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion(
replace_span,
&format!("provide a definition for the {}", ctx),
sugg.to_string(),
sugg,
Applicability::HasPlaceholders,
)
.emit();
Expand Down Expand Up @@ -522,7 +522,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion(
span,
&format!("remove the {}", remove_descr),
String::new(),
"",
Applicability::MaybeIncorrect,
)
.span_label(self.current_extern_span(), "`extern` block begins here")
Expand Down Expand Up @@ -570,7 +570,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion(
body.span,
"remove the invalid body",
";".to_string(),
";",
Applicability::MaybeIncorrect,
)
.help(
Expand Down Expand Up @@ -599,7 +599,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion_verbose(
span.until(ident.span.shrink_to_lo()),
"remove the qualifiers",
"fn ".to_string(),
"fn ",
Applicability::MaybeIncorrect,
)
.emit();
Expand Down Expand Up @@ -703,7 +703,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion(
generics.span,
"remove the parameters",
String::new(),
"",
Applicability::MachineApplicable,
)
.emit();
Expand All @@ -721,7 +721,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion(
span,
"remove the super traits or lifetime bounds",
String::new(),
"",
Applicability::MachineApplicable,
)
.emit();
Expand Down Expand Up @@ -753,7 +753,7 @@ impl<'a> AstValidator<'a> {
.span_suggestion(
total_span,
"remove these associated items",
String::new(),
"",
Applicability::MachineApplicable,
)
.span_label(ident_span, "auto trait cannot have associated items")
Expand Down Expand Up @@ -993,7 +993,7 @@ fn validate_generic_param_order(
err.span_suggestion(
span,
"reorder the parameters: lifetimes, then consts and types",
ordered_params.clone(),
&ordered_params,
Applicability::MachineApplicable,
);
err.emit();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ fn maybe_stage_features(sess: &Session, krate: &ast::Crate) {
err.span_suggestion(
attr.span,
"remove the attribute",
String::new(),
"",
Applicability::MachineApplicable,
);
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) {
err.span_suggestion(
span,
"consider removing the prefix",
lint_str[1..].to_string(),
&lint_str[1..],
Applicability::MaybeIncorrect,
);
}
Expand Down Expand Up @@ -942,7 +942,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
err.span_suggestion(
item.span(),
"supply an argument here",
"align(...)".to_string(),
"align(...)",
Applicability::HasPlaceholders,
);
err.emit();
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
.map(|n| format!("`{}`", n))
.unwrap_or_else(|| "the value".to_string())
),
"ref ".to_string(),
"ref ",
Applicability::MachineApplicable,
);
in_pattern = true;
Expand Down Expand Up @@ -276,7 +276,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
.map(|n| format!("`{}`", n))
.unwrap_or_else(|| "the mutable reference".to_string()),
),
"&mut *".to_string(),
"&mut *",
Applicability::MachineApplicable,
);
}
Expand Down Expand Up @@ -1519,15 +1519,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
Ok(string) => {
if string.starts_with("async ") {
let pos = args_span.lo() + BytePos(6);
(args_span.with_lo(pos).with_hi(pos), "move ".to_string())
(args_span.with_lo(pos).with_hi(pos), "move ")
} else if string.starts_with("async|") {
let pos = args_span.lo() + BytePos(5);
(args_span.with_lo(pos).with_hi(pos), " move".to_string())
(args_span.with_lo(pos).with_hi(pos), " move")
} else {
(args_span.shrink_to_lo(), "move ".to_string())
(args_span.shrink_to_lo(), "move ")
}
}
Err(_) => (args_span, "move |<args>| <body>".to_string()),
Err(_) => (args_span, "move |<args>| <body>"),
};
let kind = match use_span.generator_kind() {
Some(generator_kind) => match generator_kind {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
"consider adding semicolon after the expression so its \
temporaries are dropped sooner, before the local variables \
declared by the block are dropped",
";".to_string(),
";",
Applicability::MaybeIncorrect,
);
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
avoid moving into the `for` loop",
ty,
),
"&".to_string(),
"&",
Applicability::MaybeIncorrect,
);
}
Expand All @@ -1049,7 +1049,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
.map(|n| format!("`{}`", n))
.unwrap_or_else(|| "the mutable reference".to_string()),
),
"&mut *".to_string(),
"&mut *",
Applicability::MachineApplicable,
);
}
Expand All @@ -1067,7 +1067,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
err.span_suggestion_verbose(
fn_call_span.shrink_to_lo(),
"consider calling `.as_ref()` to borrow the type's contents",
"as_ref().".to_string(),
"as_ref().",
Applicability::MachineApplicable,
);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion_verbose(
span.shrink_to_hi(),
&format!("consider borrowing the `{}`'s content", diag_name.unwrap()),
".as_ref()".to_string(),
".as_ref()",
Applicability::MaybeIncorrect,
);
} else if let Some(use_spans) = use_spans {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion_verbose(
source_info.span.with_hi(source_info.span.lo() + BytePos(5)),
"try removing `&mut` here",
String::new(),
"",
Applicability::MachineApplicable,
);
} else {
Expand All @@ -316,7 +316,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion_verbose(
decl.source_info.span.shrink_to_lo(),
"consider making the binding mutable",
"mut ".to_string(),
"mut ",
Applicability::MachineApplicable,
);
}
Expand Down Expand Up @@ -402,7 +402,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion(
span,
"try removing `&mut` here",
String::new(),
"",
Applicability::MaybeIncorrect,
);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion_verbose(
span.shrink_to_hi(),
"consider relaxing the implicit `'static` requirement",
" + '_".to_string(),
" + '_",
Applicability::MaybeIncorrect,
);
suggested = true;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ fn do_mir_borrowck<'a, 'tcx>(
.span_suggestion_short(
mut_span,
"remove this `mut`",
String::new(),
"",
Applicability::MachineApplicable,
)
.emit();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
err.tool_only_span_suggestion(
full_span,
"remove this option",
String::new(),
"",
Applicability::MachineApplicable,
);

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes
err.span_suggestion(
parser.token.span,
"try removing semicolon",
String::new(),
"",
Applicability::MaybeIncorrect,
);
err.emit();
Expand All @@ -153,7 +153,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes
err.span_suggestion_short(
comma_span,
"try adding a comma",
", ".to_string(),
", ",
Applicability::MaybeIncorrect,
);
err.emit();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn report_path_args(sess: &Session, meta: &ast::MetaItem) {
let report_error = |title, action| {
let span = meta.span.with_lo(meta.path.span.hi());
sess.struct_span_err(span, title)
.span_suggestion(span, action, String::new(), Applicability::MachineApplicable)
.span_suggestion(span, action, "", Applicability::MachineApplicable)
.emit();
};
match meta.kind {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ impl<'a, 'b> Context<'a, 'b> {
err.tool_only_span_suggestion(
sp,
&format!("use the `{}` trait", name),
(*fmt).to_string(),
*fmt,
Applicability::MaybeIncorrect,
);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn expand_test_or_bench(
};
err.span_label(attr_sp, "the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions")
.span_label(item.span, format!("expected a non-associated function, found {} {}", item.kind.article(), item.kind.descr()))
.span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", String::from("#[cfg(test)]"), Applicability::MaybeIncorrect)
.span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", "#[cfg(test)]", Applicability::MaybeIncorrect)
.emit();

return vec![Annotatable::Item(item)];
Expand Down
Loading