Skip to content

Commit cfd7eaa

Browse files
committed
Auto merge of #2871 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 9db11c9 + 3951a02 commit cfd7eaa

File tree

439 files changed

+4079
-13143
lines changed

Some content is hidden

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

439 files changed

+4079
-13143
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,13 @@ jobs:
260260
os: ubuntu-20.04-8core-32gb
261261
env: {}
262262
- name: i686-gnu
263-
os: ubuntu-20.04-16core-64gb
263+
os: ubuntu-20.04-8core-32gb
264264
env: {}
265265
- name: i686-gnu-nopt
266-
os: ubuntu-20.04-16core-64gb
266+
os: ubuntu-20.04-8core-32gb
267267
env: {}
268268
- name: mingw-check
269-
os: ubuntu-20.04-8core-32gb
269+
os: ubuntu-20.04-4core-16gb
270270
env: {}
271271
- name: test-various
272272
os: ubuntu-20.04-8core-32gb
@@ -275,16 +275,16 @@ jobs:
275275
os: ubuntu-20.04-8core-32gb
276276
env: {}
277277
- name: x86_64-gnu
278-
os: ubuntu-20.04-8core-32gb
278+
os: ubuntu-20.04-4core-16gb
279279
env: {}
280280
- name: x86_64-gnu-stable
281281
env:
282282
IMAGE: x86_64-gnu
283283
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
284284
CI_ONLY_WHEN_CHANNEL: nightly
285-
os: ubuntu-20.04-8core-32gb
285+
os: ubuntu-20.04-4core-16gb
286286
- name: x86_64-gnu-aux
287-
os: ubuntu-20.04-8core-32gb
287+
os: ubuntu-20.04-4core-16gb
288288
env: {}
289289
- name: x86_64-gnu-debug
290290
os: ubuntu-20.04-8core-32gb
@@ -309,7 +309,7 @@ jobs:
309309
RUST_BACKTRACE: 1
310310
os: ubuntu-20.04-8core-32gb
311311
- name: x86_64-gnu-nopt
312-
os: ubuntu-20.04-8core-32gb
312+
os: ubuntu-20.04-4core-16gb
313313
env: {}
314314
- name: x86_64-gnu-tools
315315
env:

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4090,6 +4090,7 @@ dependencies = [
40904090
name = "rustc_smir"
40914091
version = "0.0.0"
40924092
dependencies = [
4093+
"rustc_hir",
40934094
"rustc_middle",
40944095
"rustc_span",
40954096
"tracing",

compiler/rustc_ast/src/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,6 @@ pub enum ClosureBinder {
15891589
pub struct MacCall {
15901590
pub path: Path,
15911591
pub args: P<DelimArgs>,
1592-
pub prior_type_ascription: Option<(Span, bool)>,
15931592
}
15941593

15951594
impl MacCall {

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ pub fn noop_visit_attribute<T: MutVisitor>(attr: &mut Attribute, vis: &mut T) {
631631
}
632632

633633
pub fn noop_visit_mac<T: MutVisitor>(mac: &mut MacCall, vis: &mut T) {
634-
let MacCall { path, args, prior_type_ascription: _ } = mac;
634+
let MacCall { path, args } = mac;
635635
vis.visit_path(path);
636636
visit_delim_args(args, vis);
637637
}

compiler/rustc_ast/src/util/parser.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ pub enum AssocOp {
5353
DotDot,
5454
/// `..=` range
5555
DotDotEq,
56-
/// `:`
57-
Colon,
5856
}
5957

6058
#[derive(PartialEq, Debug)]
@@ -96,7 +94,6 @@ impl AssocOp {
9694
token::DotDotEq => Some(DotDotEq),
9795
// DotDotDot is no longer supported, but we need some way to display the error
9896
token::DotDotDot => Some(DotDotEq),
99-
token::Colon => Some(Colon),
10097
// `<-` should probably be `< -`
10198
token::LArrow => Some(Less),
10299
_ if t.is_keyword(kw::As) => Some(As),
@@ -133,7 +130,7 @@ impl AssocOp {
133130
pub fn precedence(&self) -> usize {
134131
use AssocOp::*;
135132
match *self {
136-
As | Colon => 14,
133+
As => 14,
137134
Multiply | Divide | Modulus => 13,
138135
Add | Subtract => 12,
139136
ShiftLeft | ShiftRight => 11,
@@ -156,7 +153,7 @@ impl AssocOp {
156153
Assign | AssignOp(_) => Fixity::Right,
157154
As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd
158155
| BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual
159-
| LAnd | LOr | Colon => Fixity::Left,
156+
| LAnd | LOr => Fixity::Left,
160157
DotDot | DotDotEq => Fixity::None,
161158
}
162159
}
@@ -166,8 +163,9 @@ impl AssocOp {
166163
match *self {
167164
Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true,
168165
Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add | Subtract
169-
| ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq
170-
| Colon => false,
166+
| ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq => {
167+
false
168+
}
171169
}
172170
}
173171

@@ -177,7 +175,7 @@ impl AssocOp {
177175
Assign | AssignOp(_) => true,
178176
Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply
179177
| Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor
180-
| BitOr | LAnd | LOr | DotDot | DotDotEq | Colon => false,
178+
| BitOr | LAnd | LOr | DotDot | DotDotEq => false,
181179
}
182180
}
183181

@@ -202,7 +200,7 @@ impl AssocOp {
202200
BitOr => Some(BinOpKind::BitOr),
203201
LAnd => Some(BinOpKind::And),
204202
LOr => Some(BinOpKind::Or),
205-
Assign | AssignOp(_) | As | DotDot | DotDotEq | Colon => None,
203+
Assign | AssignOp(_) | As | DotDot | DotDotEq => None,
206204
}
207205
}
208206

@@ -223,10 +221,9 @@ impl AssocOp {
223221
Greater | // `{ 42 } > 3`
224222
GreaterEqual | // `{ 42 } >= 3`
225223
AssignOp(_) | // `{ 42 } +=`
226-
As | // `{ 42 } as usize`
227224
// Equal | // `{ 42 } == { 42 }` Accepting these here would regress incorrect
228-
// NotEqual | // `{ 42 } != { 42 }` struct literals parser recovery.
229-
Colon, // `{ 42 }: usize`
225+
// NotEqual | // `{ 42 } != { 42 } struct literals parser recovery.
226+
As // `{ 42 } as usize`
230227
)
231228
}
232229
}
@@ -254,7 +251,6 @@ pub enum ExprPrecedence {
254251
Binary(BinOpKind),
255252

256253
Cast,
257-
Type,
258254

259255
Assign,
260256
AssignOp,
@@ -313,7 +309,6 @@ impl ExprPrecedence {
313309
// Binop-like expr kinds, handled by `AssocOp`.
314310
ExprPrecedence::Binary(op) => AssocOp::from_ast_binop(op).precedence() as i8,
315311
ExprPrecedence::Cast => AssocOp::As.precedence() as i8,
316-
ExprPrecedence::Type => AssocOp::Colon.precedence() as i8,
317312

318313
ExprPrecedence::Assign |
319314
ExprPrecedence::AssignOp => AssocOp::Assign.precedence() as i8,

compiler/rustc_ast_lowering/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
136136

137137
self.diagnostic().span_bug(
138138
p.span,
139-
&format!(
139+
format!(
140140
"lower_qpath: no final extension segment in {}..{}",
141141
proj_start,
142142
p.segments.len()

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a> PostExpansionVisitor<'a> {
8383
&self,
8484
const_extern_fn,
8585
span,
86-
&format!("`{}` as a `const fn` ABI is unstable", abi)
86+
format!("`{}` as a `const fn` ABI is unstable", abi)
8787
),
8888
}
8989
}
@@ -104,7 +104,7 @@ impl<'a> PostExpansionVisitor<'a> {
104104
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
105105
self.sess.parse_sess.span_diagnostic.delay_span_bug(
106106
span,
107-
&format!(
107+
format!(
108108
"unrecognized ABI not caught in lowering: {}",
109109
symbol_unescaped.as_str()
110110
),

compiler/rustc_ast_pretty/src/pprust/state/expr.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,16 @@ impl<'a> State<'a> {
341341
self.print_type(ty);
342342
}
343343
ast::ExprKind::Type(expr, ty) => {
344-
let prec = AssocOp::Colon.precedence() as i8;
345-
self.print_expr_maybe_paren(expr, prec);
346-
self.word_space(":");
344+
self.word("type_ascribe!(");
345+
self.ibox(0);
346+
self.print_expr(expr);
347+
348+
self.word(",");
349+
self.space_if_not_bol();
347350
self.print_type(ty);
351+
352+
self.end();
353+
self.word(")");
348354
}
349355
ast::ExprKind::Let(pat, scrutinee, _) => {
350356
self.print_let(pat, scrutinee);

compiler/rustc_attr/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &ParseSess, features: &F
623623
let (cfg, feature, has_feature) = gated_cfg;
624624
if !has_feature(features) && !cfg_span.allows_unstable(*feature) {
625625
let explain = format!("`cfg({cfg})` is experimental and subject to change");
626-
feature_err(sess, *feature, cfg_span, &explain).emit();
626+
feature_err(sess, *feature, cfg_span, explain).emit();
627627
}
628628
}
629629

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
158158
} else if reinits > 1 {
159159
err.span_note(
160160
MultiSpan::from_spans(reinit_spans),
161-
&if reinits <= 3 {
161+
if reinits <= 3 {
162162
format!("these {reinits} reinitializations might get skipped")
163163
} else {
164164
format!(
@@ -253,7 +253,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
253253
// We have a `&mut` ref, we need to reborrow on each iteration (#62112).
254254
err.span_suggestion_verbose(
255255
span.shrink_to_lo(),
256-
&format!(
256+
format!(
257257
"consider creating a fresh reborrow of {} here",
258258
self.describe_place(moved_place)
259259
.map(|n| format!("`{n}`"))
@@ -304,7 +304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
304304
..
305305
} = use_spans
306306
{
307-
err.note(&format!(
307+
err.note(format!(
308308
"{} occurs due to deref coercion to `{deref_target_ty}`",
309309
desired_action.as_noun(),
310310
));
@@ -586,7 +586,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
586586
// _ => {} // We don't want to point to this.
587587
// };
588588
// ```
589-
err.span_label(sp, &label);
589+
err.span_label(sp, label);
590590
shown = true;
591591
}
592592
}
@@ -1139,7 +1139,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11391139
}
11401140

11411141
if union_type_name != "" {
1142-
err.note(&format!(
1142+
err.note(format!(
11431143
"{} is a field of the union `{}`, so it overlaps the field {}",
11441144
msg_place, union_type_name, msg_borrow,
11451145
));
@@ -1238,14 +1238,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12381238
}
12391239
err.span_help(
12401240
inner_call_span,
1241-
&format!(
1241+
format!(
12421242
"try adding a local storing this{}...",
12431243
if use_span.is_some() { "" } else { " argument" }
12441244
),
12451245
);
12461246
err.span_help(
12471247
outer_call_span,
1248-
&format!(
1248+
format!(
12491249
"...and then using that local {}",
12501250
if use_span.is_some() { "here" } else { "as the argument to this call" }
12511251
),
@@ -2281,7 +2281,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22812281
);
22822282
err.span_suggestion_verbose(
22832283
sugg_span,
2284-
&format!(
2284+
format!(
22852285
"to force the {} to take ownership of {} (and any \
22862286
other referenced variables), use the `move` keyword",
22872287
kind, captured_var
@@ -2293,7 +2293,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22932293
match category {
22942294
ConstraintCategory::Return(_) | ConstraintCategory::OpaqueType => {
22952295
let msg = format!("{} is returned here", kind);
2296-
err.span_note(constraint_span, &msg);
2296+
err.span_note(constraint_span, msg);
22972297
}
22982298
ConstraintCategory::CallArgument(_) => {
22992299
fr_name.highlight_region_name(&mut err);
@@ -2304,7 +2304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23042304
);
23052305
} else {
23062306
let msg = format!("{scope} requires argument type to outlive `{fr_name}`");
2307-
err.span_note(constraint_span, &msg);
2307+
err.span_note(constraint_span, msg);
23082308
}
23092309
}
23102310
_ => bug!(
@@ -2626,7 +2626,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
26262626
});
26272627
if let Some(Ok(instance)) = deref_target {
26282628
let deref_target_ty = instance.ty(tcx, self.param_env);
2629-
err.note(&format!(
2629+
err.note(format!(
26302630
"borrow occurs due to deref coercion to `{}`",
26312631
deref_target_ty
26322632
));
@@ -3180,7 +3180,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
31803180

31813181
diag.span_label(*return_span, format!("also has lifetime `{}`", region_name,));
31823182

3183-
diag.help(&format!(
3183+
diag.help(format!(
31843184
"use data from the highlighted arguments which match the `{}` lifetime of \
31853185
the return type",
31863186
region_name,

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
9090
{
9191
err.span_label(
9292
pat.span,
93-
&format!("binding `{ident}` declared here"),
93+
format!("binding `{ident}` declared here"),
9494
);
9595
}
9696
}
@@ -323,7 +323,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
323323

324324
err.span_suggestion_verbose(
325325
span.shrink_to_hi(),
326-
&msg,
326+
msg,
327327
format!(" + {suggestable_name}"),
328328
Applicability::Unspecified,
329329
);

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10731073
if !is_loop_move {
10741074
err.span_suggestion_verbose(
10751075
move_span.shrink_to_lo(),
1076-
&format!(
1076+
format!(
10771077
"consider creating a fresh reborrow of {} here",
10781078
self.describe_place(moved_place.as_ref())
10791079
.map(|n| format!("`{n}`"))

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
533533
suggestions.sort_unstable_by_key(|&(span, _, _)| span);
534534
suggestions.dedup_by_key(|&mut (span, _, _)| span);
535535
for (span, msg, suggestion) in suggestions {
536-
err.span_suggestion_verbose(span, &msg, suggestion, Applicability::MachineApplicable);
536+
err.span_suggestion_verbose(span, msg, suggestion, Applicability::MachineApplicable);
537537
}
538538
}
539539

0 commit comments

Comments
 (0)