Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
cd551c3
std: Switch implementations of `thread_local!` for WASI
alexcrichton Jul 22, 2026
1bd4fa0
Add tuple never coercion collection regression test
chenyukang Jul 24, 2026
82b5964
Update expect message using the recommended style in binary_heap module
SzilvasiPeter Jul 24, 2026
bae7e21
Check unsafe impls on safe EIIs
AsakuraMizu Jul 23, 2026
4bd52e9
Remove redundant `#[rustc_paren_sugar]` feature gate
mejrs Jul 24, 2026
75529d4
rustc_parse: Stop returning `Option` from statement parsing
petrochenkov Jul 24, 2026
a32fa44
Updated expect messages for CString struct and method documentation
asder8215 Jul 24, 2026
36ef11a
Update expect messages in library/alloc/boxed.rs and library/alloc/st…
Colepng Jul 25, 2026
05bb184
sembr src/variance.md
tshepang Jul 25, 2026
5d19c92
Prepare for merging from rust-lang/rust
invalid-email-address Jul 25, 2026
bb4b62b
Merge ref 'da86f4d0726b' from rust-lang/rust
invalid-email-address Jul 25, 2026
acb9407
Split multiline derives into std/rustc macros
mejrs Jul 25, 2026
d57ee22
improve variance.md
tshepang Jul 25, 2026
4196283
Add warning for breakage hazard for introducing new builtin attrs
jieyouxu Jul 25, 2026
d44d12d
Merge pull request #2944 from jieyouxu/builtin_attr
jieyouxu Jul 25, 2026
f36f2b9
sembr src/rustdoc-internals/rustdoc-gui-test-suite.md
tshepang Jul 25, 2026
0d9c6a4
overlong
tshepang Jul 25, 2026
c565998
punctuation
tshepang Jul 25, 2026
54c2643
sembr src/rustdoc-internals/search.md
tshepang Jul 25, 2026
3aecf93
Fix `find_attr` hygiene issues
mejrs Jul 25, 2026
71f1401
typo
tshepang Jul 25, 2026
19ec811
sembr src/stability-guarantees.md
tshepang Jul 25, 2026
2500a68
sembr src/pat-exhaustive-checking.md
tshepang Jul 25, 2026
beddeb0
remove `extern crate self as rustc_hir;` statement
mejrs Jul 25, 2026
72da0f5
improve pat-exhaustive-checking.md
tshepang Jul 25, 2026
a477499
sembr src/ast-validation.md
tshepang Jul 25, 2026
8da4c50
sembr src/notification-groups/gpu-target.md
tshepang Jul 25, 2026
a88b4f0
improve notification-groups/gpu-target.md
tshepang Jul 25, 2026
be78fc8
sembr src/notification-groups/wasm.md
tshepang Jul 25, 2026
01f3867
select the right text to link
tshepang Jul 25, 2026
5c30492
sembr src/const-eval.md
tshepang Jul 25, 2026
721d2b3
Merge pull request #2945 from rust-lang/tshepang/misc
tshepang Jul 25, 2026
ac7ecbd
Merge pull request #2943 from rust-lang/rustc-pull
tshepang Jul 25, 2026
6ce8067
sembr src/attributes.md
tshepang Jul 25, 2026
0dc322b
reflow
tshepang Jul 25, 2026
67e048e
sembr src/tests/autodiff-ci-job.md
tshepang Jul 25, 2026
b5803d3
sembr src/profiling/with-perf.md
tshepang Jul 25, 2026
b7f7f0d
improve profiling/with-perf.md
tshepang Jul 25, 2026
c39587c
Merge pull request #2946 from rust-lang/tshepang/misc
tshepang Jul 25, 2026
4d31be2
Flatten `nested_filter` module, and rename `None`.
mejrs Jul 25, 2026
b41588f
Replace `unreachable!` with `!`
mejrs Jul 25, 2026
c49a172
Note that the expected runtime signature is for the current target only
Urgau Jul 25, 2026
7b3e992
Split the bootstrap `Step` trait into multiple traits
Zalathar Jul 13, 2026
147c13a
Move extern static mut linkage check to check_attr
mejrs Jul 20, 2026
e75e08d
update linkage test
mejrs Jul 20, 2026
8b3a75c
reject linkage attr on const fn
mejrs Jul 20, 2026
641d79e
Add fixme
mejrs Jul 20, 2026
029a240
fix: error in diagnostic on_unmatched_args
amirHdev Jul 25, 2026
7ffc037
disallow linkage on trait methods without body
mejrs Jul 20, 2026
b8fd8a8
spare capacity mut constification
bend-n Jul 25, 2026
ecc8402
rename abort_unwind → abort_on_unwind
RalfJung Jul 25, 2026
aae9c69
Adjust linkage error wording
mejrs Jul 25, 2026
c9ef902
line-tables-only test: check that the line number matches the functio…
RalfJung Jul 24, 2026
f2e0edf
rustc_trait_selection: fix trait solver hang caused by degenerate obl…
InvalidPathException Jul 25, 2026
2360529
Various cleanups around rustc_attr_parsing
qaijuang Jul 25, 2026
7697f3d
Fix obsolete `P` reference
mejrs Jul 25, 2026
e24189e
Update `SyntheticAttr` docs
mejrs Jul 25, 2026
b81e756
Minor doc comment formatting
mejrs Jul 25, 2026
4cf766b
Implement `str::copy_from_str`
valentynkit Jul 26, 2026
d097b81
Update expect messages in library/core/src/ptr/non_null.rs
nirmaladvani Jul 26, 2026
6206d04
Update Enzyme submodule to imporve llvm-cov
ZuseZ4 Jul 26, 2026
29249fe
Rollup merge of #159638 - Zalathar:step-split, r=jieyouxu
JonathanBrouwer Jul 26, 2026
b1a056f
Rollup merge of #159774 - InvalidPathException:fix-old-solver-hang, r…
JonathanBrouwer Jul 26, 2026
8180a7e
Rollup merge of #159837 - RalfJung:line-tables-only, r=jieyouxu
JonathanBrouwer Jul 26, 2026
6fd722f
Rollup merge of #159946 - ZuseZ4:enzyme-update-llvm-cov, r=jieyouxu
JonathanBrouwer Jul 26, 2026
14e33a4
Rollup merge of #159617 - mejrs:weak_linkage, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
21a9de0
Rollup merge of #159733 - alexcrichton:wasi-thread-locals, r=clarfonthey
JonathanBrouwer Jul 26, 2026
d8557d1
Rollup merge of #159783 - AsakuraMizu:safe-eii-unsafe-impl, r=mejrs,J…
JonathanBrouwer Jul 26, 2026
8a59154
Rollup merge of #159810 - chenyukang:yukang-fix-100727-tuple-never-co…
JonathanBrouwer Jul 26, 2026
3e6377e
Rollup merge of #159821 - SzilvasiPeter:main, r=Darksonn
JonathanBrouwer Jul 26, 2026
38465a8
Rollup merge of #159826 - mejrs:sugar_parens, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
d5b7448
Rollup merge of #159846 - valentynkit:str-copy-from-str, r=jhpratt
JonathanBrouwer Jul 26, 2026
b35e514
Rollup merge of #159849 - petrochenkov:estmt, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
91efad5
Rollup merge of #159853 - asder8215:cstr_expect, r=fee1-dead
JonathanBrouwer Jul 26, 2026
be74601
Rollup merge of #159875 - qaijuang:159508-follow-up, r=mejrs
JonathanBrouwer Jul 26, 2026
e0735b1
Rollup merge of #159882 - Colepng:main, r=Darksonn
JonathanBrouwer Jul 26, 2026
4b8f682
Rollup merge of #159891 - mejrs:split_derives, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
a614f62
Rollup merge of #159893 - mejrs:find_attr_hygiene, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
5b6c600
Rollup merge of #159895 - tshepang:rdg-sync, r=tshepang
JonathanBrouwer Jul 26, 2026
739033d
Rollup merge of #159902 - Urgau:runtime-symbols-for-current-target, r…
JonathanBrouwer Jul 26, 2026
4a2ea8a
Rollup merge of #159914 - amirHdev:fix-on-unmatched-args, r=mejrs
JonathanBrouwer Jul 26, 2026
ac29265
Rollup merge of #159917 - bend-n:split_at_capacity_constifications, r…
JonathanBrouwer Jul 26, 2026
8d2f89d
Rollup merge of #159918 - RalfJung:abort_unwind, r=hanna-kruppe
JonathanBrouwer Jul 26, 2026
6c0f57d
Rollup merge of #159936 - mejrs:ast_docs, r=chenyukang
JonathanBrouwer Jul 26, 2026
be867b8
Rollup merge of #159945 - nirmaladvani:nonnull_expect, r=jhpratt
JonathanBrouwer Jul 26, 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
25 changes: 17 additions & 8 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub struct PathSegment {
/// `None` means that no parameter list is supplied (`Path`),
/// `Some` means that parameter list is supplied (`Path<X, Y>`)
/// but it can be empty (`Path<>`).
/// `P` is used as a size optimization for the common case with no parameters.
/// `Box` is used as a size optimization for the common case with no parameters.
pub args: Option<Box<GenericArgs>>,
}

Expand Down Expand Up @@ -557,9 +557,10 @@ pub struct Crate {
pub is_placeholder: bool,
}

/// A semantic representation of a meta item. A meta item is a slightly
/// restricted form of an attribute -- it can only contain expressions in
/// certain leaf positions, rather than arbitrary token streams -- that is used
/// A semantic representation of a meta item.
///
/// A meta item is a slightly restricted form of an attribute -- it can only contain
/// expressions in certain leaf positions, rather than arbitrary token streams -- that is used
/// for most built-in attributes.
///
/// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`.
Expand Down Expand Up @@ -806,6 +807,7 @@ impl ByRef {
}

/// The mode of a binding (`mut`, `ref mut`, etc).
///
/// Used for both the explicit binding annotations given in the HIR for a binding
/// and the final binding mode that we infer after type inference/match ergonomics.
/// `.0` is the by-reference mode (`ref`, `ref mut`, or by value),
Expand Down Expand Up @@ -1184,7 +1186,9 @@ impl UnOp {
}
}

/// A statement. No `attrs` or `tokens` fields because each `StmtKind` variant
/// A statement.
///
/// No `attrs` or `tokens` fields because each `StmtKind` variant
/// contains an AST node with those fields. (Except for `StmtKind::Empty`,
/// which never has attrs or tokens)
#[derive(Clone, Encodable, Decodable, Debug)]
Expand Down Expand Up @@ -1375,6 +1379,8 @@ pub enum UnsafeSource {
UserProvided,
}

/// An anonymous constant.
///
/// A constant (expression) that's not an item or associated item,
/// but needs its own `DefId` for type-checking, const-eval, etc.
/// These are usually found nested inside types (e.g., array lengths)
Expand Down Expand Up @@ -1962,8 +1968,9 @@ pub enum UnsafeBinderCastKind {
Unwrap,
}

/// The explicit `Self` type in a "qualified path". The actual
/// path, including the trait and the associated item, is stored
/// The explicit `Self` type in a "qualified path".
///
/// The actual path, including the trait and the associated item, is stored
/// separately. `position` represents the index of the associated
/// item qualified with this `Self` type.
///
Expand Down Expand Up @@ -3491,6 +3498,8 @@ pub struct AttrItem {
pub span: Span,
}

/// A synthetic attribute.
///
/// Synthetic attributes are inserted by the compiler. They cannot be written in source code, and
/// so cannot be pretty-printed by the AST pretty printer (because its output should be valid Rust
/// code). They receive special treatment because they must not affect observable language
Expand All @@ -3513,7 +3522,7 @@ pub enum SyntheticAttr {
/// evaluated true or not (or even failed to parse). The `pred` and `attrs` are not recorded
/// because they are not needed.
///
/// The attribute is used by some clippy lints.
/// The attribute is used by rustdoc to display `doc_cfg` information and by some clippy lints.
CfgAttrTrace(CfgEntry),
}

Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::attrs::EiiImpl {
span: self.lower_span(*span),
inner_span: self.lower_span(*inner_span),
impl_marked_unsafe: self.lower_safety(*impl_safety, hir::Safety::Safe).is_unsafe(),
impl_unsafe_span: match *impl_safety {
Safety::Unsafe(span) => Some(self.lower_span(span)),
Safety::Safe(_) | Safety::Default => None,
},
is_default: *is_default,
resolution,
}
Expand Down
27 changes: 8 additions & 19 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl AttributeParser for NakedParser {
if other_attr.word_is(sym::target_feature) {
if !cx.features().naked_functions_target_feature() {
feature_err(
&cx.sess(),
cx.sess(),
sym::naked_functions_target_feature,
other_attr.span(),
"`#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions",
Expand Down Expand Up @@ -396,7 +396,7 @@ impl AttributeParser for UsedParser {
Some(sym::compiler) => {
if !cx.features().used_with_arg() {
feature_err(
&cx.sess(),
cx.sess(),
sym::used_with_arg,
cx.attr_span,
"`#[used(compiler)]` is currently unstable",
Expand All @@ -408,7 +408,7 @@ impl AttributeParser for UsedParser {
Some(sym::linker) => {
if !cx.features().used_with_arg() {
feature_err(
&cx.sess(),
cx.sess(),
sym::used_with_arg,
cx.attr_span,
"`#[used(linker)]` is currently unstable",
Expand Down Expand Up @@ -503,7 +503,7 @@ fn parse_tf_attribute(
let Some(value_str) = cx.expect_string_literal(value) else {
return features;
};
for feature in value_str.as_str().split(",") {
for feature in value_str.as_str().split(',') {
features.push((Symbol::intern(feature), item.span()));
}
}
Expand Down Expand Up @@ -602,7 +602,7 @@ impl SingleAttributeParser for InstrumentFnParser {
const STABILITY: AttributeStability = unstable!(instrument_fn);

fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
let instrument = match args {
match args {
ArgParser::NameValue(nv) => match nv.value_as_str() {
Some(sym::on) => Some(AttributeKind::InstrumentFn(InstrumentFnAttr::On)),
Some(sym::off) => Some(AttributeKind::InstrumentFn(InstrumentFnAttr::Off)),
Expand All @@ -621,8 +621,7 @@ impl SingleAttributeParser for InstrumentFnParser {
cx.adcx().expected_specific_argument_strings(span, &[sym::on, sym::off]);
None
}
};
instrument
}
}
}

Expand Down Expand Up @@ -673,14 +672,7 @@ impl SingleAttributeParser for SanitizeParser {
let is_on = match value.value_as_str() {
Some(sym::on) => true,
Some(sym::off) => false,
Some(_) => {
cx.adcx().expected_specific_argument_strings(
value.value_span,
&[sym::on, sym::off],
);
return;
}
None => {
_ => {
cx.adcx().expected_specific_argument_strings(
value.value_span,
&[sym::on, sym::off],
Expand Down Expand Up @@ -737,7 +729,6 @@ impl SingleAttributeParser for SanitizeParser {
sym::realtime,
],
);
continue;
}
}
}
Expand Down Expand Up @@ -809,9 +800,7 @@ impl SingleAttributeParser for PatchableFunctionEntryParser {
}

for item in meta_item_list.mixed() {
let Some((ident, value)) = cx.expect_name_value(item, item.span(), None) else {
return None;
};
let (ident, value) = cx.expect_name_value(item, item.span(), None)?;

let attrib_to_write = match ident.name {
sym::prefix_nops => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/deprecation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn get(
if let Some(value_str) = v.value_as_ident() {
Some(value_str)
} else {
cx.adcx().expected_string_literal(v.value_span, Some(&v.value_as_lit()));
cx.adcx().expected_string_literal(v.value_span, Some(v.value_as_lit()));
None
}
}
Expand Down
39 changes: 19 additions & 20 deletions compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) enum Mode {
}

impl Mode {
fn as_str(&self) -> &'static str {
fn as_str(self) -> &'static str {
match self {
Self::RustcOnUnimplemented => "rustc_on_unimplemented",
Self::DiagnosticOnUnimplemented => "diagnostic::on_unimplemented",
Expand All @@ -61,7 +61,7 @@ impl Mode {
}
}

fn expected_options(&self) -> &'static str {
fn expected_options(self) -> &'static str {
const DEFAULT: &str =
"at least one of the `message`, `note` and `label` options are expected";
const DIAGNOSTIC_ON_TYPE_ERROR_EXPECTED_OPTIONS: &str =
Expand All @@ -70,33 +70,33 @@ impl Mode {
Self::RustcOnUnimplemented => {
"see <https://rustc-dev-guide.rust-lang.org/diagnostics.html#rustc_on_unimplemented>"
}
Self::DiagnosticOnUnimplemented => DEFAULT,
Self::DiagnosticOnConst => DEFAULT,
Self::DiagnosticOnMove => DEFAULT,
Self::DiagnosticOnUnknown => DEFAULT,
Self::DiagnosticOnUnmatchedArgs => DEFAULT,
Self::DiagnosticOnUnimplemented
| Self::DiagnosticOnConst
| Self::DiagnosticOnMove
| Self::DiagnosticOnUnknown
| Self::DiagnosticOnUnmatchedArgs => DEFAULT,
Self::DiagnosticOnTypeError => DIAGNOSTIC_ON_TYPE_ERROR_EXPECTED_OPTIONS,
}
}

fn allowed_options(&self) -> &'static str {
fn allowed_options(self) -> &'static str {
const DEFAULT: &str = "only `message`, `note` and `label` are allowed as options";
const DIAGNOSTIC_ON_TYPE_ERROR_ALLOWED_OPTIONS: &str =
"only `note` is allowed as option for `diagnostic::on_type_error`";
match self {
Self::RustcOnUnimplemented => {
"see <https://rustc-dev-guide.rust-lang.org/diagnostics.html#rustc_on_unimplemented>"
}
Self::DiagnosticOnUnimplemented => DEFAULT,
Self::DiagnosticOnConst => DEFAULT,
Self::DiagnosticOnMove => DEFAULT,
Self::DiagnosticOnUnknown => DEFAULT,
Self::DiagnosticOnUnmatchedArgs => DEFAULT,
Self::DiagnosticOnUnimplemented
| Self::DiagnosticOnConst
| Self::DiagnosticOnMove
| Self::DiagnosticOnUnknown
| Self::DiagnosticOnUnmatchedArgs => DEFAULT,
Self::DiagnosticOnTypeError => DIAGNOSTIC_ON_TYPE_ERROR_ALLOWED_OPTIONS,
}
}

fn allowed_format_arguments(&self) -> &'static str {
fn allowed_format_arguments(self) -> &'static str {
match self {
Self::RustcOnUnimplemented => {
"see <https://rustc-dev-guide.rust-lang.org/diagnostics.html#rustc_on_unimplemented> for allowed format arguments"
Expand Down Expand Up @@ -356,12 +356,11 @@ fn parse_directive_items<'p>(
if is_root {
let items = or_malformed!(item.args().as_list()?);
let mut iter = items.mixed();
let filter: &MetaItemOrLitParser = match iter.next() {
Some(c) => c,
None => {
cx.emit_err(InvalidOnClause::Empty { span });
continue;
}
let filter = if let Some(c) = iter.next() {
c
} else {
cx.emit_err(InvalidOnClause::Empty { span });
continue;
};

let filter = parse_filter(filter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ impl AttributeParser for OnUnmatchedArgsParser {
AttributeStability::Stable, // Unstable, stability checked manually in the parser
|this, cx, args| {
if !cx.features().diagnostic_on_unmatched_args() {
// `UnknownDiagnosticAttribute` is emitted in rustc_resolve/macros.rs
args.ignore_args();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl AttributeParser for OpaqueParser {
AllowedTargets::AllowListWarnRest(&[Allow(Target::MacroDef)]);

fn finalize(self, _cx: &FinalizeContext<'_, '_>) -> Option<AttributeKind> {
if let Some(_) = self.attr_span { Some(AttributeKind::Opaque) } else { None }
if self.attr_span.is_some() { Some(AttributeKind::Opaque) } else { None }
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ impl SingleAttributeParser for InlineParser {
}
_ => {
cx.adcx().expected_specific_argument(l.span(), &[sym::always, sym::never]);
return None;
None
}
}
}
ArgParser::NameValue(_) => {
cx.adcx().warn_ill_formed_attribute_input(ILL_FORMED_ATTRIBUTE_INPUT);
return None;
None
}
}
}
Expand Down
30 changes: 16 additions & 14 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ impl CombineAttributeParser for LinkParser {
let mut verbatim = None;
if let Some((modifiers, span)) = modifiers {
for modifier in modifiers.as_str().split(',') {
let (modifier, value): (Symbol, bool) = match modifier.strip_prefix(&['+', '-']) {
Some(m) => (Symbol::intern(m), modifier.starts_with('+')),
None => {
let (modifier, value): (Symbol, bool) =
if let Some(m) = modifier.strip_prefix(['+', '-']) {
(Symbol::intern(m), modifier.starts_with('+'))
} else {
cx.emit_err(InvalidLinkModifier { span });
continue;
}
};
};

macro report_unstable_modifier($feature: ident) {
if !features.$feature() {
Expand Down Expand Up @@ -196,9 +196,14 @@ impl CombineAttributeParser for LinkParser {
cx.emit_err(WholeArchiveNeedsStatic { span });
}

(sym::as_dash_needed, Some(NativeLibKind::Dylib { as_needed }))
| (sym::as_dash_needed, Some(NativeLibKind::Framework { as_needed }))
| (sym::as_dash_needed, Some(NativeLibKind::RawDylib { as_needed })) => {
(
sym::as_dash_needed,
Some(
NativeLibKind::Dylib { as_needed }
| NativeLibKind::Framework { as_needed }
| NativeLibKind::RawDylib { as_needed },
),
) => {
report_unstable_modifier!(native_link_modifiers_as_needed);
assign_modifier(as_needed)
}
Expand Down Expand Up @@ -642,14 +647,13 @@ pub(crate) struct LinkageParser;
impl SingleAttributeParser for LinkageParser {
const PATH: &[Symbol] = &[sym::linkage];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Fn), // const fn denied in check_attr
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
Allow(Target::Static),
Allow(Target::ForeignStatic),
Allow(Target::ForeignStatic), // extern static mut denied in check_attr
Allow(Target::ForeignFn),
Warn(Target::Method(MethodKind::Trait { body: false })), // Not inherited
]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: [
"available_externally",
Expand All @@ -667,9 +671,7 @@ impl SingleAttributeParser for LinkageParser {
fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
let name_value = cx.expect_name_value(args, cx.attr_span, Some(sym::linkage))?;

let Some(value) = cx.expect_string_literal(name_value) else {
return None;
};
let value = cx.expect_string_literal(name_value)?;

// Use the names from src/llvm/docs/LangRef.rst here. Most types are only
// applicable to variable declarations and may not really make sense for
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ impl SingleAttributeParser for MacroExportParser {
cx.adcx().warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS);
return None;
};
match l.meta_item_no_args().and_then(|i| i.path().word_sym()) {
Some(sym::local_inner_macros) => true,
_ => {
cx.adcx().warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS);
return None;
}
if l.meta_item_no_args().is_some_and(|m| m.path().word_is(sym::local_inner_macros))
{
true
} else {
cx.adcx().warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS);
return None;
}
}
ArgParser::NameValue(nv) => {
Expand Down
Loading
Loading