Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e947492
Remove -Alinker-messages
bjorn3 Jan 27, 2026
3f62540
Only set CFG_COMPILER_HOST_TRIPLE when building rustc
bjorn3 Jan 27, 2026
1331517
Unset WINAPI_NO_BUNDLED_LIBRARIES
bjorn3 Jan 27, 2026
be63994
Remove a couple of unnecessary stage checks
bjorn3 Jan 27, 2026
257ea3b
Remove outdated fixme
bjorn3 Jan 27, 2026
27f97d7
RwLock: refine documentation to emphasize non-reentrancy guarantees
hzeller Feb 3, 2026
5ea37f7
Introduce helper `ty::Generics::has_own_self`
fmease Feb 6, 2026
fd7ff90
Allow only a single accepter per attribute
JonathanBrouwer Feb 7, 2026
86daea3
Port rustc_reservation_impl to the new attribute parser
jdonszelmann Feb 5, 2026
26bd904
Port rustc_insignificant_dtor to the new attribute parser
jdonszelmann Feb 7, 2026
c397eb4
Convert to inline diagnostics in `rustc_lint`
JonathanBrouwer Feb 6, 2026
9bca16d
Remove `rustc_fluent_macro`
JonathanBrouwer Feb 6, 2026
c8d1170
Remove `ui-fulldeps` tests for slugs
JonathanBrouwer Feb 6, 2026
c2d6d93
Update remaining session-diagnostics tests
JonathanBrouwer Feb 7, 2026
071935e
remove from impl block in std
jdonszelmann Feb 7, 2026
e2f0f16
Rollup merge of #151745 - bjorn3:remove_unnecessary_flags, r=clubby789
JonathanBrouwer Feb 7, 2026
09c11da
Rollup merge of #152217 - JonathanBrouwer:convert_line, r=jdonszelmann
JonathanBrouwer Feb 7, 2026
f72e11c
Rollup merge of #152056 - hzeller:feature-20260203-clarify-rwlock-ree…
JonathanBrouwer Feb 7, 2026
dbad4a0
Rollup merge of #152180 - jdonszelmann:port-rustc-reservation-impl, r…
JonathanBrouwer Feb 7, 2026
011954d
Rollup merge of #152261 - fmease:has-own-self, r=BoxyUwU
JonathanBrouwer Feb 7, 2026
4a57048
Rollup merge of #152288 - JonathanBrouwer:one_accepter_per_attr, r=jd…
JonathanBrouwer Feb 7, 2026
627e185
Rollup merge of #152291 - jdonszelmann:port-rustc-insignificant-dtor,…
JonathanBrouwer Feb 7, 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
14 changes: 0 additions & 14 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3887,19 +3887,6 @@ dependencies = [
"serde_json",
]

[[package]]
name = "rustc_fluent_macro"
version = "0.0.0"
dependencies = [
"annotate-snippets 0.11.5",
"fluent-bundle",
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.110",
"unic-langid",
]

[[package]]
name = "rustc_fs_util"
version = "0.0.0"
Expand Down Expand Up @@ -4142,7 +4129,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
Expand Down
40 changes: 40 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ impl<S: Stage> CombineAttributeParser<S> for RustcMirParser {
.collect()
}
}

pub(crate) struct RustcNonConstTraitMethodParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcNonConstTraitMethodParser {
Expand Down Expand Up @@ -722,6 +723,19 @@ impl<S: Stage> CombineAttributeParser<S> for RustcThenThisWouldNeedParser {
}
}

pub(crate) struct RustcInsignificantDtorParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcInsignificantDtorParser {
const PATH: &[Symbol] = &[sym::rustc_insignificant_dtor];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Enum),
Allow(Target::Struct),
Allow(Target::ForeignTy),
]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcInsignificantDtor;
}

pub(crate) struct RustcEffectiveVisibilityParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcEffectiveVisibilityParser {
Expand Down Expand Up @@ -810,3 +824,29 @@ impl<S: Stage> SingleAttributeParser<S> for RustcDefPath {
Some(AttributeKind::RustcDefPath(cx.attr_span))
}
}

pub(crate) struct RustcReservationImplParser;

impl<S: Stage> SingleAttributeParser<S> for RustcReservationImplParser {
const PATH: &[Symbol] = &[sym::rustc_reservation_impl];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Impl { of_trait: true })]);

const TEMPLATE: AttributeTemplate = template!(NameValueStr: "reservation message");

fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(nv) = args.name_value() else {
cx.expected_name_value(args.span().unwrap_or(cx.attr_span), None);
return None;
};

let Some(value_str) = nv.value_as_str() else {
cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
return None;
};

Some(AttributeKind::RustcReservationImpl(cx.attr_span, value_str))
}
}
38 changes: 23 additions & 15 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::collections::btree_map::Entry;
use std::ops::{Deref, DerefMut};
use std::sync::LazyLock;

Expand Down Expand Up @@ -61,7 +62,7 @@ use crate::target_checking::AllowedTargets;
type GroupType<S> = LazyLock<GroupTypeInner<S>>;

pub(super) struct GroupTypeInner<S: Stage> {
pub(super) accepters: BTreeMap<&'static [Symbol], Vec<GroupTypeInnerAccept<S>>>,
pub(super) accepters: BTreeMap<&'static [Symbol], GroupTypeInnerAccept<S>>,
}

pub(super) struct GroupTypeInnerAccept<S: Stage> {
Expand Down Expand Up @@ -101,27 +102,32 @@ macro_rules! attribute_parsers {
@[$stage: ty] pub(crate) static $name: ident = [$($names: ty),* $(,)?];
) => {
pub(crate) static $name: GroupType<$stage> = LazyLock::new(|| {
let mut accepters = BTreeMap::<_, Vec<GroupTypeInnerAccept<$stage>>>::new();
let mut accepters = BTreeMap::<_, GroupTypeInnerAccept<$stage>>::new();
$(
{
thread_local! {
static STATE_OBJECT: RefCell<$names> = RefCell::new(<$names>::default());
};

for (path, template, accept_fn) in <$names>::ATTRIBUTES {
accepters.entry(*path).or_default().push(GroupTypeInnerAccept {
template: *template,
accept_fn: Box::new(|cx, args| {
STATE_OBJECT.with_borrow_mut(|s| {
accept_fn(s, cx, args)
})
}),
allowed_targets: <$names as crate::attributes::AttributeParser<$stage>>::ALLOWED_TARGETS,
finalizer: Box::new(|cx| {
let state = STATE_OBJECT.take();
state.finalize(cx)
}),
});
match accepters.entry(*path) {
Entry::Vacant(e) => {
e.insert(GroupTypeInnerAccept {
template: *template,
accept_fn: Box::new(|cx, args| {
STATE_OBJECT.with_borrow_mut(|s| {
accept_fn(s, cx, args)
})
}),
allowed_targets: <$names as crate::attributes::AttributeParser<$stage>>::ALLOWED_TARGETS,
finalizer: Box::new(|cx| {
let state = STATE_OBJECT.take();
state.finalize(cx)
})
});
}
Entry::Occupied(_) => panic!("Attribute {path:?} has multiple accepters"),
}
}
}
)*
Expand Down Expand Up @@ -203,6 +209,7 @@ attribute_parsers!(
Single<RustcLintOptDenyFieldAccessParser>,
Single<RustcMustImplementOneOfParser>,
Single<RustcObjectLifetimeDefaultParser>,
Single<RustcReservationImplParser>,
Single<RustcScalableVectorParser>,
Single<RustcSimdMonomorphizeLaneLimitParser>,
Single<RustcSymbolName>,
Expand Down Expand Up @@ -264,6 +271,7 @@ attribute_parsers!(
Single<WithoutArgs<RustcEffectiveVisibilityParser>>,
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
Single<WithoutArgs<RustcHiddenTypeOfOpaquesParser>>,
Single<WithoutArgs<RustcInsignificantDtorParser>>,
Single<WithoutArgs<RustcLintOptTyParser>>,
Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,
Expand Down
44 changes: 21 additions & 23 deletions compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
let parts =
n.item.path.segments.iter().map(|seg| seg.ident.name).collect::<Vec<_>>();

if let Some(accepts) = S::parsers().accepters.get(parts.as_slice()) {
if let Some(accept) = S::parsers().accepters.get(parts.as_slice()) {
let Some(args) = ArgParser::from_attr_args(
args,
&parts,
Expand Down Expand Up @@ -368,28 +368,26 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
continue;
}

for accept in accepts {
let mut cx: AcceptContext<'_, 'sess, S> = AcceptContext {
shared: SharedContext {
cx: self,
target_span,
target,
emit_lint: &mut emit_lint,
},
attr_span,
inner_span: lower_span(n.item.span()),
attr_style: attr.style,
parsed_description: ParsedDescription::Attribute,
template: &accept.template,
attr_path: attr_path.clone(),
};

(accept.accept_fn)(&mut cx, &args);
finalizers.push(&accept.finalizer);

if !matches!(cx.stage.should_emit(), ShouldEmit::Nothing) {
Self::check_target(&accept.allowed_targets, target, &mut cx);
}
let mut cx: AcceptContext<'_, 'sess, S> = AcceptContext {
shared: SharedContext {
cx: self,
target_span,
target,
emit_lint: &mut emit_lint,
},
attr_span,
inner_span: lower_span(n.item.span()),
attr_style: attr.style,
parsed_description: ParsedDescription::Attribute,
template: &accept.template,
attr_path: attr_path.clone(),
};

(accept.accept_fn)(&mut cx, &args);
finalizers.push(&accept.finalizer);

if !matches!(cx.stage.should_emit(), ShouldEmit::Nothing) {
Self::check_target(&accept.allowed_targets, target, &mut cx);
}
} else {
// If we're here, we must be compiling a tool attribute... Or someone
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ pub fn default_translator() -> Translator {
Translator::with_fallback_bundle(DEFAULT_LOCALE_RESOURCES.to_vec(), false)
}

pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
// tidy-alphabetical-start
rustc_lint::DEFAULT_LOCALE_RESOURCE,
// tidy-alphabetical-end
];
pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[];

/// Exit status code used for successful compilation and help output.
pub const EXIT_SUCCESS: i32 = 0;
Expand Down
18 changes: 0 additions & 18 deletions compiler/rustc_fluent_macro/Cargo.toml

This file was deleted.

Loading
Loading