Skip to content

Commit

Permalink
Auto merge of rust-lang#2871 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
Rustup
  • Loading branch information
bors committed May 3, 2023
2 parents 9db11c9 + 3951a02 commit cfd7eaa
Show file tree
Hide file tree
Showing 439 changed files with 4,079 additions and 13,143 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ jobs:
os: ubuntu-20.04-8core-32gb
env: {}
- name: i686-gnu
os: ubuntu-20.04-16core-64gb
os: ubuntu-20.04-8core-32gb
env: {}
- name: i686-gnu-nopt
os: ubuntu-20.04-16core-64gb
os: ubuntu-20.04-8core-32gb
env: {}
- name: mingw-check
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: test-various
os: ubuntu-20.04-8core-32gb
Expand All @@ -275,16 +275,16 @@ jobs:
os: ubuntu-20.04-8core-32gb
env: {}
- name: x86_64-gnu
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-stable
env:
IMAGE: x86_64-gnu
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
CI_ONLY_WHEN_CHANNEL: nightly
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
- name: x86_64-gnu-aux
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-debug
os: ubuntu-20.04-8core-32gb
Expand All @@ -309,7 +309,7 @@ jobs:
RUST_BACKTRACE: 1
os: ubuntu-20.04-8core-32gb
- name: x86_64-gnu-nopt
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-tools
env:
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4090,6 +4090,7 @@ dependencies = [
name = "rustc_smir"
version = "0.0.0"
dependencies = [
"rustc_hir",
"rustc_middle",
"rustc_span",
"tracing",
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,6 @@ pub enum ClosureBinder {
pub struct MacCall {
pub path: Path,
pub args: P<DelimArgs>,
pub prior_type_ascription: Option<(Span, bool)>,
}

impl MacCall {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ pub fn noop_visit_attribute<T: MutVisitor>(attr: &mut Attribute, vis: &mut T) {
}

pub fn noop_visit_mac<T: MutVisitor>(mac: &mut MacCall, vis: &mut T) {
let MacCall { path, args, prior_type_ascription: _ } = mac;
let MacCall { path, args } = mac;
vis.visit_path(path);
visit_delim_args(args, vis);
}
Expand Down
23 changes: 9 additions & 14 deletions compiler/rustc_ast/src/util/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ pub enum AssocOp {
DotDot,
/// `..=` range
DotDotEq,
/// `:`
Colon,
}

#[derive(PartialEq, Debug)]
Expand Down Expand Up @@ -96,7 +94,6 @@ impl AssocOp {
token::DotDotEq => Some(DotDotEq),
// DotDotDot is no longer supported, but we need some way to display the error
token::DotDotDot => Some(DotDotEq),
token::Colon => Some(Colon),
// `<-` should probably be `< -`
token::LArrow => Some(Less),
_ if t.is_keyword(kw::As) => Some(As),
Expand Down Expand Up @@ -133,7 +130,7 @@ impl AssocOp {
pub fn precedence(&self) -> usize {
use AssocOp::*;
match *self {
As | Colon => 14,
As => 14,
Multiply | Divide | Modulus => 13,
Add | Subtract => 12,
ShiftLeft | ShiftRight => 11,
Expand All @@ -156,7 +153,7 @@ impl AssocOp {
Assign | AssignOp(_) => Fixity::Right,
As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd
| BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual
| LAnd | LOr | Colon => Fixity::Left,
| LAnd | LOr => Fixity::Left,
DotDot | DotDotEq => Fixity::None,
}
}
Expand All @@ -166,8 +163,9 @@ impl AssocOp {
match *self {
Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true,
Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add | Subtract
| ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq
| Colon => false,
| ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq => {
false
}
}
}

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

Expand All @@ -202,7 +200,7 @@ impl AssocOp {
BitOr => Some(BinOpKind::BitOr),
LAnd => Some(BinOpKind::And),
LOr => Some(BinOpKind::Or),
Assign | AssignOp(_) | As | DotDot | DotDotEq | Colon => None,
Assign | AssignOp(_) | As | DotDot | DotDotEq => None,
}
}

Expand All @@ -223,10 +221,9 @@ impl AssocOp {
Greater | // `{ 42 } > 3`
GreaterEqual | // `{ 42 } >= 3`
AssignOp(_) | // `{ 42 } +=`
As | // `{ 42 } as usize`
// Equal | // `{ 42 } == { 42 }` Accepting these here would regress incorrect
// NotEqual | // `{ 42 } != { 42 }` struct literals parser recovery.
Colon, // `{ 42 }: usize`
// NotEqual | // `{ 42 } != { 42 } struct literals parser recovery.
As // `{ 42 } as usize`
)
}
}
Expand Down Expand Up @@ -254,7 +251,6 @@ pub enum ExprPrecedence {
Binary(BinOpKind),

Cast,
Type,

Assign,
AssignOp,
Expand Down Expand Up @@ -313,7 +309,6 @@ impl ExprPrecedence {
// Binop-like expr kinds, handled by `AssocOp`.
ExprPrecedence::Binary(op) => AssocOp::from_ast_binop(op).precedence() as i8,
ExprPrecedence::Cast => AssocOp::As.precedence() as i8,
ExprPrecedence::Type => AssocOp::Colon.precedence() as i8,

ExprPrecedence::Assign |
ExprPrecedence::AssignOp => AssocOp::Assign.precedence() as i8,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

self.diagnostic().span_bug(
p.span,
&format!(
format!(
"lower_qpath: no final extension segment in {}..{}",
proj_start,
p.segments.len()
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'a> PostExpansionVisitor<'a> {
&self,
const_extern_fn,
span,
&format!("`{}` as a `const fn` ABI is unstable", abi)
format!("`{}` as a `const fn` ABI is unstable", abi)
),
}
}
Expand All @@ -104,7 +104,7 @@ impl<'a> PostExpansionVisitor<'a> {
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
self.sess.parse_sess.span_diagnostic.delay_span_bug(
span,
&format!(
format!(
"unrecognized ABI not caught in lowering: {}",
symbol_unescaped.as_str()
),
Expand Down
12 changes: 9 additions & 3 deletions compiler/rustc_ast_pretty/src/pprust/state/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,16 @@ impl<'a> State<'a> {
self.print_type(ty);
}
ast::ExprKind::Type(expr, ty) => {
let prec = AssocOp::Colon.precedence() as i8;
self.print_expr_maybe_paren(expr, prec);
self.word_space(":");
self.word("type_ascribe!(");
self.ibox(0);
self.print_expr(expr);

self.word(",");
self.space_if_not_bol();
self.print_type(ty);

self.end();
self.word(")");
}
ast::ExprKind::Let(pat, scrutinee, _) => {
self.print_let(pat, scrutinee);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &ParseSess, features: &F
let (cfg, feature, has_feature) = gated_cfg;
if !has_feature(features) && !cfg_span.allows_unstable(*feature) {
let explain = format!("`cfg({cfg})` is experimental and subject to change");
feature_err(sess, *feature, cfg_span, &explain).emit();
feature_err(sess, *feature, cfg_span, explain).emit();
}
}

Expand Down
24 changes: 12 additions & 12 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
} else if reinits > 1 {
err.span_note(
MultiSpan::from_spans(reinit_spans),
&if reinits <= 3 {
if reinits <= 3 {
format!("these {reinits} reinitializations might get skipped")
} else {
format!(
Expand Down Expand Up @@ -253,7 +253,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// We have a `&mut` ref, we need to reborrow on each iteration (#62112).
err.span_suggestion_verbose(
span.shrink_to_lo(),
&format!(
format!(
"consider creating a fresh reborrow of {} here",
self.describe_place(moved_place)
.map(|n| format!("`{n}`"))
Expand Down Expand Up @@ -304,7 +304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
..
} = use_spans
{
err.note(&format!(
err.note(format!(
"{} occurs due to deref coercion to `{deref_target_ty}`",
desired_action.as_noun(),
));
Expand Down Expand Up @@ -586,7 +586,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// _ => {} // We don't want to point to this.
// };
// ```
err.span_label(sp, &label);
err.span_label(sp, label);
shown = true;
}
}
Expand Down Expand Up @@ -1139,7 +1139,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}

if union_type_name != "" {
err.note(&format!(
err.note(format!(
"{} is a field of the union `{}`, so it overlaps the field {}",
msg_place, union_type_name, msg_borrow,
));
Expand Down Expand Up @@ -1238,14 +1238,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
err.span_help(
inner_call_span,
&format!(
format!(
"try adding a local storing this{}...",
if use_span.is_some() { "" } else { " argument" }
),
);
err.span_help(
outer_call_span,
&format!(
format!(
"...and then using that local {}",
if use_span.is_some() { "here" } else { "as the argument to this call" }
),
Expand Down Expand Up @@ -2281,7 +2281,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
);
err.span_suggestion_verbose(
sugg_span,
&format!(
format!(
"to force the {} to take ownership of {} (and any \
other referenced variables), use the `move` keyword",
kind, captured_var
Expand All @@ -2293,7 +2293,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
match category {
ConstraintCategory::Return(_) | ConstraintCategory::OpaqueType => {
let msg = format!("{} is returned here", kind);
err.span_note(constraint_span, &msg);
err.span_note(constraint_span, msg);
}
ConstraintCategory::CallArgument(_) => {
fr_name.highlight_region_name(&mut err);
Expand All @@ -2304,7 +2304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
);
} else {
let msg = format!("{scope} requires argument type to outlive `{fr_name}`");
err.span_note(constraint_span, &msg);
err.span_note(constraint_span, msg);
}
}
_ => bug!(
Expand Down Expand Up @@ -2626,7 +2626,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
});
if let Some(Ok(instance)) = deref_target {
let deref_target_ty = instance.ty(tcx, self.param_env);
err.note(&format!(
err.note(format!(
"borrow occurs due to deref coercion to `{}`",
deref_target_ty
));
Expand Down Expand Up @@ -3180,7 +3180,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {

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

diag.help(&format!(
diag.help(format!(
"use data from the highlighted arguments which match the `{}` lifetime of \
the return type",
region_name,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
{
err.span_label(
pat.span,
&format!("binding `{ident}` declared here"),
format!("binding `{ident}` declared here"),
);
}
}
Expand Down Expand Up @@ -323,7 +323,7 @@ impl<'tcx> BorrowExplanation<'tcx> {

err.span_suggestion_verbose(
span.shrink_to_hi(),
&msg,
msg,
format!(" + {suggestable_name}"),
Applicability::Unspecified,
);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
if !is_loop_move {
err.span_suggestion_verbose(
move_span.shrink_to_lo(),
&format!(
format!(
"consider creating a fresh reborrow of {} here",
self.describe_place(moved_place.as_ref())
.map(|n| format!("`{n}`"))
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 @@ -533,7 +533,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
suggestions.sort_unstable_by_key(|&(span, _, _)| span);
suggestions.dedup_by_key(|&mut (span, _, _)| span);
for (span, msg, suggestion) in suggestions {
err.span_suggestion_verbose(span, &msg, suggestion, Applicability::MachineApplicable);
err.span_suggestion_verbose(span, msg, suggestion, Applicability::MachineApplicable);
}
}

Expand Down
Loading

0 comments on commit cfd7eaa

Please sign in to comment.