Skip to content

Commit a1d5af2

Browse files
committedJul 20, 2022
attr: fix expected meta-item for #[stable]
When an unexpected meta item is provided to `#[stable]`, the diagnostic lists "since" and "note" as expected meta-items, however the surrounding code actually expects "feature" and "since". Signed-off-by: David Wood <david.wood@huawei.com>
1 parent 6f0b8f1 commit a1d5af2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎compiler/rustc_attr/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ where
404404
meta.span(),
405405
AttrError::UnknownMetaItem(
406406
pprust::path_to_string(&mi.path),
407-
&["since", "note"],
407+
&["feature", "since"],
408408
),
409409
);
410410
continue 'outer;

‎src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error[E0541]: unknown meta item 'sinse'
88
--> $DIR/stability-attribute-sanity-2.rs:10:25
99
|
1010
LL | #[stable(feature = "a", sinse = "1.0.0")]
11-
| ^^^^^^^^^^^^^^^ expected one of `since`, `note`
11+
| ^^^^^^^^^^^^^^^ expected one of `feature`, `since`
1212

1313
error[E0545]: `issue` must be a non-zero numeric string or "none"
1414
--> $DIR/stability-attribute-sanity-2.rs:13:27

‎src/test/ui/stability-attribute/stability-attribute-sanity.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ error[E0541]: unknown meta item 'reason'
1414
--> $DIR/stability-attribute-sanity.rs:8:42
1515
|
1616
LL | #[stable(feature = "a", since = "b", reason)]
17-
| ^^^^^^ expected one of `since`, `note`
17+
| ^^^^^^ expected one of `feature`, `since`
1818

1919
error[E0539]: incorrect meta item
2020
--> $DIR/stability-attribute-sanity.rs:11:29

0 commit comments

Comments
 (0)
Please sign in to comment.