Skip to content

Commit ca122c7

Browse files
committed
Auto merge of rust-lang#98066 - matthiaskrgr:rollup-wb9gs92, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#97709 (Normalize consts' tys when relating with `adt_const_params`) - rust-lang#97875 (Remove the `infer_static_outlives_requirements` feature) - rust-lang#97960 (interpret: unify offset_from check with offset check) - rust-lang#97999 (Make `type_changing_struct_update` no longer an incomplete feature) - rust-lang#98043 (Remove unnecessary `to_string` and `String::new`) - rust-lang#98044 ([issues:97981] del unrelated comment) - rust-lang#98049 (Document an edge case of `str::split_once`) - rust-lang#98050 (Add some more regression tests for rust-lang#67945) - rust-lang#98054 (Fix error message for `download-ci-llvm`) - rust-lang#98057 (Update miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 083721a + af1f614 commit ca122c7

File tree

119 files changed

+614
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+614
-577
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11681168
.span_suggestion(
11691169
e.span,
11701170
"consider removing the trailing pattern",
1171-
String::new(),
1171+
"",
11721172
rustc_errors::Applicability::MachineApplicable,
11731173
)
11741174
.emit();

compiler/rustc_ast_lowering/src/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
139139
.span_suggestion_verbose(
140140
sp,
141141
&format!("if you don't need to use the contents of {}, discard the tuple's remaining fields", ident),
142-
"..".to_string(),
142+
"..",
143143
Applicability::MaybeIncorrect,
144144
)
145145
.emit();

compiler/rustc_ast_passes/src/ast_validation.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ impl<'a> AstValidator<'a> {
488488
.span_suggestion(
489489
replace_span,
490490
&format!("provide a definition for the {}", ctx),
491-
sugg.to_string(),
491+
sugg,
492492
Applicability::HasPlaceholders,
493493
)
494494
.emit();
@@ -522,7 +522,7 @@ impl<'a> AstValidator<'a> {
522522
.span_suggestion(
523523
span,
524524
&format!("remove the {}", remove_descr),
525-
String::new(),
525+
"",
526526
Applicability::MaybeIncorrect,
527527
)
528528
.span_label(self.current_extern_span(), "`extern` block begins here")
@@ -570,7 +570,7 @@ impl<'a> AstValidator<'a> {
570570
.span_suggestion(
571571
body.span,
572572
"remove the invalid body",
573-
";".to_string(),
573+
";",
574574
Applicability::MaybeIncorrect,
575575
)
576576
.help(
@@ -599,7 +599,7 @@ impl<'a> AstValidator<'a> {
599599
.span_suggestion_verbose(
600600
span.until(ident.span.shrink_to_lo()),
601601
"remove the qualifiers",
602-
"fn ".to_string(),
602+
"fn ",
603603
Applicability::MaybeIncorrect,
604604
)
605605
.emit();
@@ -703,7 +703,7 @@ impl<'a> AstValidator<'a> {
703703
.span_suggestion(
704704
generics.span,
705705
"remove the parameters",
706-
String::new(),
706+
"",
707707
Applicability::MachineApplicable,
708708
)
709709
.emit();
@@ -721,7 +721,7 @@ impl<'a> AstValidator<'a> {
721721
.span_suggestion(
722722
span,
723723
"remove the super traits or lifetime bounds",
724-
String::new(),
724+
"",
725725
Applicability::MachineApplicable,
726726
)
727727
.emit();
@@ -753,7 +753,7 @@ impl<'a> AstValidator<'a> {
753753
.span_suggestion(
754754
total_span,
755755
"remove these associated items",
756-
String::new(),
756+
"",
757757
Applicability::MachineApplicable,
758758
)
759759
.span_label(ident_span, "auto trait cannot have associated items")
@@ -993,7 +993,7 @@ fn validate_generic_param_order(
993993
err.span_suggestion(
994994
span,
995995
"reorder the parameters: lifetimes, then consts and types",
996-
ordered_params.clone(),
996+
&ordered_params,
997997
Applicability::MachineApplicable,
998998
);
999999
err.emit();

compiler/rustc_ast_passes/src/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ fn maybe_stage_features(sess: &Session, krate: &ast::Crate) {
823823
err.span_suggestion(
824824
attr.span,
825825
"remove the attribute",
826-
String::new(),
826+
"",
827827
Applicability::MachineApplicable,
828828
);
829829
}

compiler/rustc_attr/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) {
5959
err.span_suggestion(
6060
span,
6161
"consider removing the prefix",
62-
lint_str[1..].to_string(),
62+
&lint_str[1..],
6363
Applicability::MaybeIncorrect,
6464
);
6565
}
@@ -942,7 +942,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
942942
err.span_suggestion(
943943
item.span(),
944944
"supply an argument here",
945-
"align(...)".to_string(),
945+
"align(...)",
946946
Applicability::HasPlaceholders,
947947
);
948948
err.emit();

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
225225
.map(|n| format!("`{}`", n))
226226
.unwrap_or_else(|| "the value".to_string())
227227
),
228-
"ref ".to_string(),
228+
"ref ",
229229
Applicability::MachineApplicable,
230230
);
231231
in_pattern = true;
@@ -276,7 +276,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
276276
.map(|n| format!("`{}`", n))
277277
.unwrap_or_else(|| "the mutable reference".to_string()),
278278
),
279-
"&mut *".to_string(),
279+
"&mut *",
280280
Applicability::MachineApplicable,
281281
);
282282
}
@@ -1519,15 +1519,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15191519
Ok(string) => {
15201520
if string.starts_with("async ") {
15211521
let pos = args_span.lo() + BytePos(6);
1522-
(args_span.with_lo(pos).with_hi(pos), "move ".to_string())
1522+
(args_span.with_lo(pos).with_hi(pos), "move ")
15231523
} else if string.starts_with("async|") {
15241524
let pos = args_span.lo() + BytePos(5);
1525-
(args_span.with_lo(pos).with_hi(pos), " move".to_string())
1525+
(args_span.with_lo(pos).with_hi(pos), " move")
15261526
} else {
1527-
(args_span.shrink_to_lo(), "move ".to_string())
1527+
(args_span.shrink_to_lo(), "move ")
15281528
}
15291529
}
1530-
Err(_) => (args_span, "move |<args>| <body>".to_string()),
1530+
Err(_) => (args_span, "move |<args>| <body>"),
15311531
};
15321532
let kind = match use_span.generator_kind() {
15331533
Some(generator_kind) => match generator_kind {

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
212212
"consider adding semicolon after the expression so its \
213213
temporaries are dropped sooner, before the local variables \
214214
declared by the block are dropped",
215-
";".to_string(),
215+
";",
216216
Applicability::MaybeIncorrect,
217217
);
218218
}

compiler/rustc_borrowck/src/diagnostics/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10231023
avoid moving into the `for` loop",
10241024
ty,
10251025
),
1026-
"&".to_string(),
1026+
"&",
10271027
Applicability::MaybeIncorrect,
10281028
);
10291029
}
@@ -1049,7 +1049,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10491049
.map(|n| format!("`{}`", n))
10501050
.unwrap_or_else(|| "the mutable reference".to_string()),
10511051
),
1052-
"&mut *".to_string(),
1052+
"&mut *",
10531053
Applicability::MachineApplicable,
10541054
);
10551055
}
@@ -1067,7 +1067,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10671067
err.span_suggestion_verbose(
10681068
fn_call_span.shrink_to_lo(),
10691069
"consider calling `.as_ref()` to borrow the type's contents",
1070-
"as_ref().".to_string(),
1070+
"as_ref().",
10711071
Applicability::MachineApplicable,
10721072
);
10731073
}

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
417417
err.span_suggestion_verbose(
418418
span.shrink_to_hi(),
419419
&format!("consider borrowing the `{}`'s content", diag_name.unwrap()),
420-
".as_ref()".to_string(),
420+
".as_ref()",
421421
Applicability::MaybeIncorrect,
422422
);
423423
} else if let Some(use_spans) = use_spans {

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
295295
err.span_suggestion_verbose(
296296
source_info.span.with_hi(source_info.span.lo() + BytePos(5)),
297297
"try removing `&mut` here",
298-
String::new(),
298+
"",
299299
Applicability::MachineApplicable,
300300
);
301301
} else {
@@ -316,7 +316,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
316316
err.span_suggestion_verbose(
317317
decl.source_info.span.shrink_to_lo(),
318318
"consider making the binding mutable",
319-
"mut ".to_string(),
319+
"mut ",
320320
Applicability::MachineApplicable,
321321
);
322322
}
@@ -402,7 +402,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
402402
err.span_suggestion(
403403
span,
404404
"try removing `&mut` here",
405-
String::new(),
405+
"",
406406
Applicability::MaybeIncorrect,
407407
);
408408
}

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
860860
err.span_suggestion_verbose(
861861
span.shrink_to_hi(),
862862
"consider relaxing the implicit `'static` requirement",
863-
" + '_".to_string(),
863+
" + '_",
864864
Applicability::MaybeIncorrect,
865865
);
866866
suggested = true;

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn do_mir_borrowck<'a, 'tcx>(
426426
.span_suggestion_short(
427427
mut_span,
428428
"remove this `mut`",
429-
String::new(),
429+
"",
430430
Applicability::MachineApplicable,
431431
)
432432
.emit();

compiler/rustc_builtin_macros/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
363363
err.tool_only_span_suggestion(
364364
full_span,
365365
"remove this option",
366-
String::new(),
366+
"",
367367
Applicability::MachineApplicable,
368368
);
369369

compiler/rustc_builtin_macros/src/assert.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes
132132
err.span_suggestion(
133133
parser.token.span,
134134
"try removing semicolon",
135-
String::new(),
135+
"",
136136
Applicability::MaybeIncorrect,
137137
);
138138
err.emit();
@@ -153,7 +153,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes
153153
err.span_suggestion_short(
154154
comma_span,
155155
"try adding a comma",
156-
", ".to_string(),
156+
", ",
157157
Applicability::MaybeIncorrect,
158158
);
159159
err.emit();

compiler/rustc_builtin_macros/src/derive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn report_path_args(sess: &Session, meta: &ast::MetaItem) {
142142
let report_error = |title, action| {
143143
let span = meta.span.with_lo(meta.path.span.hi());
144144
sess.struct_span_err(span, title)
145-
.span_suggestion(span, action, String::new(), Applicability::MachineApplicable)
145+
.span_suggestion(span, action, "", Applicability::MachineApplicable)
146146
.emit();
147147
};
148148
match meta.kind {

compiler/rustc_builtin_macros/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl<'a, 'b> Context<'a, 'b> {
330330
err.tool_only_span_suggestion(
331331
sp,
332332
&format!("use the `{}` trait", name),
333-
(*fmt).to_string(),
333+
*fmt,
334334
Applicability::MaybeIncorrect,
335335
);
336336
}

compiler/rustc_builtin_macros/src/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn expand_test_or_bench(
118118
};
119119
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")
120120
.span_label(item.span, format!("expected a non-associated function, found {} {}", item.kind.article(), item.kind.descr()))
121-
.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)
121+
.span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", "#[cfg(test)]", Applicability::MaybeIncorrect)
122122
.emit();
123123

124124
return vec![Annotatable::Item(item)];

0 commit comments

Comments
 (0)