Skip to content

Commit fb75fbb

Browse files
authored
Merge pull request rust-lang#4610 from rust-lang/rustup-2025-09-30
Automatic Rustup
2 parents bbe778e + 73562f0 commit fb75fbb

File tree

124 files changed

+702
-483
lines changed

Some content is hidden

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

124 files changed

+702
-483
lines changed

compiler/rustc_abi/src/layout.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
11671167
// To allow unsizing `&Foo<Type>` -> `&Foo<dyn Trait>`, the layout of the struct must
11681168
// not depend on the layout of the tail.
11691169
let max_field_align =
1170-
fields_excluding_tail.iter().map(|f| f.align.abi.bytes()).max().unwrap_or(1);
1170+
fields_excluding_tail.iter().map(|f| f.align.bytes()).max().unwrap_or(1);
11711171
let largest_niche_size = fields_excluding_tail
11721172
.iter()
11731173
.filter_map(|f| f.largest_niche)
@@ -1187,7 +1187,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
11871187
} else {
11881188
// Returns `log2(effective-align)`. The calculation assumes that size is an
11891189
// integer multiple of align, except for ZSTs.
1190-
let align = layout.align.abi.bytes();
1190+
let align = layout.align.bytes();
11911191
let size = layout.size.bytes();
11921192
let niche_size = layout.largest_niche.map(|n| n.available(dl)).unwrap_or(0);
11931193
// Group [u8; 4] with align-4 or [u8; 6] with align-2 fields.
@@ -1485,7 +1485,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
14851485
for i in layout.fields.index_by_increasing_offset() {
14861486
let offset = layout.fields.offset(i);
14871487
let f = &fields[FieldIdx::new(i)];
1488-
write!(s, "[o{}a{}s{}", offset.bytes(), f.align.abi.bytes(), f.size.bytes()).unwrap();
1488+
write!(s, "[o{}a{}s{}", offset.bytes(), f.align.bytes(), f.size.bytes()).unwrap();
14891489
if let Some(n) = f.largest_niche {
14901490
write!(
14911491
s,

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
21562156

21572157
/// Returns `true` if the type is sized and a 1-ZST (meaning it has size 0 and alignment 1).
21582158
pub fn is_1zst(&self) -> bool {
2159-
self.is_sized() && self.size.bytes() == 0 && self.align.abi.bytes() == 1
2159+
self.is_sized() && self.size.bytes() == 0 && self.align.bytes() == 1
21602160
}
21612161

21622162
/// Returns `true` if the type is a ZST and not unsized.

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ impl PartialEq<Symbol> for Path {
114114
impl PartialEq<&[Symbol]> for Path {
115115
#[inline]
116116
fn eq(&self, names: &&[Symbol]) -> bool {
117-
self.segments.len() == names.len()
118-
&& self.segments.iter().zip(names.iter()).all(|(s1, s2)| s1 == s2)
117+
self.segments.iter().eq(*names)
119118
}
120119
}
121120

compiler/rustc_ast/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![feature(associated_type_defaults)]
1616
#![feature(box_patterns)]
1717
#![feature(if_let_guard)]
18+
#![feature(iter_order_by)]
1819
#![feature(macro_metavar_expr)]
1920
#![feature(rustdoc_internals)]
2021
#![recursion_limit = "256"]

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ impl TokenTree {
4848
match (self, other) {
4949
(TokenTree::Token(token, _), TokenTree::Token(token2, _)) => token.kind == token2.kind,
5050
(TokenTree::Delimited(.., delim, tts), TokenTree::Delimited(.., delim2, tts2)) => {
51-
delim == delim2
52-
&& tts.len() == tts2.len()
53-
&& tts.iter().zip(tts2.iter()).all(|(a, b)| a.eq_unspanned(b))
51+
delim == delim2 && tts.iter().eq_by(tts2.iter(), |a, b| a.eq_unspanned(b))
5452
}
5553
_ => false,
5654
}

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ attr_parsing_deprecated_item_suggestion =
88
99
attr_parsing_empty_attribute =
1010
unused attribute
11-
.suggestion = remove this attribute
11+
.suggestion = {$valid_without_list ->
12+
[true] remove these parentheses
13+
*[other] remove this attribute
14+
}
15+
.note = {$valid_without_list ->
16+
[true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
17+
*[other] using `{$attr_path}` with an empty list has no effect
18+
}
19+
1220
1321
attr_parsing_invalid_target = `#[{$name}]` attribute cannot be used on {$target}
1422
.help = `#[{$name}]` can {$only}be applied to {$applied}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,12 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
597597
}
598598

599599
pub(crate) fn warn_empty_attribute(&mut self, span: Span) {
600-
self.emit_lint(AttributeLintKind::EmptyAttribute { first_span: span }, span);
600+
let attr_path = self.attr_path.clone();
601+
let valid_without_list = self.template.word;
602+
self.emit_lint(
603+
AttributeLintKind::EmptyAttribute { first_span: span, attr_path, valid_without_list },
604+
span,
605+
);
601606
}
602607
}
603608

compiler/rustc_attr_parsing/src/lints.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ pub fn emit_attribute_lint<L: LintEmitter>(lint: &AttributeLint<L::Id>, lint_emi
4343
),
4444
},
4545
),
46-
AttributeLintKind::EmptyAttribute { first_span } => lint_emitter.emit_node_span_lint(
47-
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
48-
*id,
49-
*first_span,
50-
session_diagnostics::EmptyAttributeList { attr_span: *first_span },
51-
),
46+
AttributeLintKind::EmptyAttribute { first_span, attr_path, valid_without_list } => {
47+
lint_emitter.emit_node_span_lint(
48+
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
49+
*id,
50+
*first_span,
51+
session_diagnostics::EmptyAttributeList {
52+
attr_span: *first_span,
53+
attr_path: attr_path.clone(),
54+
valid_without_list: *valid_without_list,
55+
},
56+
)
57+
}
5258
AttributeLintKind::InvalidTarget { name, target, applied, only } => lint_emitter
5359
.emit_node_span_lint(
5460
// This check is here because `deprecated` had its own lint group and removing this would be a breaking change

compiler/rustc_attr_parsing/src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'a> PathParser<'a> {
4949
}
5050

5151
pub fn segments_is(&self, segments: &[Symbol]) -> bool {
52-
self.len() == segments.len() && self.segments().zip(segments).all(|(a, b)| a.name == *b)
52+
self.segments().map(|segment| &segment.name).eq(segments)
5353
}
5454

5555
pub fn word(&self) -> Option<Ident> {

compiler/rustc_attr_parsing/src/session_diagnostics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,12 @@ pub(crate) struct EmptyConfusables {
503503

504504
#[derive(LintDiagnostic)]
505505
#[diag(attr_parsing_empty_attribute)]
506+
#[note]
506507
pub(crate) struct EmptyAttributeList {
507508
#[suggestion(code = "", applicability = "machine-applicable")]
508509
pub attr_span: Span,
510+
pub attr_path: AttrPath,
511+
pub valid_without_list: bool,
509512
}
510513

511514
#[derive(LintDiagnostic)]

0 commit comments

Comments
 (0)