Skip to content

Commit

Permalink
Remove E0551.
Browse files Browse the repository at this point in the history
Because it's the same as E0539.

Fixes #51489.
  • Loading branch information
nnethercote committed Oct 4, 2023
1 parent 81136cb commit 0ece171
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ pub fn find_deprecation(
),
);
} else {
sess.emit_err(session_diagnostics::IncorrectMetaItem2 {
sess.emit_err(session_diagnostics::IncorrectMetaItem {
span: meta.span,
});
}
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_attr/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,6 @@ pub(crate) struct MissingIssue {
pub span: Span,
}

// FIXME: This diagnostic is identical to `IncorrectMetaItem`, barring the error code. Consider
// changing this to `IncorrectMetaItem`. See #51489.
#[derive(Diagnostic)]
#[diag(attr_incorrect_meta_item, code = "E0551")]
pub(crate) struct IncorrectMetaItem2 {
#[primary_span]
pub span: Span,
}

// FIXME: Why is this the same error code as `InvalidReprHintNoParen` and `InvalidReprHintNoValue`?
// It is more similar to `IncorrectReprFormatGeneric`.
#[derive(Diagnostic)]
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_error_codes/src/error_codes/E0551.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 invalid meta-item was used inside an attribute.

Erroneous code example:

```compile_fail,E0551
```compile_fail,E0539
#[deprecated(note)] // error!
fn i_am_deprecated() {}
```
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/deprecation/deprecation-sanity.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ error[E0541]: unknown meta item 'reason'
LL | #[deprecated(since = "a", note = "a", reason)]
| ^^^^^^ expected one of `since`, `note`

error[E0551]: incorrect meta item
error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:7:31
|
LL | #[deprecated(since = "a", note)]
| ^^^^

error[E0551]: incorrect meta item
error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:10:18
|
LL | #[deprecated(since, note = "a")]
| ^^^^^

error[E0551]: incorrect meta item
error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:13:31
|
LL | #[deprecated(since = "a", note(b))]
| ^^^^^^^

error[E0551]: incorrect meta item
error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:16:18
|
LL | #[deprecated(since(b), note = "a")]
Expand Down Expand Up @@ -70,5 +70,5 @@ LL | #[deprecated = "hello"]

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0538, E0541, E0551, E0565.
Some errors have detailed explanations: E0538, E0539, E0541, E0565.
For more information about an error, try `rustc --explain E0538`.

0 comments on commit 0ece171

Please sign in to comment.