forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#128912 - compiler-errors:do-not-recommend-imp…
…l, r=<try> Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
- Loading branch information
Showing
7 changed files
with
55 additions
and
20 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
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
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
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
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`. |