2015-01-10 22:19:39 -06:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
2015-01-11 09:23:24 -06:00
|
|
|
#![feature(on_unimplemented)]
|
|
|
|
|
|
|
|
#![allow(unused)]
|
2015-01-10 22:19:39 -06:00
|
|
|
|
2015-01-11 06:58:06 -06:00
|
|
|
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
|
2015-02-12 09:29:52 -06:00
|
|
|
trait Foo<Bar, Baz, Quux>
|
|
|
|
{}
|
2015-01-10 22:19:39 -06:00
|
|
|
|
2015-01-11 06:58:06 -06:00
|
|
|
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
|
2015-01-10 22:19:39 -06:00
|
|
|
trait MyFromIterator<A> {
|
|
|
|
/// Build a container with elements from an external iterator.
|
|
|
|
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
|
|
|
}
|
|
|
|
|
2017-11-20 06:13:27 -06:00
|
|
|
#[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value
|
2015-02-12 09:29:52 -06:00
|
|
|
trait BadAnnotation1
|
|
|
|
{}
|
2015-01-10 22:19:39 -06:00
|
|
|
|
2015-01-11 06:58:06 -06:00
|
|
|
#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
|
2018-05-11 10:46:38 -05:00
|
|
|
//~^ ERROR there is no parameter C on trait BadAnnotation2
|
2015-02-12 09:29:52 -06:00
|
|
|
trait BadAnnotation2<A,B>
|
|
|
|
{}
|
2015-01-10 22:19:39 -06:00
|
|
|
|
2015-01-11 14:05:16 -06:00
|
|
|
#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"]
|
|
|
|
//~^ only named substitution parameters are allowed
|
2015-02-12 09:29:52 -06:00
|
|
|
trait BadAnnotation3<A,B>
|
|
|
|
{}
|
2015-01-10 22:19:39 -06:00
|
|
|
|
2017-08-30 15:40:43 -05:00
|
|
|
#[rustc_on_unimplemented(lorem="")]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ this attribute must have a valid
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation4 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(lorem(ipsum(dolor)))]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ this attribute must have a valid
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation5 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(message="x", message="y")]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ this attribute must have a valid
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation6 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ this attribute must have a valid
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation7 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(on(), message="y")]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ empty `on`-clause
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation8 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(on="x", message="y")]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ this attribute must have a valid
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation9 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(on(x="y"), message="y")]
|
|
|
|
trait BadAnnotation10 {}
|
|
|
|
|
|
|
|
#[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
|
2017-11-20 06:13:27 -06:00
|
|
|
//~^ this attribute must have a valid
|
2017-08-30 15:40:43 -05:00
|
|
|
trait BadAnnotation11 {}
|
|
|
|
|
2015-01-10 22:19:39 -06:00
|
|
|
pub fn main() {
|
|
|
|
}
|