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