File tree Expand file tree Collapse file tree
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11The ` #[rustc_on_unimplemented] ` attribute lets you specify a custom error
22message 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!
1111trait 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.
You can’t perform that action at this time.
0 commit comments