-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not apply
#[do_not_recommend]
if the feature flag is not set
This commit adds additional checks for the feature flag as apparently it is possible to use this on a beta compiler without feature flags. This PR might be a candidate for backporting. Reported in the bevy issue tracker: bevyengine/bevy#14591 (comment)
- Loading branch information
Showing
3 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...s/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#![allow(unknown_or_malformed_diagnostic_attributes)] | ||
|
||
trait Foo {} | ||
|
||
#[diagnostic::do_not_recommend] | ||
impl<A> Foo for (A,) {} | ||
|
||
#[diagnostic::do_not_recommend] | ||
impl<A, B> Foo for (A, B) {} | ||
|
||
#[diagnostic::do_not_recommend] | ||
impl<A, B, C> Foo for (A, B, C) {} | ||
|
||
impl Foo for i32 {} | ||
|
||
fn check(a: impl Foo) {} | ||
|
||
fn main() { | ||
check(()); | ||
//~^ ERROR the trait bound `(): Foo` is not satisfied | ||
} |
21 changes: 21 additions & 0 deletions
21
.../diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0277]: the trait bound `(): Foo` is not satisfied | ||
--> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:11 | ||
| | ||
LL | check(()); | ||
| ----- ^^ the trait `Foo` is not implemented for `()` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the following other types implement trait `Foo`: | ||
(A, B) | ||
(A, B, C) | ||
(A,) | ||
note: required by a bound in `check` | ||
--> $DIR/do_not_apply_attribute_without_feature_flag.rs:16:18 | ||
| | ||
LL | fn check(a: impl Foo) {} | ||
| ^^^ required by this bound in `check` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |