Skip to content

Commit 7629b4b

Browse files
committed
Auto merge of #153044 - JonathanBrouwer:rollup-tE0o3WW, r=<try>
Rollup of 9 pull requests try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1
2 parents 0028f34 + 38000b1 commit 7629b4b

71 files changed

Lines changed: 1130 additions & 981 deletions

Some content is hidden

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

compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ impl<S: Stage> CombineAttributeParser<S> for UnstableFeatureBoundParser {
5252
}
5353
}
5454

55-
pub(crate) struct AllowConstFnUnstableParser;
56-
impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser {
55+
pub(crate) struct RustcAllowConstFnUnstableParser;
56+
impl<S: Stage> CombineAttributeParser<S> for RustcAllowConstFnUnstableParser {
5757
const PATH: &[Symbol] = &[sym::rustc_allow_const_fn_unstable];
5858
type Item = Symbol;
5959
const CONVERT: ConvertFn<Self::Item> =

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ impl<S: Stage> SingleAttributeParser<S> for ExportNameParser {
153153
}
154154
}
155155

156-
pub(crate) struct ObjcClassParser;
156+
pub(crate) struct RustcObjcClassParser;
157157

158-
impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
158+
impl<S: Stage> SingleAttributeParser<S> for RustcObjcClassParser {
159159
const PATH: &[rustc_span::Symbol] = &[sym::rustc_objc_class];
160160
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
161161
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
@@ -185,9 +185,9 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
185185
}
186186
}
187187

188-
pub(crate) struct ObjcSelectorParser;
188+
pub(crate) struct RustcObjcSelectorParser;
189189

190-
impl<S: Stage> SingleAttributeParser<S> for ObjcSelectorParser {
190+
impl<S: Stage> SingleAttributeParser<S> for RustcObjcSelectorParser {
191191
const PATH: &[rustc_span::Symbol] = &[sym::rustc_objc_selector];
192192
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
193193
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
@@ -709,13 +709,13 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcPassIndirectlyInNonRusticAbisPa
709709
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassIndirectlyInNonRusticAbis;
710710
}
711711

712-
pub(crate) struct EiiForeignItemParser;
712+
pub(crate) struct RustcEiiForeignItemParser;
713713

714-
impl<S: Stage> NoArgsAttributeParser<S> for EiiForeignItemParser {
714+
impl<S: Stage> NoArgsAttributeParser<S> for RustcEiiForeignItemParser {
715715
const PATH: &[Symbol] = &[sym::rustc_eii_foreign_item];
716716
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
717717
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
718-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::EiiForeignItem;
718+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcEiiForeignItem;
719719
}
720720

721721
pub(crate) struct PatchableFunctionEntryParser;

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,50 @@ impl<S: Stage> CombineAttributeParser<S> for FeatureParser {
347347
res
348348
}
349349
}
350+
351+
pub(crate) struct RegisterToolParser;
352+
353+
impl<S: Stage> CombineAttributeParser<S> for RegisterToolParser {
354+
const PATH: &[Symbol] = &[sym::register_tool];
355+
type Item = Ident;
356+
const CONVERT: ConvertFn<Self::Item> = AttributeKind::RegisterTool;
357+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS);
358+
const TEMPLATE: AttributeTemplate = template!(List: &["tool1, tool2, ..."]);
359+
360+
fn extend(
361+
cx: &mut AcceptContext<'_, '_, S>,
362+
args: &ArgParser,
363+
) -> impl IntoIterator<Item = Self::Item> {
364+
let ArgParser::List(list) = args else {
365+
cx.expected_list(cx.attr_span, args);
366+
return Vec::new();
367+
};
368+
369+
if list.is_empty() {
370+
cx.warn_empty_attribute(cx.attr_span);
371+
}
372+
373+
let mut res = Vec::new();
374+
375+
for elem in list.mixed() {
376+
let Some(elem) = elem.meta_item() else {
377+
cx.expected_identifier(elem.span());
378+
continue;
379+
};
380+
if let Err(arg_span) = elem.args().no_args() {
381+
cx.expected_no_args(arg_span);
382+
continue;
383+
}
384+
385+
let path = elem.path();
386+
let Some(ident) = path.word() else {
387+
cx.expected_identifier(path.span());
388+
continue;
389+
};
390+
391+
res.push(ident);
392+
}
393+
394+
res
395+
}
396+
}

compiler/rustc_attr_parsing/src/attributes/deprecation.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ use crate::session_diagnostics::{
77
DeprecatedItemSuggestion, InvalidSince, MissingNote, MissingSince,
88
};
99

10-
pub(crate) struct DeprecationParser;
11-
1210
fn get<S: Stage>(
1311
cx: &AcceptContext<'_, '_, S>,
1412
name: Symbol,
@@ -33,7 +31,8 @@ fn get<S: Stage>(
3331
}
3432
}
3533

36-
impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
34+
pub(crate) struct DeprecatedParser;
35+
impl<S: Stage> SingleAttributeParser<S> for DeprecatedParser {
3736
const PATH: &[Symbol] = &[sym::deprecated];
3837
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
3938
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
@@ -164,7 +163,7 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
164163
return None;
165164
}
166165

167-
Some(AttributeKind::Deprecation {
166+
Some(AttributeKind::Deprecated {
168167
deprecation: Deprecation { since, note, suggestion },
169168
span: cx.attr_span,
170169
})

compiler/rustc_attr_parsing/src/attributes/dummy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use crate::context::{AcceptContext, Stage};
77
use crate::parser::ArgParser;
88
use crate::target_checking::{ALL_TARGETS, AllowedTargets};
99

10-
pub(crate) struct DummyParser;
11-
impl<S: Stage> SingleAttributeParser<S> for DummyParser {
10+
pub(crate) struct RustcDummyParser;
11+
impl<S: Stage> SingleAttributeParser<S> for RustcDummyParser {
1212
const PATH: &[Symbol] = &[sym::rustc_dummy];
1313
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
1414
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore;

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ impl<S: Stage> NoArgsAttributeParser<S> for FfiPureParser {
524524
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiPure;
525525
}
526526

527-
pub(crate) struct StdInternalSymbolParser;
528-
impl<S: Stage> NoArgsAttributeParser<S> for StdInternalSymbolParser {
527+
pub(crate) struct RustcStdInternalSymbolParser;
528+
impl<S: Stage> NoArgsAttributeParser<S> for RustcStdInternalSymbolParser {
529529
const PATH: &[Symbol] = &[sym::rustc_std_internal_symbol];
530530
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
531531
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[

compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::prelude::*;
22

3-
pub(crate) struct AsPtrParser;
4-
impl<S: Stage> NoArgsAttributeParser<S> for AsPtrParser {
3+
pub(crate) struct RustcAsPtrParser;
4+
impl<S: Stage> NoArgsAttributeParser<S> for RustcAsPtrParser {
55
const PATH: &[Symbol] = &[sym::rustc_as_ptr];
66
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
77
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@@ -14,8 +14,8 @@ impl<S: Stage> NoArgsAttributeParser<S> for AsPtrParser {
1414
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcAsPtr;
1515
}
1616

17-
pub(crate) struct PubTransparentParser;
18-
impl<S: Stage> NoArgsAttributeParser<S> for PubTransparentParser {
17+
pub(crate) struct RustcPubTransparentParser;
18+
impl<S: Stage> NoArgsAttributeParser<S> for RustcPubTransparentParser {
1919
const PATH: &[Symbol] = &[sym::rustc_pub_transparent];
2020
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
2121
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@@ -26,8 +26,8 @@ impl<S: Stage> NoArgsAttributeParser<S> for PubTransparentParser {
2626
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPubTransparent;
2727
}
2828

29-
pub(crate) struct PassByValueParser;
30-
impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
29+
pub(crate) struct RustcPassByValueParser;
30+
impl<S: Stage> NoArgsAttributeParser<S> for RustcPassByValueParser {
3131
const PATH: &[Symbol] = &[sym::rustc_pass_by_value];
3232
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
3333
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@@ -38,8 +38,8 @@ impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
3838
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassByValue;
3939
}
4040

41-
pub(crate) struct RustcShouldNotBeCalledOnConstItems;
42-
impl<S: Stage> NoArgsAttributeParser<S> for RustcShouldNotBeCalledOnConstItems {
41+
pub(crate) struct RustcShouldNotBeCalledOnConstItemsParser;
42+
impl<S: Stage> NoArgsAttributeParser<S> for RustcShouldNotBeCalledOnConstItemsParser {
4343
const PATH: &[Symbol] = &[sym::rustc_should_not_be_called_on_const_items];
4444
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
4545
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[

compiler/rustc_attr_parsing/src/attributes/repr.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ fn parse_alignment(node: &LitKind) -> Result<Align, &'static str> {
269269

270270
/// Parse #[align(N)].
271271
#[derive(Default)]
272-
pub(crate) struct AlignParser(Option<(Align, Span)>);
272+
pub(crate) struct RustcAlignParser(Option<(Align, Span)>);
273273

274-
impl AlignParser {
274+
impl RustcAlignParser {
275275
const PATH: &[Symbol] = &[sym::rustc_align];
276276
const TEMPLATE: AttributeTemplate = template!(List: &["<alignment in bytes>"]);
277277

@@ -308,7 +308,7 @@ impl AlignParser {
308308
}
309309
}
310310

311-
impl<S: Stage> AttributeParser<S> for AlignParser {
311+
impl<S: Stage> AttributeParser<S> for RustcAlignParser {
312312
const ATTRIBUTES: AcceptMapping<Self, S> = &[(Self::PATH, Self::TEMPLATE, Self::parse)];
313313
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
314314
Allow(Target::Fn),
@@ -321,29 +321,29 @@ impl<S: Stage> AttributeParser<S> for AlignParser {
321321

322322
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
323323
let (align, span) = self.0?;
324-
Some(AttributeKind::Align { align, span })
324+
Some(AttributeKind::RustcAlign { align, span })
325325
}
326326
}
327327

328328
#[derive(Default)]
329-
pub(crate) struct AlignStaticParser(AlignParser);
329+
pub(crate) struct RustcAlignStaticParser(RustcAlignParser);
330330

331-
impl AlignStaticParser {
331+
impl RustcAlignStaticParser {
332332
const PATH: &[Symbol] = &[sym::rustc_align_static];
333-
const TEMPLATE: AttributeTemplate = AlignParser::TEMPLATE;
333+
const TEMPLATE: AttributeTemplate = RustcAlignParser::TEMPLATE;
334334

335335
fn parse<S: Stage>(&mut self, cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) {
336336
self.0.parse(cx, args)
337337
}
338338
}
339339

340-
impl<S: Stage> AttributeParser<S> for AlignStaticParser {
340+
impl<S: Stage> AttributeParser<S> for RustcAlignStaticParser {
341341
const ATTRIBUTES: AcceptMapping<Self, S> = &[(Self::PATH, Self::TEMPLATE, Self::parse)];
342342
const ALLOWED_TARGETS: AllowedTargets =
343343
AllowedTargets::AllowList(&[Allow(Target::Static), Allow(Target::ForeignStatic)]);
344344

345345
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
346346
let (align, span) = self.0.0?;
347-
Some(AttributeKind::Align { align, span })
347+
Some(AttributeKind::RustcAlign { align, span })
348348
}
349349
}

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ impl<S: Stage> SingleAttributeParser<S> for RustcMustImplementOneOfParser {
7171
}
7272
}
7373

74-
pub(crate) struct RustcNeverReturnsNullPointerParser;
74+
pub(crate) struct RustcNeverReturnsNullPtrParser;
7575

76-
impl<S: Stage> NoArgsAttributeParser<S> for RustcNeverReturnsNullPointerParser {
76+
impl<S: Stage> NoArgsAttributeParser<S> for RustcNeverReturnsNullPtrParser {
7777
const PATH: &[Symbol] = &[sym::rustc_never_returns_null_ptr];
7878
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
7979
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
@@ -83,7 +83,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcNeverReturnsNullPointerParser {
8383
Allow(Target::Method(MethodKind::Trait { body: true })),
8484
Allow(Target::Method(MethodKind::TraitImpl)),
8585
]);
86-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNeverReturnsNullPointer;
86+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNeverReturnsNullPtr;
8787
}
8888
pub(crate) struct RustcNoImplicitAutorefsParser;
8989

@@ -1215,9 +1215,10 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcNonnullOptimizationGuaranteedPa
12151215
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNonnullOptimizationGuaranteed;
12161216
}
12171217

1218-
pub(crate) struct RustcSymbolName;
1218+
pub(crate) struct RustcSymbolNameParser;
12191219

1220-
impl<S: Stage> SingleAttributeParser<S> for RustcSymbolName {
1220+
impl<S: Stage> SingleAttributeParser<S> for RustcSymbolNameParser {
1221+
const PATH: &[Symbol] = &[sym::rustc_symbol_name];
12211222
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
12221223
Allow(Target::Fn),
12231224
Allow(Target::Method(MethodKind::TraitImpl)),
@@ -1228,7 +1229,6 @@ impl<S: Stage> SingleAttributeParser<S> for RustcSymbolName {
12281229
Allow(Target::Impl { of_trait: false }),
12291230
]);
12301231
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
1231-
const PATH: &[Symbol] = &[sym::rustc_symbol_name];
12321232
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
12331233
const TEMPLATE: AttributeTemplate = template!(Word);
12341234
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
@@ -1240,9 +1240,10 @@ impl<S: Stage> SingleAttributeParser<S> for RustcSymbolName {
12401240
}
12411241
}
12421242

1243-
pub(crate) struct RustcDefPath;
1243+
pub(crate) struct RustcDefPathParser;
12441244

1245-
impl<S: Stage> SingleAttributeParser<S> for RustcDefPath {
1245+
impl<S: Stage> SingleAttributeParser<S> for RustcDefPathParser {
1246+
const PATH: &[Symbol] = &[sym::rustc_def_path];
12461247
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
12471248
Allow(Target::Fn),
12481249
Allow(Target::Method(MethodKind::TraitImpl)),
@@ -1253,7 +1254,6 @@ impl<S: Stage> SingleAttributeParser<S> for RustcDefPath {
12531254
Allow(Target::Impl { of_trait: false }),
12541255
]);
12551256
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
1256-
const PATH: &[Symbol] = &[sym::rustc_def_path];
12571257
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
12581258
const TEMPLATE: AttributeTemplate = template!(Word);
12591259
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {

compiler/rustc_attr_parsing/src/attributes/stability.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ impl<S: Stage> AttributeParser<S> for BodyStabilityParser {
177177
}
178178
}
179179

180-
pub(crate) struct ConstStabilityIndirectParser;
181-
impl<S: Stage> NoArgsAttributeParser<S> for ConstStabilityIndirectParser {
180+
pub(crate) struct RustcConstStableIndirectParser;
181+
impl<S: Stage> NoArgsAttributeParser<S> for RustcConstStableIndirectParser {
182182
const PATH: &[Symbol] = &[sym::rustc_const_stable_indirect];
183183
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore;
184184
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
185185
Allow(Target::Fn),
186186
Allow(Target::Method(MethodKind::Inherent)),
187187
]);
188-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcConstStabilityIndirect;
188+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcConstStableIndirect;
189189
}
190190

191191
#[derive(Default)]

0 commit comments

Comments
 (0)