Skip to content

Commit d61d359

Browse files
committed
Auto merge of rust-lang#2753 - RalfJung:rustup, r=RalfJung
Rustup Pulls in rust-lang#104658
2 parents 87a202e + 236ae26 commit d61d359

File tree

807 files changed

+11180
-6270
lines changed

Some content is hidden

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

807 files changed

+11180
-6270
lines changed

Cargo.lock

+434-105
Large diffs are not rendered by default.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ members = [
44
"library/std",
55
"library/test",
66
"src/rustdoc-json-types",
7+
"src/tools/build_helper",
78
"src/tools/cargotest",
89
"src/tools/clippy",
910
"src/tools/clippy/clippy_dev",

compiler/rustc_ast/src/ast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2170,10 +2170,10 @@ impl fmt::Display for InlineAsmTemplatePiece {
21702170
Ok(())
21712171
}
21722172
Self::Placeholder { operand_idx, modifier: Some(modifier), .. } => {
2173-
write!(f, "{{{}:{}}}", operand_idx, modifier)
2173+
write!(f, "{{{operand_idx}:{modifier}}}")
21742174
}
21752175
Self::Placeholder { operand_idx, modifier: None, .. } => {
2176-
write!(f, "{{{}}}", operand_idx)
2176+
write!(f, "{{{operand_idx}}}")
21772177
}
21782178
}
21792179
}
@@ -2185,7 +2185,7 @@ impl InlineAsmTemplatePiece {
21852185
use fmt::Write;
21862186
let mut out = String::new();
21872187
for p in s.iter() {
2188-
let _ = write!(out, "{}", p);
2188+
let _ = write!(out, "{p}");
21892189
}
21902190
out
21912191
}

compiler/rustc_ast/src/ast_traits.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ impl HasTokens for Attribute {
214214
match &self.kind {
215215
AttrKind::Normal(normal) => normal.tokens.as_ref(),
216216
kind @ AttrKind::DocComment(..) => {
217-
panic!("Called tokens on doc comment attr {:?}", kind)
217+
panic!("Called tokens on doc comment attr {kind:?}")
218218
}
219219
}
220220
}
221221
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
222222
Some(match &mut self.kind {
223223
AttrKind::Normal(normal) => &mut normal.tokens,
224224
kind @ AttrKind::DocComment(..) => {
225-
panic!("Called tokens_mut on doc comment attr {:?}", kind)
225+
panic!("Called tokens_mut on doc comment attr {kind:?}")
226226
}
227227
})
228228
}

compiler/rustc_ast/src/attr/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl Attribute {
310310
AttrKind::Normal(normal) => normal
311311
.tokens
312312
.as_ref()
313-
.unwrap_or_else(|| panic!("attribute is missing tokens: {:?}", self))
313+
.unwrap_or_else(|| panic!("attribute is missing tokens: {self:?}"))
314314
.to_attr_token_stream()
315315
.to_tokenstream(),
316316
&AttrKind::DocComment(comment_kind, data) => TokenStream::new(vec![TokenTree::Token(

compiler/rustc_ast/src/expand/allocator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub enum AllocatorKind {
99
impl AllocatorKind {
1010
pub fn fn_name(&self, base: Symbol) -> String {
1111
match *self {
12-
AllocatorKind::Global => format!("__rg_{}", base),
13-
AllocatorKind::Default => format!("__rdl_{}", base),
12+
AllocatorKind::Global => format!("__rg_{base}"),
13+
AllocatorKind::Default => format!("__rdl_{base}"),
1414
}
1515
}
1616
}

compiler/rustc_ast/src/token.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -125,27 +125,27 @@ impl fmt::Display for Lit {
125125
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
126126
let Lit { kind, symbol, suffix } = *self;
127127
match kind {
128-
Byte => write!(f, "b'{}'", symbol)?,
129-
Char => write!(f, "'{}'", symbol)?,
130-
Str => write!(f, "\"{}\"", symbol)?,
128+
Byte => write!(f, "b'{symbol}'")?,
129+
Char => write!(f, "'{symbol}'")?,
130+
Str => write!(f, "\"{symbol}\"")?,
131131
StrRaw(n) => write!(
132132
f,
133133
"r{delim}\"{string}\"{delim}",
134134
delim = "#".repeat(n as usize),
135135
string = symbol
136136
)?,
137-
ByteStr => write!(f, "b\"{}\"", symbol)?,
137+
ByteStr => write!(f, "b\"{symbol}\"")?,
138138
ByteStrRaw(n) => write!(
139139
f,
140140
"br{delim}\"{string}\"{delim}",
141141
delim = "#".repeat(n as usize),
142142
string = symbol
143143
)?,
144-
Integer | Float | Bool | Err => write!(f, "{}", symbol)?,
144+
Integer | Float | Bool | Err => write!(f, "{symbol}")?,
145145
}
146146

147147
if let Some(suffix) = suffix {
148-
write!(f, "{}", suffix)?;
148+
write!(f, "{suffix}")?;
149149
}
150150

151151
Ok(())
@@ -756,7 +756,7 @@ impl Token {
756756
_ => return None,
757757
},
758758
SingleQuote => match joint.kind {
759-
Ident(name, false) => Lifetime(Symbol::intern(&format!("'{}", name))),
759+
Ident(name, false) => Lifetime(Symbol::intern(&format!("'{name}"))),
760760
_ => return None,
761761
},
762762

compiler/rustc_ast/src/tokenstream.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ impl AttrTokenStream {
258258

259259
assert!(
260260
found,
261-
"Failed to find trailing delimited group in: {:?}",
262-
target_tokens
261+
"Failed to find trailing delimited group in: {target_tokens:?}"
263262
);
264263
}
265264
let mut flat: SmallVec<[_; 1]> = SmallVec::new();

compiler/rustc_ast/src/util/literal.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub enum LitError {
3434
InvalidIntSuffix,
3535
InvalidFloatSuffix,
3636
NonDecimalFloat(u32),
37-
IntTooLarge,
37+
IntTooLarge(u32),
3838
}
3939

4040
impl LitKind {
@@ -168,7 +168,7 @@ impl fmt::Display for LitKind {
168168
match *self {
169169
LitKind::Byte(b) => {
170170
let b: String = ascii::escape_default(b).map(Into::<char>::into).collect();
171-
write!(f, "b'{}'", b)?;
171+
write!(f, "b'{b}'")?;
172172
}
173173
LitKind::Char(ch) => write!(f, "'{}'", escape_char_symbol(ch))?,
174174
LitKind::Str(sym, StrStyle::Cooked) => write!(f, "\"{}\"", escape_string_symbol(sym))?,
@@ -192,15 +192,15 @@ impl fmt::Display for LitKind {
192192
)?;
193193
}
194194
LitKind::Int(n, ty) => {
195-
write!(f, "{}", n)?;
195+
write!(f, "{n}")?;
196196
match ty {
197197
ast::LitIntType::Unsigned(ty) => write!(f, "{}", ty.name())?,
198198
ast::LitIntType::Signed(ty) => write!(f, "{}", ty.name())?,
199199
ast::LitIntType::Unsuffixed => {}
200200
}
201201
}
202202
LitKind::Float(symbol, ty) => {
203-
write!(f, "{}", symbol)?;
203+
write!(f, "{symbol}")?;
204204
match ty {
205205
ast::LitFloatType::Suffixed(ty) => write!(f, "{}", ty.name())?,
206206
ast::LitFloatType::Unsuffixed => {}
@@ -333,6 +333,6 @@ fn integer_lit(symbol: Symbol, suffix: Option<Symbol>) -> Result<LitKind, LitErr
333333
// but these kinds of errors are already reported by the lexer.
334334
let from_lexer =
335335
base < 10 && s.chars().any(|c| c.to_digit(10).map_or(false, |d| d >= base));
336-
if from_lexer { LitError::LexerError } else { LitError::IntTooLarge }
336+
if from_lexer { LitError::LexerError } else { LitError::IntTooLarge(base) }
337337
})
338338
}

compiler/rustc_ast_lowering/src/asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
104104
Err(supported_abis) => {
105105
let mut abis = format!("`{}`", supported_abis[0]);
106106
for m in &supported_abis[1..] {
107-
let _ = write!(abis, ", `{}`", m);
107+
let _ = write!(abis, ", `{m}`");
108108
}
109109
self.tcx.sess.emit_err(InvalidAbiClobberAbi {
110110
abi_span: *abi_span,
@@ -262,7 +262,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
262262
let sub = if !valid_modifiers.is_empty() {
263263
let mut mods = format!("`{}`", valid_modifiers[0]);
264264
for m in &valid_modifiers[1..] {
265-
let _ = write!(mods, ", `{}`", m);
265+
let _ = write!(mods, ", `{m}`");
266266
}
267267
InvalidAsmTemplateModifierRegClassSub::SupportModifier {
268268
class_name: class.name(),

compiler/rustc_ast_lowering/src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10511051
}
10521052
_ => {
10531053
// Replace the ident for bindings that aren't simple.
1054-
let name = format!("__arg{}", index);
1054+
let name = format!("__arg{index}");
10551055
let ident = Ident::from_str(&name);
10561056

10571057
(ident, false)

compiler/rustc_ast_lowering/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl std::fmt::Display for ImplTraitPosition {
296296
ImplTraitPosition::ImplReturn => "`impl` method return",
297297
};
298298

299-
write!(f, "{}", name)
299+
write!(f, "{name}")
300300
}
301301
}
302302

@@ -503,7 +503,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
503503

504504
fn orig_local_def_id(&self, node: NodeId) -> LocalDefId {
505505
self.orig_opt_local_def_id(node)
506-
.unwrap_or_else(|| panic!("no entry for node id: `{:?}`", node))
506+
.unwrap_or_else(|| panic!("no entry for node id: `{node:?}`"))
507507
}
508508

509509
/// Given the id of some node in the AST, finds the `LocalDefId` associated with it by the name
@@ -524,7 +524,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
524524
}
525525

526526
fn local_def_id(&self, node: NodeId) -> LocalDefId {
527-
self.opt_local_def_id(node).unwrap_or_else(|| panic!("no entry for node id: `{:?}`", node))
527+
self.opt_local_def_id(node).unwrap_or_else(|| panic!("no entry for node id: `{node:?}`"))
528528
}
529529

530530
/// Get the previously recorded `to` local def id given the `from` local def id, obtained using
@@ -2197,7 +2197,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21972197
fn lower_trait_ref(&mut self, p: &TraitRef, itctx: &ImplTraitContext) -> hir::TraitRef<'hir> {
21982198
let path = match self.lower_qpath(p.ref_id, &None, &p.path, ParamMode::Explicit, itctx) {
21992199
hir::QPath::Resolved(None, path) => path,
2200-
qpath => panic!("lower_trait_ref: unexpected QPath `{:?}`", qpath),
2200+
qpath => panic!("lower_trait_ref: unexpected QPath `{qpath:?}`"),
22012201
};
22022202
hir::TraitRef { path, hir_ref_id: self.lower_node_id(p.ref_id) }
22032203
}

compiler/rustc_ast_pretty/src/pprust/state.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,23 @@ fn doc_comment_to_string(
191191
data: Symbol,
192192
) -> String {
193193
match (comment_kind, attr_style) {
194-
(CommentKind::Line, ast::AttrStyle::Outer) => format!("///{}", data),
195-
(CommentKind::Line, ast::AttrStyle::Inner) => format!("//!{}", data),
196-
(CommentKind::Block, ast::AttrStyle::Outer) => format!("/**{}*/", data),
197-
(CommentKind::Block, ast::AttrStyle::Inner) => format!("/*!{}*/", data),
194+
(CommentKind::Line, ast::AttrStyle::Outer) => format!("///{data}"),
195+
(CommentKind::Line, ast::AttrStyle::Inner) => format!("//!{data}"),
196+
(CommentKind::Block, ast::AttrStyle::Outer) => format!("/**{data}*/"),
197+
(CommentKind::Block, ast::AttrStyle::Inner) => format!("/*!{data}*/"),
198198
}
199199
}
200200

201201
pub fn literal_to_string(lit: token::Lit) -> String {
202202
let token::Lit { kind, symbol, suffix } = lit;
203203
let mut out = match kind {
204-
token::Byte => format!("b'{}'", symbol),
205-
token::Char => format!("'{}'", symbol),
206-
token::Str => format!("\"{}\"", symbol),
204+
token::Byte => format!("b'{symbol}'"),
205+
token::Char => format!("'{symbol}'"),
206+
token::Str => format!("\"{symbol}\""),
207207
token::StrRaw(n) => {
208208
format!("r{delim}\"{string}\"{delim}", delim = "#".repeat(n as usize), string = symbol)
209209
}
210-
token::ByteStr => format!("b\"{}\"", symbol),
210+
token::ByteStr => format!("b\"{symbol}\""),
211211
token::ByteStrRaw(n) => {
212212
format!("br{delim}\"{string}\"{delim}", delim = "#".repeat(n as usize), string = symbol)
213213
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ impl<'a> State<'a> {
411411
ast::VisibilityKind::Restricted { path, shorthand, .. } => {
412412
let path = Self::to_string(|s| s.print_path(path, false, 0));
413413
if *shorthand && (path == "crate" || path == "self" || path == "super") {
414-
self.word_nbsp(format!("pub({})", path))
414+
self.word_nbsp(format!("pub({path})"))
415415
} else {
416-
self.word_nbsp(format!("pub(in {})", path))
416+
self.word_nbsp(format!("pub(in {path})"))
417417
}
418418
}
419419
ast::VisibilityKind::Inherited => {}

compiler/rustc_attr/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ fn try_gate_cfg(name: Symbol, span: Span, sess: &ParseSess, features: Option<&Fe
619619
fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &ParseSess, features: &Features) {
620620
let (cfg, feature, has_feature) = gated_cfg;
621621
if !has_feature(features) && !cfg_span.allows_unstable(*feature) {
622-
let explain = format!("`cfg({})` is experimental and subject to change", cfg);
622+
let explain = format!("`cfg({cfg})` is experimental and subject to change");
623623
feature_err(sess, *feature, cfg_span, &explain).emit();
624624
}
625625
}
@@ -975,7 +975,7 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
975975
}
976976

977977
pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
978-
assert!(attr.has_name(sym::repr), "expected `#[repr(..)]`, found: {:?}", attr);
978+
assert!(attr.has_name(sym::repr), "expected `#[repr(..)]`, found: {attr:?}");
979979
use ReprAttr::*;
980980
let mut acc = Vec::new();
981981
let diagnostic = &sess.parse_sess.span_diagnostic;

compiler/rustc_attr/src/session_diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(crate) struct UnknownMetaItem<'a> {
5151
// Manual implementation to be able to format `expected` items correctly.
5252
impl<'a> IntoDiagnostic<'a> for UnknownMetaItem<'_> {
5353
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
54-
let expected = self.expected.iter().map(|name| format!("`{}`", name)).collect::<Vec<_>>();
54+
let expected = self.expected.iter().map(|name| format!("`{name}`")).collect::<Vec<_>>();
5555
let mut diag = handler.struct_span_err_with_code(
5656
self.span,
5757
fluent::attr_unknown_meta_item,

compiler/rustc_borrowck/src/borrowck_errors.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,14 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
440440
closure_kind: &str,
441441
borrowed_path: &str,
442442
capture_span: Span,
443+
scope: &str,
443444
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
444445
let mut err = struct_span_err!(
445446
self,
446447
closure_span,
447448
E0373,
448-
"{} may outlive the current function, but it borrows {}, which is owned by the current \
449-
function",
450-
closure_kind,
451-
borrowed_path,
449+
"{closure_kind} may outlive the current {scope}, but it borrows {borrowed_path}, \
450+
which is owned by the current {scope}",
452451
);
453452
err.span_label(capture_span, format!("{} is borrowed here", borrowed_path))
454453
.span_label(closure_span, format!("may outlive borrowed value {}", borrowed_path));

0 commit comments

Comments
 (0)