]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/on-unimplemented/bad-annotation.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 // ignore-tidy-linelength
12 #![feature(on_unimplemented)]
16 #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
17 trait Foo
<Bar
, Baz
, Quux
>
20 #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
21 trait MyFromIterator
<A
> {
22 /// Build a container with elements from an external iterator.
23 fn my_from_iter
<T
: Iterator
<Item
=A
>>(iterator
: T
) -> Self;
26 #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value
30 #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
31 //~^ ERROR there is no parameter C on trait BadAnnotation2
32 trait BadAnnotation2
<A
,B
>
35 #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"]
36 //~^ only named substitution parameters are allowed
37 trait BadAnnotation3
<A
,B
>
40 #[rustc_on_unimplemented(lorem="")]
41 //~^ this attribute must have a valid
42 trait BadAnnotation4 {}
44 #[rustc_on_unimplemented(lorem(ipsum(dolor)))]
45 //~^ this attribute must have a valid
46 trait BadAnnotation5 {}
48 #[rustc_on_unimplemented(message="x", message="y")]
49 //~^ this attribute must have a valid
50 trait BadAnnotation6 {}
52 #[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
53 //~^ this attribute must have a valid
54 trait BadAnnotation7 {}
56 #[rustc_on_unimplemented(on(), message="y")]
57 //~^ empty `on`-clause
58 trait BadAnnotation8 {}
60 #[rustc_on_unimplemented(on="x", message="y")]
61 //~^ this attribute must have a valid
62 trait BadAnnotation9 {}
64 #[rustc_on_unimplemented(on(x="y"), message="y")]
65 trait BadAnnotation10 {}
67 #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
68 //~^ this attribute must have a valid
69 trait BadAnnotation11 {}