Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
71d7ae2
std: Don't use `linkat` on the `wasm32-wasi*` targets
alexcrichton Dec 10, 2025
860716f
std: reorganize pipe implementations
joboet Sep 19, 2025
653520a
std: update pipe tests
joboet Sep 20, 2025
25a6fca
Cleanup context
JonathanBrouwer Dec 13, 2025
ebbb4d5
replace addr_of_mut with &raw mut in maybeuninit docs
inkreasing Dec 11, 2025
1da1a39
Remove `UnknownMetaItem` error
JonathanBrouwer Dec 13, 2025
f357e51
Stop using `IllFormedAttributeInputLint` for `macro_use`
JonathanBrouwer Dec 13, 2025
6a7ed13
Stop using `IllFormedAttributeInputLint` for `macro_use`
JonathanBrouwer Dec 13, 2025
69a59e8
Stop using `IllFormedAttributeInputLint` for `must_use`
JonathanBrouwer Dec 13, 2025
ae39d3d
Improve spans of malformed attribute errors
JonathanBrouwer Dec 13, 2025
4081c14
create_dir_all() operates iteratively instead of recursively
asder8215 Dec 14, 2025
cab9114
dangling pointer from temp cleanup
hkBst Nov 4, 2025
309e9ec
don't use no_main and no_core to test IBT
jyn514 Dec 14, 2025
54d729a
Rollup merge of #146794 - joboet:reorganize-pipe, r=Mark-Simulacrum
matthiaskrgr Dec 14, 2025
b8bd531
Rollup merge of #148196 - asder8215:std-fs-iterative-create-dir-all, …
matthiaskrgr Dec 14, 2025
1a53c25
Rollup merge of #148490 - hkBst:dangling-ptr-lint-2, r=Urgau
matthiaskrgr Dec 14, 2025
d1b9d2f
Rollup merge of #149864 - alexcrichton:wasi-avoid-linkat, r=joboet
matthiaskrgr Dec 14, 2025
4db75dd
Rollup merge of #149885 - inkreasing:push-ovrwrllvzvmw, r=joboet
matthiaskrgr Dec 14, 2025
21974c5
Rollup merge of #149949 - JonathanBrouwer:error_cleanup, r=jdonszelmann
matthiaskrgr Dec 14, 2025
1b7cc44
Rollup merge of #149969 - jyn514:ibt, r=jieyouxu
matthiaskrgr Dec 14, 2025
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
Prev Previous commit
Next Next commit
Remove UnknownMetaItem error
  • Loading branch information
JonathanBrouwer committed Dec 13, 2025
commit 1da1a39c9ae2ad51bc5bb438e45658f965ac530e
4 changes: 0 additions & 4 deletions compiler/rustc_attr_parsing/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ attr_parsing_stability_outside_std = stability attributes may not be used outsid
attr_parsing_suffixed_literal_in_attribute = suffixed literals are not allowed in attributes
.help = instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)

attr_parsing_unknown_meta_item =
unknown meta item '{$item}'
.label = expected one of {$expected}

attr_parsing_unknown_version_literal =
unknown version literal format, assuming it refers to a future version

Expand Down
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 @@ -110,13 +110,12 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
Some(get(cx, name, param.span(), param.args(), &suggestion)?);
}
_ => {
cx.unknown_key(
cx.expected_specific_argument(
param.span(),
param.path().to_string(),
if features.deprecated_suggestion() {
&["since", "note", "suggestion"]
&[sym::since, sym::note, sym::suggestion]
} else {
&["since", "note"]
&[sym::since, sym::note]
},
);
return None;
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/prototype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ impl<S: Stage> SingleAttributeParser<S> for CustomMirParser {
extract_value(cx, sym::dialect, arg, meta_item.span(), &mut dialect, &mut failed);
} else if let Some(arg) = meta_item.word_is(sym::phase) {
extract_value(cx, sym::phase, arg, meta_item.span(), &mut phase, &mut failed);
} else if let Some(word) = meta_item.path().word() {
let word = word.to_string();
cx.unknown_key(meta_item.span(), word, &["dialect", "phase"]);
} else if let Some(..) = meta_item.path().word() {
cx.expected_specific_argument(meta_item.span(), &[sym::dialect, sym::phase]);
failed = true;
} else {
cx.expected_name_value(meta_item.span(), None);
Expand Down
22 changes: 12 additions & 10 deletions compiler/rustc_attr_parsing/src/attributes/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,7 @@ pub(crate) fn parse_stability<S: Stage>(
insert_value_into_option_or_error(cx, &param, &mut since, word.unwrap())?
}
_ => {
cx.emit_err(session_diagnostics::UnknownMetaItem {
span: param_span,
item: param.path().to_string(),
expected: &["feature", "since"],
});
cx.expected_specific_argument(param_span, &[sym::feature, sym::since]);
return None;
}
}
Expand Down Expand Up @@ -426,11 +422,17 @@ pub(crate) fn parse_unstability<S: Stage>(
insert_value_into_option_or_error(cx, &param, &mut old_name, word.unwrap())?
}
_ => {
cx.emit_err(session_diagnostics::UnknownMetaItem {
span: param.span(),
item: param.path().to_string(),
expected: &["feature", "reason", "issue", "soft", "implied_by", "old_name"],
});
cx.expected_specific_argument(
param.span(),
&[
sym::feature,
sym::reason,
sym::issue,
sym::soft,
sym::implied_by,
sym::old_name,
],
);
return None;
}
}
Expand Down
11 changes: 1 addition & 10 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use crate::attributes::transparency::TransparencyParser;
use crate::attributes::{AttributeParser as _, Combine, Single, WithoutArgs};
use crate::parser::{ArgParser, RefPathParser};
use crate::session_diagnostics::{
AttributeParseError, AttributeParseErrorReason, ParsedDescription, UnknownMetaItem,
AttributeParseError, AttributeParseErrorReason, ParsedDescription,
};
use crate::target_checking::AllowedTargets;

Expand Down Expand Up @@ -425,15 +425,6 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
}

impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
pub(crate) fn unknown_key(
&self,
span: Span,
found: String,
options: &[&'static str],
) -> ErrorGuaranteed {
self.emit_err(UnknownMetaItem { span, item: found, expected: options })
}

fn emit_parse_error(
&self,
span: Span,
Expand Down
20 changes: 0 additions & 20 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,6 @@ pub(crate) struct DocAttributeNotAttribute {
pub attribute: Symbol,
}

/// Error code: E0541
pub(crate) struct UnknownMetaItem<'a> {
pub span: Span,
pub item: String,
pub expected: &'a [&'a str],
}

// Manual implementation to be able to format `expected` items correctly.
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for UnknownMetaItem<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
let expected = self.expected.iter().map(|name| format!("`{name}`")).collect::<Vec<_>>();
Diag::new(dcx, level, fluent::attr_parsing_unknown_meta_item)
.with_span(self.span)
.with_code(E0541)
.with_arg("item", self.item)
.with_arg("expected", expected.join(", "))
.with_span_label(self.span, fluent::attr_parsing_label)
}
}

#[derive(Diagnostic)]
#[diag(attr_parsing_missing_since, code = E0542)]
pub(crate) struct MissingSince {
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_error_codes/src/error_codes/E0541.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#### Note: this error code is no longer emitted by the compiler.

An unknown meta item was used.

Erroneous code example:

```compile_fail,E0541
```compile_fail (no longer emitted)
#[deprecated(
since="1.0.0",
// error: unknown meta item
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/deprecation/deprecation-sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Various checks that deprecation attributes are used correctly

mod bogus_attribute_types_1 {
#[deprecated(since = "a", note = "a", reason)] //~ ERROR unknown meta item 'reason'
#[deprecated(since = "a", note = "a", reason)] //~ ERROR malformed `deprecated` attribute input [E0539]
fn f1() { }

#[deprecated(since = "a", note)] //~ ERROR malformed `deprecated` attribute input [E0539]
Expand Down
10 changes: 6 additions & 4 deletions tests/ui/deprecation/deprecation-sanity.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
error[E0541]: unknown meta item 'reason'
--> $DIR/deprecation-sanity.rs:6:43
error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:6:5
|
LL | #[deprecated(since = "a", note = "a", reason)]
| ^^^^^^ expected one of `since`, `note`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------^^
| |
| valid arguments are `since` or `note`

error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:9:5
Expand Down Expand Up @@ -86,5 +88,5 @@ LL | #[deprecated = "hello"]

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0538, E0539, E0541, E0565.
Some errors have detailed explanations: E0538, E0539, E0565.
For more information about an error, try `rustc --explain E0538`.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR malformed `stable` attribute input [E0538]
fn f1() { }

#[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse'
#[stable(feature = "a", sinse = "1.0.0")] //~ ERROR malformed `stable` attribute input [E0539]
fn f2() { }

#[unstable(feature = "a", issue = "no")]
Expand Down
11 changes: 7 additions & 4 deletions tests/ui/stability-attribute/stability-attribute-sanity-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ LL | #[stable(feature = "a", feature = "b", since = "1.0.0")]
| | found `feature` used as a key more than once
| help: must be of the form: `#[stable(feature = "name", since = "version")]`

error[E0541]: unknown meta item 'sinse'
--> $DIR/stability-attribute-sanity-2.rs:10:25
error[E0539]: malformed `stable` attribute input
--> $DIR/stability-attribute-sanity-2.rs:10:1
|
LL | #[stable(feature = "a", sinse = "1.0.0")]
| ^^^^^^^^^^^^^^^ expected one of `feature`, `since`
| ^^^^^^^^^^^^^^^^^^^^^^^^---------------^^
| | |
| | valid arguments are `feature` or `since`
| help: must be of the form: `#[stable(feature = "name", since = "version")]`

error[E0545]: `issue` must be a non-zero numeric string or "none"
--> $DIR/stability-attribute-sanity-2.rs:13:27
Expand All @@ -23,5 +26,5 @@ LL | #[unstable(feature = "a", issue = "no")]

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0538, E0541, E0545.
Some errors have detailed explanations: E0538, E0539, E0545.
For more information about an error, try `rustc --explain E0538`.
2 changes: 1 addition & 1 deletion tests/ui/stability-attribute/stability-attribute-sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![stable(feature = "rust1", since = "1.0.0")]

mod bogus_attribute_types_1 {
#[stable(feature = "a", since = "4.4.4", reason)] //~ ERROR unknown meta item 'reason' [E0541]
#[stable(feature = "a", since = "4.4.4", reason)] //~ ERROR malformed `stable` attribute input [E0539]
fn f1() { }

#[stable(feature = "a", since)] //~ ERROR malformed `stable` attribute input [E0539]
Expand Down
11 changes: 7 additions & 4 deletions tests/ui/stability-attribute/stability-attribute-sanity.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
error[E0541]: unknown meta item 'reason'
--> $DIR/stability-attribute-sanity.rs:8:46
error[E0539]: malformed `stable` attribute input
--> $DIR/stability-attribute-sanity.rs:8:5
|
LL | #[stable(feature = "a", since = "4.4.4", reason)]
| ^^^^^^ expected one of `feature`, `since`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------^^
| | |
| | valid arguments are `feature` or `since`
| help: must be of the form: `#[stable(feature = "name", since = "version")]`

error[E0539]: malformed `stable` attribute input
--> $DIR/stability-attribute-sanity.rs:11:5
Expand Down Expand Up @@ -138,5 +141,5 @@ LL | #[stable(feature = "a", since = "1.0.0")]

error: aborting due to 20 previous errors

Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0544, E0546, E0547, E0549, E0711.
Some errors have detailed explanations: E0539, E0542, E0543, E0544, E0546, E0547, E0549, E0711.
For more information about an error, try `rustc --explain E0539`.