forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more ICEs due to malformed diagnostic::on_unimplemented
- Loading branch information
1 parent
a60f077
commit a8f2e33
Showing
4 changed files
with
56 additions
and
35 deletions.
There are no files selected for viewing
26 changes: 25 additions & 1 deletion
26
tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.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 |
---|---|---|
@@ -1,2 +1,26 @@ | ||
#[diagnostic::on_unimplemented(aa = "broken")] | ||
pub trait Test {} | ||
pub trait MissingAttr {} | ||
|
||
#[diagnostic::on_unimplemented(label = "a", label = "b")] | ||
pub trait DuplicateAttr {} | ||
|
||
#[diagnostic::on_unimplemented = "broken"] | ||
pub trait NotMetaList {} | ||
|
||
#[diagnostic::on_unimplemented] | ||
pub trait Empty {} | ||
|
||
#[diagnostic::on_unimplemented {}] | ||
pub trait WrongDelim {} | ||
|
||
#[diagnostic::on_unimplemented(label = "{A:.3}")] | ||
pub trait BadFormatter<A> {} | ||
|
||
#[diagnostic::on_unimplemented(label = "test {}")] | ||
pub trait NoImplicitArgs {} | ||
|
||
#[diagnostic::on_unimplemented(label = "{missing}")] | ||
pub trait MissingArg {} | ||
|
||
#[diagnostic::on_unimplemented(label = "{_}")] | ||
pub trait BadArg {} |
31 changes: 31 additions & 0 deletions
31
tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.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,31 @@ | ||
//@ edition:2021 | ||
//@ aux-build:bad_on_unimplemented.rs | ||
|
||
// Do not ICE when encountering a malformed `#[diagnostic::on_unimplemented]` annotation in a | ||
// dependency when incorrectly used (#124651). | ||
|
||
extern crate bad_on_unimplemented; | ||
|
||
use bad_on_unimplemented::*; | ||
|
||
fn missing_attr<T: MissingAttr>(_: T) {} | ||
fn duplicate_attr<T: DuplicateAttr>(_: T) {} | ||
fn not_meta_list<T: NotMetaList>(_: T) {} | ||
fn empty<T: Empty>(_: T) {} | ||
fn wrong_delim<T: WrongDelim>(_: T) {} | ||
fn bad_formatter<T: BadFormatter<()>>(_: T) {} | ||
fn no_implicit_args<T: NoImplicitArgs>(_: T) {} | ||
fn missing_arg<T: MissingArg>(_: T) {} | ||
fn bad_arg<T: BadArg>(_: T) {} | ||
|
||
fn main() { | ||
missing_attr(()); //~ ERROR E0277 | ||
duplicate_attr(()); //~ ERROR E0277 | ||
not_meta_list(()); //~ ERROR E0277 | ||
empty(()); //~ ERROR E0277 | ||
wrong_delim(()); //~ ERROR E0277 | ||
bad_formatter(()); //~ ERROR E0277 | ||
no_implicit_args(()); //~ ERROR E0277 | ||
missing_arg(()); //~ ERROR E0277 | ||
bad_arg(()); //~ ERROR E0277 | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.