Rollup merge of #137242 - ehuss:reference-do_not_recommend, r=compiler-errors

Add reference annotations for the `do_not_recommend` attribute

This adds reference rule identifiers for the tests of the `diagnostic::do_not_recommend` attribute.
This commit is contained in:
Matthias Krüger 2025-02-19 01:30:14 +01:00 committed by GitHub
commit 24ba1ad31c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 59 additions and 50 deletions

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
--> $DIR/as_expression.rs:55:15
--> $DIR/as_expression.rs:56:15
|
LL | SelectInt.check("bar");
| ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied
--> $DIR/as_expression.rs:55:21
--> $DIR/as_expression.rs:56:21
|
LL | SelectInt.check("bar");
| ----- ^^^^^ the trait `AsExpression<<SelectInt as Expression>::SqlType>` is not implemented for `&str`
@ -8,7 +8,7 @@ LL | SelectInt.check("bar");
|
= help: the trait `AsExpression<Text>` is implemented for `&str`
note: required by a bound in `Foo::check`
--> $DIR/as_expression.rs:46:12
--> $DIR/as_expression.rs:47:12
|
LL | fn check<T>(&self, _: T) -> <T as AsExpression<<Self as Expression>::SqlType>>::Expression
| ----- required by a bound in this associated function
@ -17,7 +17,7 @@ LL | T: AsExpression<Self::SqlType>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check`
error[E0271]: type mismatch resolving `<SelectInt as Expression>::SqlType == Text`
--> $DIR/as_expression.rs:55:5
--> $DIR/as_expression.rs:56:5
|
LL | SelectInt.check("bar");
| ^^^^^^^^^^^^^^^^^^^^^^ expected `Text`, found `Integer`

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
pub trait Expression {
type SqlType;

View File

@ -1,5 +1,5 @@
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/does_not_acccept_args.rs:10:1
--> $DIR/does_not_acccept_args.rs:11:1
|
LL | #[diagnostic::do_not_recommend(not_accepted)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,13 +7,13 @@ LL | #[diagnostic::do_not_recommend(not_accepted)]
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/does_not_acccept_args.rs:14:1
--> $DIR/does_not_acccept_args.rs:15:1
|
LL | #[diagnostic::do_not_recommend(not_accepted = "foo")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/does_not_acccept_args.rs:18:1
--> $DIR/does_not_acccept_args.rs:19:1
|
LL | #[diagnostic::do_not_recommend(not_accepted(42))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/does_not_acccept_args.rs:10:1
--> $DIR/does_not_acccept_args.rs:11:1
|
LL | #[diagnostic::do_not_recommend(not_accepted)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,13 +7,13 @@ LL | #[diagnostic::do_not_recommend(not_accepted)]
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/does_not_acccept_args.rs:14:1
--> $DIR/does_not_acccept_args.rs:15:1
|
LL | #[diagnostic::do_not_recommend(not_accepted = "foo")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/does_not_acccept_args.rs:18:1
--> $DIR/does_not_acccept_args.rs:19:1
|
LL | #[diagnostic::do_not_recommend(not_accepted(42))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -2,6 +2,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.syntax
trait Foo {}
trait Bar {}

View File

@ -1,5 +1,5 @@
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:6:1
--> $DIR/incorrect-locations.rs:7:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,49 +7,49 @@ LL | #[diagnostic::do_not_recommend]
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:10:1
--> $DIR/incorrect-locations.rs:11:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:14:1
--> $DIR/incorrect-locations.rs:15:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:18:1
--> $DIR/incorrect-locations.rs:19:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:22:1
--> $DIR/incorrect-locations.rs:23:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:26:1
--> $DIR/incorrect-locations.rs:27:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:30:1
--> $DIR/incorrect-locations.rs:31:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:34:1
--> $DIR/incorrect-locations.rs:35:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:38:1
--> $DIR/incorrect-locations.rs:39:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:6:1
--> $DIR/incorrect-locations.rs:7:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,49 +7,49 @@ LL | #[diagnostic::do_not_recommend]
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:10:1
--> $DIR/incorrect-locations.rs:11:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:14:1
--> $DIR/incorrect-locations.rs:15:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:18:1
--> $DIR/incorrect-locations.rs:19:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:22:1
--> $DIR/incorrect-locations.rs:23:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:26:1
--> $DIR/incorrect-locations.rs:27:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:30:1
--> $DIR/incorrect-locations.rs:31:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:34:1
--> $DIR/incorrect-locations.rs:35:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
--> $DIR/incorrect-locations.rs:38:1
--> $DIR/incorrect-locations.rs:39:1
|
LL | #[diagnostic::do_not_recommend]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -2,6 +2,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.allowed-positions
#[diagnostic::do_not_recommend]
//~^WARN `#[diagnostic::do_not_recommend]` can only be placed

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `(): Root` is not satisfied
--> $DIR/nested.rs:21:18
--> $DIR/nested.rs:22:18
|
LL | needs_root::<()>();
| ^^ the trait `Root` is not implemented for `()`
|
note: required by a bound in `needs_root`
--> $DIR/nested.rs:18:18
--> $DIR/nested.rs:19:18
|
LL | fn needs_root<T: Root>() {}
| ^^^^ required by this bound in `needs_root`

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `(): Root` is not satisfied
--> $DIR/nested.rs:21:18
--> $DIR/nested.rs:22:18
|
LL | needs_root::<()>();
| ^^ the trait `Root` is not implemented for `()`
|
note: required by a bound in `needs_root`
--> $DIR/nested.rs:18:18
--> $DIR/nested.rs:19:18
|
LL | fn needs_root<T: Root>() {}
| ^^^^ required by this bound in `needs_root`

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
trait Root {}
trait DontRecommend {}

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `*mut (): Foo` is not satisfied
--> $DIR/simple.rs:15:17
--> $DIR/simple.rs:16:17
|
LL | needs_foo::<*mut ()>();
| ^^^^^^^ the trait `Foo` is not implemented for `*mut ()`
|
note: required by a bound in `needs_foo`
--> $DIR/simple.rs:10:17
--> $DIR/simple.rs:11:17
|
LL | fn needs_foo<T: Foo>() {}
| ^^^ required by this bound in `needs_foo`

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `*mut (): Foo` is not satisfied
--> $DIR/simple.rs:15:17
--> $DIR/simple.rs:16:17
|
LL | needs_foo::<*mut ()>();
| ^^^^^^^ the trait `Foo` is not implemented for `*mut ()`
|
note: required by a bound in `needs_foo`
--> $DIR/simple.rs:10:17
--> $DIR/simple.rs:11:17
|
LL | fn needs_foo<T: Foo>() {}
| ^^^ required by this bound in `needs_foo`

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
trait Foo {}

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `(): Root` is not satisfied
--> $DIR/stacked.rs:17:18
--> $DIR/stacked.rs:18:18
|
LL | needs_root::<()>();
| ^^ the trait `Root` is not implemented for `()`
|
note: required by a bound in `needs_root`
--> $DIR/stacked.rs:14:18
--> $DIR/stacked.rs:15:18
|
LL | fn needs_root<T: Root>() {}
| ^^^^ required by this bound in `needs_root`

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `(): Root` is not satisfied
--> $DIR/stacked.rs:17:18
--> $DIR/stacked.rs:18:18
|
LL | needs_root::<()>();
| ^^ the trait `Root` is not implemented for `()`
|
note: required by a bound in `needs_root`
--> $DIR/stacked.rs:14:18
--> $DIR/stacked.rs:15:18
|
LL | fn needs_root<T: Root>() {}
| ^^^^ required by this bound in `needs_root`

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
trait Root {}
trait DontRecommend {}

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `(): Foo` is not satisfied
--> $DIR/supress_suggestions_in_help.rs:21:11
--> $DIR/supress_suggestions_in_help.rs:22:11
|
LL | check(());
| ----- ^^ the trait `Foo` is not implemented for `()`
@ -8,7 +8,7 @@ LL | check(());
|
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `check`
--> $DIR/supress_suggestions_in_help.rs:18:18
--> $DIR/supress_suggestions_in_help.rs:19:18
|
LL | fn check(a: impl Foo) {}
| ^^^ required by this bound in `check`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `(): Foo` is not satisfied
--> $DIR/supress_suggestions_in_help.rs:21:11
--> $DIR/supress_suggestions_in_help.rs:22:11
|
LL | check(());
| ----- ^^ the trait `Foo` is not implemented for `()`
@ -8,7 +8,7 @@ LL | check(());
|
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `check`
--> $DIR/supress_suggestions_in_help.rs:18:18
--> $DIR/supress_suggestions_in_help.rs:19:18
|
LL | fn check(a: impl Foo) {}
| ^^^ required by this bound in `check`

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
trait Foo {}

View File

@ -1,11 +1,11 @@
error[E0277]: Very important message!
--> $DIR/type_mismatch.rs:23:14
--> $DIR/type_mismatch.rs:24:14
|
LL | verify::<u8>();
| ^^ the trait `TheImportantOne` is not implemented for `u8`
|
note: required by a bound in `verify`
--> $DIR/type_mismatch.rs:20:14
--> $DIR/type_mismatch.rs:21:14
|
LL | fn verify<T: TheImportantOne>() {}
| ^^^^^^^^^^^^^^^ required by this bound in `verify`

View File

@ -1,11 +1,11 @@
error[E0277]: Very important message!
--> $DIR/type_mismatch.rs:23:14
--> $DIR/type_mismatch.rs:24:14
|
LL | verify::<u8>();
| ^^ the trait `TheImportantOne` is not implemented for `u8`
|
note: required by a bound in `verify`
--> $DIR/type_mismatch.rs:20:14
--> $DIR/type_mismatch.rs:21:14
|
LL | fn verify<T: TheImportantOne>() {}
| ^^^^^^^^^^^^^^^ required by this bound in `verify`

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
#[diagnostic::on_unimplemented(message = "Very important message!")]
trait TheImportantOne {}

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/with_lifetime.rs:17:5
--> $DIR/with_lifetime.rs:18:5
|
LL | fn foo<'a>(a: &'a ()) {
| -- lifetime `'a` defined here

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/with_lifetime.rs:17:5
--> $DIR/with_lifetime.rs:18:5
|
LL | fn foo<'a>(a: &'a ()) {
| -- lifetime `'a` defined here

View File

@ -1,6 +1,7 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ reference: attributes.diagnostic.do_not_recommend.intro
trait Root {}
trait DontRecommend {}