]> git.lizzy.rs Git - rust.git/blob - src/test/ui/on-unimplemented/bad-annotation.rs
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=dtolnay
[rust.git] / src / test / ui / on-unimplemented / bad-annotation.rs
1 // ignore-tidy-linelength
2
3 #![feature(rustc_attrs)]
4
5 #![allow(unused)]
6
7 #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
8 trait Foo<Bar, Baz, Quux>
9 {}
10
11 #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
12 trait MyFromIterator<A> {
13     /// Builds a container with elements from an external iterator.
14     fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
15 }
16
17 #[rustc_on_unimplemented]
18 //~^ ERROR malformed `rustc_on_unimplemented` attribute
19 trait BadAnnotation1
20 {}
21
22 #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
23 //~^ ERROR there is no parameter `C` on trait `BadAnnotation2`
24 trait BadAnnotation2<A,B>
25 {}
26
27 #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"]
28 //~^ only named substitution parameters are allowed
29 trait BadAnnotation3<A,B>
30 {}
31
32 #[rustc_on_unimplemented(lorem="")]
33 //~^ this attribute must have a valid
34 trait BadAnnotation4 {}
35
36 #[rustc_on_unimplemented(lorem(ipsum(dolor)))]
37 //~^ this attribute must have a valid
38 trait BadAnnotation5 {}
39
40 #[rustc_on_unimplemented(message="x", message="y")]
41 //~^ this attribute must have a valid
42 trait BadAnnotation6 {}
43
44 #[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
45 //~^ this attribute must have a valid
46 trait BadAnnotation7 {}
47
48 #[rustc_on_unimplemented(on(), message="y")]
49 //~^ empty `on`-clause
50 trait BadAnnotation8 {}
51
52 #[rustc_on_unimplemented(on="x", message="y")]
53 //~^ this attribute must have a valid
54 trait BadAnnotation9 {}
55
56 #[rustc_on_unimplemented(on(x="y"), message="y")]
57 trait BadAnnotation10 {}
58
59 #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
60 //~^ this attribute must have a valid
61 trait BadAnnotation11 {}
62
63 pub fn main() {
64 }