Skip to content

Commit 236ae26

Browse files
committed
Merge from rustc
2 parents 8740443 + c54c8cb commit 236ae26

File tree

806 files changed

+11179
-6269
lines changed

Some content is hidden

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

806 files changed

+11179
-6269
lines changed

Cargo.lock

Lines changed: 434 additions & 105 deletions
Large diffs are not rendered by default.

Cargo.toml

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 7 additions & 7 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 2 additions & 2 deletions
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(),

0 commit comments

Comments
 (0)