Skip to content

Commit d6bccac

Browse files
committed
Fix error code example
1 parent 72db94f commit d6bccac

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

  • compiler/rustc_error_codes/src/error_codes
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
22
message for when a particular trait isn't implemented on a type placed in a
3-
position that needs that trait. For example, when the following code is
4-
compiled:
3+
position that needs that trait. The attribute will let you filter on
4+
various types, with `on`:
55

66
```compile_fail,E0232
77
#![feature(rustc_attrs)]
88
#![allow(internal_features)]
99
10-
#[rustc_on_unimplemented(lorem="")] // error!
10+
#[rustc_on_unimplemented(on(blah, message = "foo"))] // error!
1111
trait BadAnnotation {}
1212
```
13-
14-
there will be an error about `bool` not implementing `Index<u8>`, followed by a
15-
note saying "the type `bool` cannot be indexed by `u8`".
16-
17-
For this to work, some note must be specified. An empty attribute will not do
18-
anything, please remove the attribute or add some helpful note for users of the
19-
trait.
13+
For this to work a cfg-like predicate must be supplied. A malformed filter
14+
will not do anything.

0 commit comments

Comments
 (0)