This commit is contained in:
Manish Goregaokar 2015-01-12 01:35:16 +05:30
parent ad7e33efee
commit 02d0a8bbcf
2 changed files with 10 additions and 0 deletions

View File

@ -2117,6 +2117,13 @@ macro scope.
destructors from being run twice. Destructors might be run multiple times on
the same object with this attribute.
- `doc` - Doc comments such as `/// foo` are equivalent to `#[doc = "foo"]`.
- `rustc_on_unimplemented` - Write a custom note to be shown along with the error
when the trait is found to be unimplemented on a type.
You may use format arguments like `{T}`, `{A}` to correspond to the
types at the point of use corresponding to the type parameters of the
trait of the same name. `{Self}` will be replaced with the type that is supposed
to implement the trait but doesn't. To use this, the `on_unimplemented` feature gate
must be enabled.
### Conditional compilation

View File

@ -29,6 +29,9 @@ trait BadAnnotation1 {}
//~^ ERROR there is no type parameter C on trait BadAnnotation2
trait BadAnnotation2<A,B> {}
#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"]
//~^ only named substitution parameters are allowed
trait BadAnnotation3<A,B> {}
pub fn main() {
}