Skip to content

Commit

Permalink
Rollup merge of #133187 - ehuss:reference-diagnostic, r=jieyouxu
Browse files Browse the repository at this point in the history
Add reference annotations for diagnostic attributes

This adds reference annotations for `diagnostic::on_unimplmented` and the `diagnostic` namespace in general.

There's also a rename for a test that looks like it was put in the wrong location.
  • Loading branch information
fmease authored Nov 19, 2024
2 parents 49ca6c6 + 1b0e787 commit 739fdaf
Show file tree
Hide file tree
Showing 28 changed files with 170 additions and 147 deletions.
2 changes: 2 additions & 0 deletions tests/ui/diagnostic_namespace/deny_malformed_attribute.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ reference: attributes.diagnostic.namespace.unknown-invalid-syntax

#![deny(unknown_or_malformed_diagnostic_attributes)]

#[diagnostic::unknown_attribute]
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/diagnostic_namespace/deny_malformed_attribute.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: unknown diagnostic attribute
--> $DIR/deny_malformed_attribute.rs:3:15
--> $DIR/deny_malformed_attribute.rs:5:15
|
LL | #[diagnostic::unknown_attribute]
| ^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/deny_malformed_attribute.rs:1:9
--> $DIR/deny_malformed_attribute.rs:3:9
|
LL | #![deny(unknown_or_malformed_diagnostic_attributes)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ edition:2021
//@ aux-build:bad_on_unimplemented.rs
//@ reference: attributes.diagnostic.on_unimplemented.syntax

// Do not ICE when encountering a malformed `#[diagnostic::on_unimplemented]` annotation in a
// dependency when incorrectly used (#124651).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error[E0277]: the trait bound `(): bad_on_unimplemented::MissingAttr` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:22:18
--> $DIR/malformed_foreign_on_unimplemented.rs:23:18
|
LL | missing_attr(());
| ------------ ^^ the trait `bad_on_unimplemented::MissingAttr` is not implemented for `()`
| |
| required by a bound introduced by this call
|
note: required by a bound in `missing_attr`
--> $DIR/malformed_foreign_on_unimplemented.rs:11:20
--> $DIR/malformed_foreign_on_unimplemented.rs:12:20
|
LL | fn missing_attr<T: MissingAttr>(_: T) {}
| ^^^^^^^^^^^ required by this bound in `missing_attr`

error[E0277]: the trait bound `(): bad_on_unimplemented::DuplicateAttr` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:23:20
--> $DIR/malformed_foreign_on_unimplemented.rs:24:20
|
LL | duplicate_attr(());
| -------------- ^^ a
Expand All @@ -22,55 +22,55 @@ LL | duplicate_attr(());
|
= help: the trait `bad_on_unimplemented::DuplicateAttr` is not implemented for `()`
note: required by a bound in `duplicate_attr`
--> $DIR/malformed_foreign_on_unimplemented.rs:12:22
--> $DIR/malformed_foreign_on_unimplemented.rs:13:22
|
LL | fn duplicate_attr<T: DuplicateAttr>(_: T) {}
| ^^^^^^^^^^^^^ required by this bound in `duplicate_attr`

error[E0277]: the trait bound `(): bad_on_unimplemented::NotMetaList` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:24:19
--> $DIR/malformed_foreign_on_unimplemented.rs:25:19
|
LL | not_meta_list(());
| ------------- ^^ the trait `bad_on_unimplemented::NotMetaList` is not implemented for `()`
| |
| required by a bound introduced by this call
|
note: required by a bound in `not_meta_list`
--> $DIR/malformed_foreign_on_unimplemented.rs:13:21
--> $DIR/malformed_foreign_on_unimplemented.rs:14:21
|
LL | fn not_meta_list<T: NotMetaList>(_: T) {}
| ^^^^^^^^^^^ required by this bound in `not_meta_list`

error[E0277]: the trait bound `(): bad_on_unimplemented::Empty` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:25:11
--> $DIR/malformed_foreign_on_unimplemented.rs:26:11
|
LL | empty(());
| ----- ^^ the trait `bad_on_unimplemented::Empty` is not implemented for `()`
| |
| required by a bound introduced by this call
|
note: required by a bound in `empty`
--> $DIR/malformed_foreign_on_unimplemented.rs:14:13
--> $DIR/malformed_foreign_on_unimplemented.rs:15:13
|
LL | fn empty<T: Empty>(_: T) {}
| ^^^^^ required by this bound in `empty`

error[E0277]: the trait bound `(): bad_on_unimplemented::WrongDelim` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:26:17
--> $DIR/malformed_foreign_on_unimplemented.rs:27:17
|
LL | wrong_delim(());
| ----------- ^^ the trait `bad_on_unimplemented::WrongDelim` is not implemented for `()`
| |
| required by a bound introduced by this call
|
note: required by a bound in `wrong_delim`
--> $DIR/malformed_foreign_on_unimplemented.rs:15:19
--> $DIR/malformed_foreign_on_unimplemented.rs:16:19
|
LL | fn wrong_delim<T: WrongDelim>(_: T) {}
| ^^^^^^^^^^ required by this bound in `wrong_delim`

error[E0277]: the trait bound `(): bad_on_unimplemented::BadFormatter<()>` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:27:19
--> $DIR/malformed_foreign_on_unimplemented.rs:28:19
|
LL | bad_formatter(());
| ------------- ^^ ()
Expand All @@ -79,13 +79,13 @@ LL | bad_formatter(());
|
= help: the trait `bad_on_unimplemented::BadFormatter<()>` is not implemented for `()`
note: required by a bound in `bad_formatter`
--> $DIR/malformed_foreign_on_unimplemented.rs:16:21
--> $DIR/malformed_foreign_on_unimplemented.rs:17:21
|
LL | fn bad_formatter<T: BadFormatter<()>>(_: T) {}
| ^^^^^^^^^^^^^^^^ required by this bound in `bad_formatter`

error[E0277]: the trait bound `(): bad_on_unimplemented::NoImplicitArgs` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:28:22
--> $DIR/malformed_foreign_on_unimplemented.rs:29:22
|
LL | no_implicit_args(());
| ---------------- ^^ test {}
Expand All @@ -94,13 +94,13 @@ LL | no_implicit_args(());
|
= help: the trait `bad_on_unimplemented::NoImplicitArgs` is not implemented for `()`
note: required by a bound in `no_implicit_args`
--> $DIR/malformed_foreign_on_unimplemented.rs:17:24
--> $DIR/malformed_foreign_on_unimplemented.rs:18:24
|
LL | fn no_implicit_args<T: NoImplicitArgs>(_: T) {}
| ^^^^^^^^^^^^^^ required by this bound in `no_implicit_args`

error[E0277]: the trait bound `(): bad_on_unimplemented::MissingArg` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:29:17
--> $DIR/malformed_foreign_on_unimplemented.rs:30:17
|
LL | missing_arg(());
| ----------- ^^ {missing}
Expand All @@ -109,13 +109,13 @@ LL | missing_arg(());
|
= help: the trait `bad_on_unimplemented::MissingArg` is not implemented for `()`
note: required by a bound in `missing_arg`
--> $DIR/malformed_foreign_on_unimplemented.rs:18:19
--> $DIR/malformed_foreign_on_unimplemented.rs:19:19
|
LL | fn missing_arg<T: MissingArg>(_: T) {}
| ^^^^^^^^^^ required by this bound in `missing_arg`

error[E0277]: the trait bound `(): bad_on_unimplemented::BadArg` is not satisfied
--> $DIR/malformed_foreign_on_unimplemented.rs:30:13
--> $DIR/malformed_foreign_on_unimplemented.rs:31:13
|
LL | bad_arg(());
| ------- ^^ {_}
Expand All @@ -124,7 +124,7 @@ LL | bad_arg(());
|
= help: the trait `bad_on_unimplemented::BadArg` is not implemented for `()`
note: required by a bound in `bad_arg`
--> $DIR/malformed_foreign_on_unimplemented.rs:19:15
--> $DIR/malformed_foreign_on_unimplemented.rs:20:15
|
LL | fn bad_arg<T: BadArg>(_: T) {}
| ^^^^^^ required by this bound in `bad_arg`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@ reference: attributes.diagnostic.namespace.unknown-invalid-syntax
#[diagnostic::non_existing_attribute]
//~^WARN unknown diagnostic attribute
pub trait Bar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
warning: unknown diagnostic attribute
--> $DIR/non_existing_attributes_accepted.rs:2:15
--> $DIR/non_existing_attributes_accepted.rs:3:15
|
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default

warning: unknown diagnostic attribute
--> $DIR/non_existing_attributes_accepted.rs:7:15
--> $DIR/non_existing_attributes_accepted.rs:8:15
|
LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
| ^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ reference: attributes.diagnostic.on_unimplemented.invalid-string
#[diagnostic::on_unimplemented(message = "{{Test } thing")]
//~^WARN unmatched `}` found
//~|WARN unmatched `}` found
Expand Down
Loading

0 comments on commit 739fdaf

Please sign in to comment.