This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +56
-35
lines changed
tests/ui/diagnostic_namespace Expand file tree Collapse file tree 4 files changed +56
-35
lines changed Original file line number Diff line number Diff line change 11#[ diagnostic:: on_unimplemented( aa = "broken" ) ]
2- pub trait Test { }
2+ pub trait MissingAttr { }
3+
4+ #[ diagnostic:: on_unimplemented( label = "a" , label = "b" ) ]
5+ pub trait DuplicateAttr { }
6+
7+ #[ diagnostic:: on_unimplemented = "broken" ]
8+ pub trait NotMetaList { }
9+
10+ #[ diagnostic:: on_unimplemented]
11+ pub trait Empty { }
12+
13+ #[ diagnostic:: on_unimplemented { } ]
14+ pub trait WrongDelim { }
15+
16+ #[ diagnostic:: on_unimplemented( label = "{A:.3}" ) ]
17+ pub trait BadFormatter < A > { }
18+
19+ #[ diagnostic:: on_unimplemented( label = "test {}" ) ]
20+ pub trait NoImplicitArgs { }
21+
22+ #[ diagnostic:: on_unimplemented( label = "{missing}" ) ]
23+ pub trait MissingArg { }
24+
25+ #[ diagnostic:: on_unimplemented( label = "{_}" ) ]
26+ pub trait BadArg { }
Original file line number Diff line number Diff line change 1+ //@ edition:2021
2+ //@ aux-build:bad_on_unimplemented.rs
3+
4+ // Do not ICE when encountering a malformed `#[diagnostic::on_unimplemented]` annotation in a
5+ // dependency when incorrectly used (#124651).
6+
7+ extern crate bad_on_unimplemented;
8+
9+ use bad_on_unimplemented:: * ;
10+
11+ fn missing_attr < T : MissingAttr > ( _: T ) { }
12+ fn duplicate_attr < T : DuplicateAttr > ( _: T ) { }
13+ fn not_meta_list < T : NotMetaList > ( _: T ) { }
14+ fn empty < T : Empty > ( _: T ) { }
15+ fn wrong_delim < T : WrongDelim > ( _: T ) { }
16+ fn bad_formatter < T : BadFormatter < ( ) > > ( _: T ) { }
17+ fn no_implicit_args < T : NoImplicitArgs > ( _: T ) { }
18+ fn missing_arg < T : MissingArg > ( _: T ) { }
19+ fn bad_arg < T : BadArg > ( _: T ) { }
20+
21+ fn main ( ) {
22+ missing_attr ( ( ) ) ; //~ ERROR E0277
23+ duplicate_attr ( ( ) ) ; //~ ERROR E0277
24+ not_meta_list ( ( ) ) ; //~ ERROR E0277
25+ empty ( ( ) ) ; //~ ERROR E0277
26+ wrong_delim ( ( ) ) ; //~ ERROR E0277
27+ bad_formatter ( ( ) ) ; //~ ERROR E0277
28+ no_implicit_args ( ( ) ) ; //~ ERROR E0277
29+ missing_arg ( ( ) ) ; //~ ERROR E0277
30+ bad_arg ( ( ) ) ; //~ ERROR E0277
31+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments