Skip to content

Commit e65e732

Browse files
committed
Update description of rustc_on_unimplemented
Add description of new feature: substitute `{TraitName}` with full path for the trait.
1 parent 70f866a commit e65e732

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/attributes.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ macro scope.
206206
You may use format arguments like `{T}`, `{A}` to correspond to the
207207
types at the point of use corresponding to the type parameters of the
208208
trait of the same name. `{Self}` will be replaced with the type that is supposed
209-
to implement the trait but doesn't. To use this, the `on_unimplemented` feature gate
210-
must be enabled.
209+
to implement the trait but doesn't. You can also use the trait's name which will
210+
be replaced with the full path for the trait, for example for the trait `Foo` in
211+
module `Bar`, `{Foo}` can be used and will show up as `Bar::Foo`.
212+
To use this, the `on_unimplemented` feature gate must be enabled.
211213
- `must_use` - on structs and enums, will warn if a value of this type isn't used or
212214
assigned to a variable. You may also include an optional message by using
213215
`#[must_use = "message"]` which will be given alongside the warning.

0 commit comments

Comments
 (0)