Skip to content

Commit 3e11b22

Browse files
committed
Auto merge of #114116 - matthiaskrgr:rollup-dtdfk76, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #113872 (Tweak CGU sorting in a couple of places.) - #114053 (CI: fix CMake installation for 32/64 bit `dist` Linux) - #114075 (inline format!() args from rustc_codegen_llvm to the end (4)) - #114081 (`desugar_doc_comments` cleanups) - #114082 (add stable NullaryOp) - #114098 (replace atty crate with std's IsTerminal) - #114102 (Dont pass `-Zwrite-long-types-to-disk=no` for `ui-fulldeps --stage=1`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d150dbb + 8cae343 commit 3e11b22

File tree

108 files changed

+436
-534
lines changed

Some content is hidden

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

108 files changed

+436
-534
lines changed

Cargo.lock

-2
Original file line numberDiff line numberDiff line change
@@ -3734,7 +3734,6 @@ dependencies = [
37343734
name = "rustc_interface"
37353735
version = "0.0.0"
37363736
dependencies = [
3737-
"atty",
37383737
"libloading",
37393738
"rustc-rayon",
37403739
"rustc-rayon-core",
@@ -4198,7 +4197,6 @@ dependencies = [
41984197
name = "rustc_session"
41994198
version = "0.0.0"
42004199
dependencies = [
4201-
"atty",
42024200
"bitflags 1.3.2",
42034201
"getopts",
42044202
"libc",

compiler/rustc_borrowck/src/borrowck_errors.rs

+20-26
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
3737
desc,
3838
);
3939

40-
err.span_label(borrow_span, format!("{} is borrowed here", borrow_desc));
41-
err.span_label(span, format!("use of borrowed {}", borrow_desc));
40+
err.span_label(borrow_span, format!("{borrow_desc} is borrowed here"));
41+
err.span_label(span, format!("use of borrowed {borrow_desc}"));
4242
err
4343
}
4444

@@ -51,8 +51,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
5151
old_opt_via: &str,
5252
old_load_end_span: Option<Span>,
5353
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
54-
let via =
55-
|msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {})", msg) };
54+
let via = |msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {msg})") };
5655
let mut err = struct_span_err!(
5756
self,
5857
new_loan_span,
@@ -143,9 +142,9 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
143142
);
144143
err.span_label(
145144
new_loan_span,
146-
format!("{} construction occurs here{}", container_name, opt_via),
145+
format!("{container_name} construction occurs here{opt_via}"),
147146
);
148-
err.span_label(old_loan_span, format!("borrow occurs here{}", old_opt_via));
147+
err.span_label(old_loan_span, format!("borrow occurs here{old_opt_via}"));
149148
if let Some(previous_end_span) = previous_end_span {
150149
err.span_label(previous_end_span, "borrow ends here");
151150
}
@@ -173,13 +172,10 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
173172
opt_via,
174173
kind_new,
175174
);
176-
err.span_label(
177-
new_loan_span,
178-
format!("{}borrow occurs here{}", second_borrow_desc, opt_via),
179-
);
175+
err.span_label(new_loan_span, format!("{second_borrow_desc}borrow occurs here{opt_via}"));
180176
err.span_label(
181177
old_loan_span,
182-
format!("{} construction occurs here{}", container_name, old_opt_via),
178+
format!("{container_name} construction occurs here{old_opt_via}"),
183179
);
184180
if let Some(previous_end_span) = previous_end_span {
185181
err.span_label(previous_end_span, "borrow from closure ends here");
@@ -199,8 +195,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
199195
msg_old: &str,
200196
old_load_end_span: Option<Span>,
201197
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
202-
let via =
203-
|msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {})", msg) };
198+
let via = |msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {msg})") };
204199
let mut err = struct_span_err!(
205200
self,
206201
span,
@@ -216,22 +211,21 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
216211

217212
if msg_new == "" {
218213
// If `msg_new` is empty, then this isn't a borrow of a union field.
219-
err.span_label(span, format!("{} borrow occurs here", kind_new));
220-
err.span_label(old_span, format!("{} borrow occurs here", kind_old));
214+
err.span_label(span, format!("{kind_new} borrow occurs here"));
215+
err.span_label(old_span, format!("{kind_old} borrow occurs here"));
221216
} else {
222217
// If `msg_new` isn't empty, then this a borrow of a union field.
223218
err.span_label(
224219
span,
225220
format!(
226-
"{} borrow of {} -- which overlaps with {} -- occurs here",
227-
kind_new, msg_new, msg_old,
221+
"{kind_new} borrow of {msg_new} -- which overlaps with {msg_old} -- occurs here",
228222
),
229223
);
230224
err.span_label(old_span, format!("{} borrow occurs here{}", kind_old, via(msg_old)));
231225
}
232226

233227
if let Some(old_load_end_span) = old_load_end_span {
234-
err.span_label(old_load_end_span, format!("{} borrow ends here", kind_old));
228+
err.span_label(old_load_end_span, format!("{kind_old} borrow ends here"));
235229
}
236230
err
237231
}
@@ -250,8 +244,8 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
250244
desc,
251245
);
252246

253-
err.span_label(borrow_span, format!("{} is borrowed here", desc));
254-
err.span_label(span, format!("{} is assigned to here but it was already borrowed", desc));
247+
err.span_label(borrow_span, format!("{desc} is borrowed here"));
248+
err.span_label(span, format!("{desc} is assigned to here but it was already borrowed"));
255249
err
256250
}
257251

@@ -330,7 +324,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
330324
optional_adverb_for_moved: &str,
331325
moved_path: Option<String>,
332326
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
333-
let moved_path = moved_path.map(|mp| format!(": `{}`", mp)).unwrap_or_default();
327+
let moved_path = moved_path.map(|mp| format!(": `{mp}`")).unwrap_or_default();
334328

335329
struct_span_err!(
336330
self,
@@ -369,8 +363,8 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
369363
immutable_place,
370364
immutable_section,
371365
);
372-
err.span_label(mutate_span, format!("cannot {}", action));
373-
err.span_label(immutable_span, format!("value is immutable in {}", immutable_section));
366+
err.span_label(mutate_span, format!("cannot {action}"));
367+
err.span_label(immutable_span, format!("value is immutable in {immutable_section}"));
374368
err
375369
}
376370

@@ -428,7 +422,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
428422

429423
err.span_label(
430424
span,
431-
format!("{}s a {} data owned by the current function", return_kind, reference_desc),
425+
format!("{return_kind}s a {reference_desc} data owned by the current function"),
432426
);
433427

434428
err
@@ -449,8 +443,8 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
449443
"{closure_kind} may outlive the current {scope}, but it borrows {borrowed_path}, \
450444
which is owned by the current {scope}",
451445
);
452-
err.span_label(capture_span, format!("{} is borrowed here", borrowed_path))
453-
.span_label(closure_span, format!("may outlive borrowed value {}", borrowed_path));
446+
err.span_label(capture_span, format!("{borrowed_path} is borrowed here"))
447+
.span_label(closure_span, format!("may outlive borrowed value {borrowed_path}"));
454448
err
455449
}
456450

compiler/rustc_borrowck/src/dataflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
360360
return;
361361
}
362362
let index = self.borrow_set.get_index_of(&location).unwrap_or_else(|| {
363-
panic!("could not find BorrowIndex for location {:?}", location);
363+
panic!("could not find BorrowIndex for location {location:?}");
364364
});
365365

366366
trans.gen(index);

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+29-47
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
653653
err.span_suggestion_verbose(
654654
sugg_span.shrink_to_hi(),
655655
"consider assigning a value",
656-
format!(" = {}", assign_value),
656+
format!(" = {assign_value}"),
657657
Applicability::MaybeIncorrect,
658658
);
659659
}
@@ -738,7 +738,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
738738
// Try to find predicates on *generic params* that would allow copying `ty`
739739
let suggestion =
740740
if let Some(symbol) = tcx.hir().maybe_get_struct_pattern_shorthand_field(expr) {
741-
format!(": {}.clone()", symbol)
741+
format!(": {symbol}.clone()")
742742
} else {
743743
".clone()".to_owned()
744744
};
@@ -1162,8 +1162,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11621162

11631163
if union_type_name != "" {
11641164
err.note(format!(
1165-
"{} is a field of the union `{}`, so it overlaps the field {}",
1166-
msg_place, union_type_name, msg_borrow,
1165+
"{msg_place} is a field of the union `{union_type_name}`, so it overlaps the field {msg_borrow}",
11671166
));
11681167
}
11691168

@@ -1353,8 +1352,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13531352
let Some(trait_did) = tcx.trait_of_item(def_id) &&
13541353
tcx.is_diagnostic_item(sym::Iterator, trait_did) {
13551354
err.note(format!(
1356-
"a for loop advances the iterator for you, the result is stored in `{}`.",
1357-
loop_bind
1355+
"a for loop advances the iterator for you, the result is stored in `{loop_bind}`."
13581356
));
13591357
err.help("if you want to call `next` on a iterator within the loop, consider using `while let`.");
13601358
}
@@ -1825,7 +1823,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18251823
},
18261824
ConstraintCategory::CallArgument(None),
18271825
var_or_use_span,
1828-
&format!("`{}`", name),
1826+
&format!("`{name}`"),
18291827
"block",
18301828
),
18311829
(
@@ -1847,7 +1845,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18471845
region_name,
18481846
category,
18491847
span,
1850-
&format!("`{}`", name),
1848+
&format!("`{name}`"),
18511849
"function",
18521850
),
18531851
(
@@ -1921,14 +1919,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19211919
}
19221920
}
19231921

1924-
let mut err = self.path_does_not_live_long_enough(borrow_span, &format!("`{}`", name));
1922+
let mut err = self.path_does_not_live_long_enough(borrow_span, &format!("`{name}`"));
19251923

19261924
if let Some(annotation) = self.annotate_argument_and_return_for_borrow(borrow) {
19271925
let region_name = annotation.emit(self, &mut err);
19281926

19291927
err.span_label(
19301928
borrow_span,
1931-
format!("`{}` would have to be valid for `{}`...", name, region_name),
1929+
format!("`{name}` would have to be valid for `{region_name}`..."),
19321930
);
19331931

19341932
err.span_label(
@@ -1939,7 +1937,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19391937
self.infcx
19401938
.tcx
19411939
.opt_item_name(self.mir_def_id().to_def_id())
1942-
.map(|name| format!("function `{}`", name))
1940+
.map(|name| format!("function `{name}`"))
19431941
.unwrap_or_else(|| {
19441942
match &self.infcx.tcx.def_kind(self.mir_def_id()) {
19451943
DefKind::Closure => "enclosing closure",
@@ -1974,7 +1972,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19741972
}
19751973
} else {
19761974
err.span_label(borrow_span, "borrowed value does not live long enough");
1977-
err.span_label(drop_span, format!("`{}` dropped here while still borrowed", name));
1975+
err.span_label(drop_span, format!("`{name}` dropped here while still borrowed"));
19781976

19791977
borrow_spans.args_subdiag(&mut err, |args_span| {
19801978
crate::session_diagnostics::CaptureArgLabel::Capture {
@@ -2018,22 +2016,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20182016
let mut err = self.cannot_borrow_across_destructor(borrow_span);
20192017

20202018
let what_was_dropped = match self.describe_place(place.as_ref()) {
2021-
Some(name) => format!("`{}`", name),
2019+
Some(name) => format!("`{name}`"),
20222020
None => String::from("temporary value"),
20232021
};
20242022

20252023
let label = match self.describe_place(borrow.borrowed_place.as_ref()) {
20262024
Some(borrowed) => format!(
2027-
"here, drop of {D} needs exclusive access to `{B}`, \
2028-
because the type `{T}` implements the `Drop` trait",
2029-
D = what_was_dropped,
2030-
T = dropped_ty,
2031-
B = borrowed
2025+
"here, drop of {what_was_dropped} needs exclusive access to `{borrowed}`, \
2026+
because the type `{dropped_ty}` implements the `Drop` trait"
20322027
),
20332028
None => format!(
2034-
"here is drop of {D}; whose type `{T}` implements the `Drop` trait",
2035-
D = what_was_dropped,
2036-
T = dropped_ty
2029+
"here is drop of {what_was_dropped}; whose type `{dropped_ty}` implements the `Drop` trait"
20372030
),
20382031
};
20392032
err.span_label(drop_span, label);
@@ -2245,10 +2238,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22452238
} else {
22462239
"local data "
22472240
};
2248-
(
2249-
format!("{}`{}`", local_kind, place_desc),
2250-
format!("`{}` is borrowed here", place_desc),
2251-
)
2241+
(format!("{local_kind}`{place_desc}`"), format!("`{place_desc}` is borrowed here"))
22522242
} else {
22532243
let root_place =
22542244
self.prefixes(borrow.borrowed_place.as_ref(), PrefixSet::All).last().unwrap();
@@ -2350,17 +2340,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23502340
err.span_suggestion_verbose(
23512341
sugg_span,
23522342
format!(
2353-
"to force the {} to take ownership of {} (and any \
2354-
other referenced variables), use the `move` keyword",
2355-
kind, captured_var
2343+
"to force the {kind} to take ownership of {captured_var} (and any \
2344+
other referenced variables), use the `move` keyword"
23562345
),
23572346
suggestion,
23582347
Applicability::MachineApplicable,
23592348
);
23602349

23612350
match category {
23622351
ConstraintCategory::Return(_) | ConstraintCategory::OpaqueType => {
2363-
let msg = format!("{} is returned here", kind);
2352+
let msg = format!("{kind} is returned here");
23642353
err.span_note(constraint_span, msg);
23652354
}
23662355
ConstraintCategory::CallArgument(_) => {
@@ -2402,21 +2391,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
24022391

24032392
err.span_label(
24042393
upvar_span,
2405-
format!("`{}` declared here, outside of the {} body", upvar_name, escapes_from),
2394+
format!("`{upvar_name}` declared here, outside of the {escapes_from} body"),
24062395
);
24072396

2408-
err.span_label(borrow_span, format!("borrow is only valid in the {} body", escapes_from));
2397+
err.span_label(borrow_span, format!("borrow is only valid in the {escapes_from} body"));
24092398

24102399
if let Some(name) = name {
24112400
err.span_label(
24122401
escape_span,
2413-
format!("reference to `{}` escapes the {} body here", name, escapes_from),
2402+
format!("reference to `{name}` escapes the {escapes_from} body here"),
24142403
);
24152404
} else {
2416-
err.span_label(
2417-
escape_span,
2418-
format!("reference escapes the {} body here", escapes_from),
2419-
);
2405+
err.span_label(escape_span, format!("reference escapes the {escapes_from} body here"));
24202406
}
24212407

24222408
err
@@ -2697,10 +2683,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
26972683
});
26982684
if let Some(Ok(instance)) = deref_target {
26992685
let deref_target_ty = instance.ty(tcx, self.param_env);
2700-
err.note(format!(
2701-
"borrow occurs due to deref coercion to `{}`",
2702-
deref_target_ty
2703-
));
2686+
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));
27042687
err.span_note(tcx.def_span(instance.def_id()), "deref defined here");
27052688
}
27062689
}
@@ -2756,7 +2739,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
27562739
"cannot assign twice to immutable variable"
27572740
};
27582741
if span != assigned_span && !from_arg {
2759-
err.span_label(assigned_span, format!("first assignment to {}", place_description));
2742+
err.span_label(assigned_span, format!("first assignment to {place_description}"));
27602743
}
27612744
if let Some(decl) = local_decl
27622745
&& let Some(name) = local_name
@@ -2765,7 +2748,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
27652748
err.span_suggestion(
27662749
decl.source_info.span,
27672750
"consider making this binding mutable",
2768-
format!("mut {}", name),
2751+
format!("mut {name}"),
27692752
Applicability::MachineApplicable,
27702753
);
27712754
}
@@ -3226,7 +3209,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
32263209
return_span,
32273210
} => {
32283211
let argument_ty_name = cx.get_name_for_ty(argument_ty, 0);
3229-
diag.span_label(argument_span, format!("has type `{}`", argument_ty_name));
3212+
diag.span_label(argument_span, format!("has type `{argument_ty_name}`"));
32303213

32313214
let return_ty_name = cx.get_name_for_ty(return_ty, 0);
32323215
let types_equal = return_ty_name == argument_ty_name;
@@ -3253,15 +3236,14 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
32533236
// Region of return type and arguments checked to be the same earlier.
32543237
let region_name = cx.get_region_name_for_ty(*return_ty, 0);
32553238
for (_, argument_span) in arguments {
3256-
diag.span_label(*argument_span, format!("has lifetime `{}`", region_name));
3239+
diag.span_label(*argument_span, format!("has lifetime `{region_name}`"));
32573240
}
32583241

3259-
diag.span_label(*return_span, format!("also has lifetime `{}`", region_name,));
3242+
diag.span_label(*return_span, format!("also has lifetime `{region_name}`",));
32603243

32613244
diag.help(format!(
3262-
"use data from the highlighted arguments which match the `{}` lifetime of \
3245+
"use data from the highlighted arguments which match the `{region_name}` lifetime of \
32633246
the return type",
3264-
region_name,
32653247
));
32663248

32673249
region_name

0 commit comments

Comments
 (0)