Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
011d95b
Neon fast path for str::contains
JamieCunliffe Jan 27, 2026
d05eb78
std: move `exit` out of PAL
joboet Feb 15, 2026
b0050c2
move `must_use` lint to a separate file
WaffleLapkin Feb 23, 2026
c6ae0a9
make `is_ty_must_use` public
WaffleLapkin Feb 23, 2026
696a105
`must_use`: internal doc improvements
WaffleLapkin Feb 23, 2026
b2cc4d5
`must_use`: make the check for trivial types cleaner
WaffleLapkin Feb 23, 2026
ae1e2c6
`must_use`: drive-by-cleanup
WaffleLapkin Feb 23, 2026
1b97e9b
add a flag to `is_ty_must_use` to simplify `Result<T, Uninhabited>` a…
WaffleLapkin Feb 23, 2026
a67baaa
Update books
rustbot Feb 23, 2026
8ac769f
Remove `rustc_feedable_queries` and `define_feedable` macros.
nnethercote Feb 23, 2026
092d4fb
Fix attribute parser and kind names.
nnethercote Feb 24, 2026
bf0f511
Clarify how "ensure" queries check whether they can skip execution
Zalathar Feb 24, 2026
16fbd29
Streamline `QueryVTableUnerased` into `GetQueryVTable`
Zalathar Feb 23, 2026
f8b5f9c
Port `#[register_tool]` to the new attribute parsers
JonathanBrouwer Feb 22, 2026
07bf6ae
Use the new parser throughout the compiler
JonathanBrouwer Feb 22, 2026
a7fb617
Rollup merge of #152176 - JamieCunliffe:neon-str-contains, r=Mark-Sim…
JonathanBrouwer Feb 24, 2026
f62e143
Rollup merge of #152657 - joboet:move_pal_exit, r=jhpratt
JonathanBrouwer Feb 24, 2026
4a5dd7d
Rollup merge of #152841 - Zalathar:unerased, r=nnethercote
JonathanBrouwer Feb 24, 2026
535d041
Rollup merge of #153009 - nnethercote:rm-define_feedable, r=oli-obk
JonathanBrouwer Feb 24, 2026
4288d87
Rollup merge of #152988 - JonathanBrouwer:register-tool, r=jdonszelmann
JonathanBrouwer Feb 24, 2026
a2e2b0e
Rollup merge of #153018 - WaffleLapkin:must_use_improvements, r=jdons…
JonathanBrouwer Feb 24, 2026
542729a
Rollup merge of #153023 - rustbot:docs-update, r=ehuss
JonathanBrouwer Feb 24, 2026
98a0c51
Rollup merge of #153032 - nnethercote:fix-attribute-names, r=Jonathan…
JonathanBrouwer Feb 24, 2026
38000b1
Rollup merge of #153033 - Zalathar:ensure, r=nnethercote
JonathanBrouwer Feb 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ impl<S: Stage> CombineAttributeParser<S> for UnstableFeatureBoundParser {
}
}

pub(crate) struct AllowConstFnUnstableParser;
impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser {
pub(crate) struct RustcAllowConstFnUnstableParser;
impl<S: Stage> CombineAttributeParser<S> for RustcAllowConstFnUnstableParser {
const PATH: &[Symbol] = &[sym::rustc_allow_const_fn_unstable];
type Item = Symbol;
const CONVERT: ConvertFn<Self::Item> =
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ impl<S: Stage> SingleAttributeParser<S> for ExportNameParser {
}
}

pub(crate) struct ObjcClassParser;
pub(crate) struct RustcObjcClassParser;

impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
impl<S: Stage> SingleAttributeParser<S> for RustcObjcClassParser {
const PATH: &[rustc_span::Symbol] = &[sym::rustc_objc_class];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
Expand Down Expand Up @@ -185,9 +185,9 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
}
}

pub(crate) struct ObjcSelectorParser;
pub(crate) struct RustcObjcSelectorParser;

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

pub(crate) struct EiiForeignItemParser;
pub(crate) struct RustcEiiForeignItemParser;

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

pub(crate) struct PatchableFunctionEntryParser;
Expand Down
47 changes: 47 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/crate_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,50 @@ impl<S: Stage> CombineAttributeParser<S> for FeatureParser {
res
}
}

pub(crate) struct RegisterToolParser;

impl<S: Stage> CombineAttributeParser<S> for RegisterToolParser {
const PATH: &[Symbol] = &[sym::register_tool];
type Item = Ident;
const CONVERT: ConvertFn<Self::Item> = AttributeKind::RegisterTool;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS);
const TEMPLATE: AttributeTemplate = template!(List: &["tool1, tool2, ..."]);

fn extend(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
) -> impl IntoIterator<Item = Self::Item> {
let ArgParser::List(list) = args else {
cx.expected_list(cx.attr_span, args);
return Vec::new();
};

if list.is_empty() {
cx.warn_empty_attribute(cx.attr_span);
}

let mut res = Vec::new();

for elem in list.mixed() {
let Some(elem) = elem.meta_item() else {
cx.expected_identifier(elem.span());
continue;
};
if let Err(arg_span) = elem.args().no_args() {
cx.expected_no_args(arg_span);
continue;
}

let path = elem.path();
let Some(ident) = path.word() else {
cx.expected_identifier(path.span());
continue;
};

res.push(ident);
}

res
}
}
7 changes: 3 additions & 4 deletions compiler/rustc_attr_parsing/src/attributes/deprecation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use crate::session_diagnostics::{
DeprecatedItemSuggestion, InvalidSince, MissingNote, MissingSince,
};

pub(crate) struct DeprecationParser;

fn get<S: Stage>(
cx: &AcceptContext<'_, '_, S>,
name: Symbol,
Expand All @@ -33,7 +31,8 @@ fn get<S: Stage>(
}
}

impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
pub(crate) struct DeprecatedParser;
impl<S: Stage> SingleAttributeParser<S> for DeprecatedParser {
const PATH: &[Symbol] = &[sym::deprecated];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
Expand Down Expand Up @@ -164,7 +163,7 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
return None;
}

Some(AttributeKind::Deprecation {
Some(AttributeKind::Deprecated {
deprecation: Deprecation { since, note, suggestion },
span: cx.attr_span,
})
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::context::{AcceptContext, Stage};
use crate::parser::ArgParser;
use crate::target_checking::{ALL_TARGETS, AllowedTargets};

pub(crate) struct DummyParser;
impl<S: Stage> SingleAttributeParser<S> for DummyParser {
pub(crate) struct RustcDummyParser;
impl<S: Stage> SingleAttributeParser<S> for RustcDummyParser {
const PATH: &[Symbol] = &[sym::rustc_dummy];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ impl<S: Stage> NoArgsAttributeParser<S> for FfiPureParser {
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiPure;
}

pub(crate) struct StdInternalSymbolParser;
impl<S: Stage> NoArgsAttributeParser<S> for StdInternalSymbolParser {
pub(crate) struct RustcStdInternalSymbolParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcStdInternalSymbolParser {
const PATH: &[Symbol] = &[sym::rustc_std_internal_symbol];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::prelude::*;

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

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

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

pub(crate) struct RustcShouldNotBeCalledOnConstItems;
impl<S: Stage> NoArgsAttributeParser<S> for RustcShouldNotBeCalledOnConstItems {
pub(crate) struct RustcShouldNotBeCalledOnConstItemsParser;
impl<S: Stage> NoArgsAttributeParser<S> for RustcShouldNotBeCalledOnConstItemsParser {
const PATH: &[Symbol] = &[sym::rustc_should_not_be_called_on_const_items];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_attr_parsing/src/attributes/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ fn parse_alignment(node: &LitKind) -> Result<Align, &'static str> {

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

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

Expand Down Expand Up @@ -308,7 +308,7 @@ impl AlignParser {
}
}

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

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

#[derive(Default)]
pub(crate) struct AlignStaticParser(AlignParser);
pub(crate) struct RustcAlignStaticParser(RustcAlignParser);

impl AlignStaticParser {
impl RustcAlignStaticParser {
const PATH: &[Symbol] = &[sym::rustc_align_static];
const TEMPLATE: AttributeTemplate = AlignParser::TEMPLATE;
const TEMPLATE: AttributeTemplate = RustcAlignParser::TEMPLATE;

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

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

fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
let (align, span) = self.0.0?;
Some(AttributeKind::Align { align, span })
Some(AttributeKind::RustcAlign { align, span })
}
}
18 changes: 9 additions & 9 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ impl<S: Stage> SingleAttributeParser<S> for RustcMustImplementOneOfParser {
}
}

pub(crate) struct RustcNeverReturnsNullPointerParser;
pub(crate) struct RustcNeverReturnsNullPtrParser;

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

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

pub(crate) struct RustcSymbolName;
pub(crate) struct RustcSymbolNameParser;

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

pub(crate) struct RustcDefPath;
pub(crate) struct RustcDefPathParser;

impl<S: Stage> SingleAttributeParser<S> for RustcDefPath {
impl<S: Stage> SingleAttributeParser<S> for RustcDefPathParser {
const PATH: &[Symbol] = &[sym::rustc_def_path];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::TraitImpl)),
Expand All @@ -1253,7 +1254,6 @@ impl<S: Stage> SingleAttributeParser<S> for RustcDefPath {
Allow(Target::Impl { of_trait: false }),
]);
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const PATH: &[Symbol] = &[sym::rustc_def_path];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const TEMPLATE: AttributeTemplate = template!(Word);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ impl<S: Stage> AttributeParser<S> for BodyStabilityParser {
}
}

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

#[derive(Default)]
Expand Down
Loading
Loading