Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
3ea68fb
[Priroda] Render indirect local values
moabo3li Jul 10, 2026
037fbe7
[Priroda] Render indirect locals with allocation dumps
moabo3li Jul 16, 2026
cc00f34
Prepare for merging from rust-lang/rust
Jul 19, 2026
7c3257d
Merge ref 'c904ba32e22c' from rust-lang/rust
Jul 19, 2026
e69e7d2
Merge pull request #5218 from rust-lang/rustup-2026-07-19
RalfJung Jul 19, 2026
18ba449
[Priroda] Render mplace local byte ranges
moabo3li Jul 16, 2026
52cc3b1
[Priroda] Render provenance-aware local bytes
moabo3li Jul 19, 2026
0726da7
[Priroda] Add follow command for allocation bytes
moabo3li Jul 19, 2026
9b5b406
Merge pull request #5217 from moabo3li/local-value-bytes-handling
oli-obk Jul 20, 2026
f9c7888
support `neon.tbl*` intrinsics
folkertdev Jul 20, 2026
763fe4d
add a riscv target to CI
RalfJung Jul 18, 2026
2c92e6d
Merge pull request #5219 from folkertdev/aarch64-table
RalfJung Jul 21, 2026
810cdc0
readme: fix misspelling of `-Ctarget-feature`
niooss-ledger Jul 21, 2026
afefb4f
bump libc
RalfJung Jul 21, 2026
132caa8
Merge pull request #5221 from niooss-ledger/readme-Ctarget-feature-typo
RalfJung Jul 21, 2026
940657f
Merge pull request #5216 from RalfJung/riscv
RalfJung Jul 21, 2026
6ca5127
Prepare for merging from rust-lang/rust
RalfJung Jul 22, 2026
ac32e6a
Merge ref '1af98b7cdf86' from rust-lang/rust
RalfJung Jul 22, 2026
94fde0c
Revert "disable `portable_simd` miri test that needs additional intri…
RalfJung Jul 22, 2026
cabd1f1
disable swizzle_dyn test on loongarch
RalfJung Jul 22, 2026
7e9fba3
Merge pull request #5224 from RalfJung/rustup
RalfJung Jul 22, 2026
cd551c3
std: Switch implementations of `thread_local!` for WASI
alexcrichton Jul 22, 2026
525e1aa
Prepare for merging from rust-lang/rust
Jul 23, 2026
2f39e7e
Merge ref '390279b302ca' from rust-lang/rust
Jul 23, 2026
21b23c2
[Priroda] Test projected mplace value range rendering
moabo3li Jul 23, 2026
d37c84d
[Priroda] Render projected debug-info values
moabo3li Jul 21, 2026
c9492bb
Merge pull request #5225 from rust-lang/rustup-2026-07-23
RalfJung Jul 23, 2026
a9bc5ec
Merge pull request #5220 from moabo3li/handle-projected-values
oli-obk Jul 23, 2026
1bd4fa0
Add tuple never coercion collection regression test
chenyukang 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
dbd4894
Remove sve2 from the ImpliedFeatures of AArch64 v9a.
chrisnc Jul 25, 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
8e0f2e9
Add CFI tests for return types and never type
Darksonn Jul 26, 2026
b982472
Make attribute template suggestions work at the level of attr items
nnethercote Jul 16, 2026
d506f47
Add a `cfg_attr` case to the `invalid_macro_export_argument.rs` test
nnethercote Jul 26, 2026
6fe13d9
tests: extend remap-path-prefix-std to all stdlib rlibs
paradoxicalguy May 14, 2026
00fb385
Make attribute suggestions work at the level of attr items
nnethercote Jul 26, 2026
0fe5073
Remove `AttributeDiagnosticContext::template_suggestions`
nnethercote Jul 26, 2026
42b6f4f
Remove `AttrSuggestionStyle::Attribute`
nnethercote Jul 26, 2026
4981cac
Remove `AttrSuggestionStyle`
nnethercote Jul 26, 2026
4e77b02
Rollup merge of #159638 - Zalathar:step-split, r=jieyouxu
JonathanBrouwer Jul 26, 2026
11959e9
Rollup merge of #159774 - InvalidPathException:fix-old-solver-hang, r…
JonathanBrouwer Jul 26, 2026
fb3d9e1
Rollup merge of #159837 - RalfJung:line-tables-only, r=jieyouxu
JonathanBrouwer Jul 26, 2026
a34d274
Rollup merge of #159946 - ZuseZ4:enzyme-update-llvm-cov, r=jieyouxu
JonathanBrouwer Jul 26, 2026
da59adf
Rollup merge of #159962 - RalfJung:miri, r=RalfJung
JonathanBrouwer Jul 26, 2026
0b9cec8
Rollup merge of #156570 - paradoxicalguy:test-extend-rmake-clean, r=U…
JonathanBrouwer Jul 26, 2026
672e497
Rollup merge of #159617 - mejrs:weak_linkage, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
085f527
Rollup merge of #159633 - nnethercote:attr-suggestions, r=JonathanBro…
JonathanBrouwer Jul 26, 2026
a61082b
Rollup merge of #159733 - alexcrichton:wasi-thread-locals, r=clarfonthey
JonathanBrouwer Jul 26, 2026
d80d243
Rollup merge of #159783 - AsakuraMizu:safe-eii-unsafe-impl, r=mejrs,J…
JonathanBrouwer Jul 26, 2026
4c2d581
Rollup merge of #159810 - chenyukang:yukang-fix-100727-tuple-never-co…
JonathanBrouwer Jul 26, 2026
51cddf7
Rollup merge of #159826 - mejrs:sugar_parens, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
6003122
Rollup merge of #159846 - valentynkit:str-copy-from-str, r=jhpratt
JonathanBrouwer Jul 26, 2026
d01433c
Rollup merge of #159849 - petrochenkov:estmt, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
d743682
Rollup merge of #159853 - asder8215:cstr_expect, r=fee1-dead
JonathanBrouwer Jul 26, 2026
7b8dc81
Rollup merge of #159875 - qaijuang:159508-follow-up, r=mejrs
JonathanBrouwer Jul 26, 2026
f3daf4d
Rollup merge of #159882 - Colepng:main, r=Darksonn
JonathanBrouwer Jul 26, 2026
2d66d74
Rollup merge of #159891 - mejrs:split_derives, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
cc8eba8
Rollup merge of #159893 - mejrs:find_attr_hygiene, r=JonathanBrouwer
JonathanBrouwer Jul 26, 2026
b1a8ab5
Rollup merge of #159895 - tshepang:rdg-sync, r=tshepang
JonathanBrouwer Jul 26, 2026
6445bf7
Rollup merge of #159902 - Urgau:runtime-symbols-for-current-target, r…
JonathanBrouwer Jul 26, 2026
6621194
Rollup merge of #159914 - amirHdev:fix-on-unmatched-args, r=mejrs
JonathanBrouwer Jul 26, 2026
cc06a86
Rollup merge of #159917 - bend-n:split_at_capacity_constifications, r…
JonathanBrouwer Jul 26, 2026
251131f
Rollup merge of #159918 - RalfJung:abort_unwind, r=hanna-kruppe
JonathanBrouwer Jul 26, 2026
9c68504
Rollup merge of #159927 - chrisnc:aarch64-v9a-no-sve2, r=folkertdev
JonathanBrouwer Jul 26, 2026
db1e471
Rollup merge of #159936 - mejrs:ast_docs, r=chenyukang
JonathanBrouwer Jul 26, 2026
4fd888f
Rollup merge of #159945 - nirmaladvani:nonnull_expect, r=jhpratt
JonathanBrouwer Jul 26, 2026
e6a1a8f
Rollup merge of #159950 - Darksonn:cfi-return-types, r=folkertdev
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 @@ -3503,6 +3510,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 @@ -3525,7 +3534,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
10 changes: 4 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ use crate::session_diagnostics::{
ParsedDescription,
};
use crate::{
AttrSuggestionStyle, AttributeParser, AttributeTemplate, check_cfg, parse_version,
session_diagnostics, template,
AttributeParser, AttributeTemplate, check_cfg, parse_version, session_diagnostics, template,
};

pub const CFG_TEMPLATE: AttributeTemplate = template!(
Expand Down Expand Up @@ -329,12 +328,12 @@ pub fn parse_cfg_attr(
Ok(r) => return Some(r),
Err(e) => {
let suggestions = CFG_ATTR_TEMPLATE.suggestions(
AttrSuggestionStyle::Attribute(cfg_attr.style),
ParsedDescription::Attribute,
cfg_attr.get_normal_item().unsafety,
sym::cfg_attr,
);
e.with_span_suggestions(
cfg_attr.span,
cfg_attr.get_normal_item().span,
"must be of the form",
suggestions,
Applicability::HasPlaceholders,
Expand All @@ -358,15 +357,14 @@ pub fn parse_cfg_attr(

sess.dcx().emit_err(AttributeParseError {
span,
attr_span: cfg_attr.span,
inner_span: cfg_attr.get_normal_item().span,
template: CFG_ATTR_TEMPLATE,
path: AttrPath::from_ast(&cfg_attr.get_normal_item().path, identity),
description: ParsedDescription::Attribute,
reason,
suggestions: session_diagnostics::AttributeParseErrorSuggestions::CreatedByTemplate(
CFG_ATTR_TEMPLATE.suggestions(
AttrSuggestionStyle::Attribute(cfg_attr.style),
ParsedDescription::Attribute,
cfg_attr.get_normal_item().unsafety,
sym::cfg_attr,
),
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
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ impl DocParser {
match args {
ArgParser::NoArgs => {
let suggestions = cx.adcx().suggestions();
let span = cx.attr_span;
let span = cx.inner_span;
cx.emit_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
IllFormedAttributeInput::new(&suggestions, None, 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
Loading
Loading