Skip to content

Commit 104f78a

Browse files
committed
Clarify what example is showing
1 parent f67d0d2 commit 104f78a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/code-considerations/using-unstable-lang/specialization.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ There are two unstable attributes that can be used to allow a trait bound in a s
6565
`rustc_specialization_trait` restricts the implementations of a trait to be "always applicable". Implementing traits annotated with `rustc_specialization_trait` is unstable, so this should not be used on any stable traits exported from the standard library. `Sized` is an exception, and can have this attribute because it already cannot be implemented by an `impl` block.
6666
**Note**: `rustc_specialization_trait` only prevents incorrect monomorphizations, it does not prevent a type from being coerced between specialized and unspecialized types which can be important when specialization must be applied consistently. See [rust-lang/rust#85863](https://github.com/rust-lang/rust/issues/85863) for more details.
6767

68-
`rustc_unsafe_specialization_marker` allows specializing on a trait with no associated items. The attribute is `unsafe` because lifetime constraints from the implementations of the trait are not considered when specializing. The following example demonstrates incorrect usage of `rustc_unsafe_specialization_marker`, the specialized implementation is used for *all* shared reference types, not just those with `'static` lifetime.
68+
`rustc_unsafe_specialization_marker` allows specializing on a trait with no associated items. The attribute is `unsafe` because lifetime constraints from the implementations of the trait are not considered when specializing. The following example demonstrates a limitation of `rustc_unsafe_specialization_marker`, the specialized implementation is used for *all* shared reference types, not just those with `'static` lifetime. Because of this, new uses of `rustc_unsafe_specialization_marker` should be avoided.
6969

7070
```rust,ignore
7171
#[rustc_unsafe_specialization_marker]
@@ -90,7 +90,7 @@ impl<T: StaticRef> DoThing for T {
9090
}
9191
```
9292

93-
`rustc_unsafe_specialization_marker` exists to allow existing specializations that are based on marker traits exported from `std`, such as `Copy`, `FusedIterator` or `Eq`. New uses of `rustc_unsafe_specialization_marker` should be avoided.
93+
`rustc_unsafe_specialization_marker` exists to allow existing specializations that are based on marker traits exported from `std`, such as `Copy`, `FusedIterator` or `Eq`.
9494

9595
## For reviewers
9696

0 commit comments

Comments
 (0)