mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Fix error code example
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
|
||||
message for when a particular trait isn't implemented on a type placed in a
|
||||
position that needs that trait. For example, when the following code is
|
||||
compiled:
|
||||
position that needs that trait. The attribute will let you filter on
|
||||
various types, with `on`:
|
||||
|
||||
```compile_fail,E0232
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#[rustc_on_unimplemented(lorem="")] // error!
|
||||
#[rustc_on_unimplemented(on(blah, message = "foo"))] // error!
|
||||
trait BadAnnotation {}
|
||||
```
|
||||
|
||||
there will be an error about `bool` not implementing `Index<u8>`, followed by a
|
||||
note saying "the type `bool` cannot be indexed by `u8`".
|
||||
|
||||
For this to work, some note must be specified. An empty attribute will not do
|
||||
anything, please remove the attribute or add some helpful note for users of the
|
||||
trait.
|
||||
For this to work a cfg-like predicate must be supplied. A malformed filter
|
||||
will not do anything.
|
||||
|
||||
Reference in New Issue
Block a user