Skip to content

Commit

Permalink
Merge pull request #3244 from martinomburajr/patch-2
Browse files Browse the repository at this point in the history
Some punctuation and formatting fixes on RFC255
  • Loading branch information
nikomatsakis committed Mar 18, 2022
2 parents 7532223 + 5eb9201 commit 7227deb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions text/0255-object-safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ SomeTrait for SomeTrait { ... }`, but that seems weird and confusing and rather
like boilerplate. Note that the precise mechanism here is out of scope for this
RFC).

This is only sound if the trait is /object-safe/. We say a method `m` on trait
This is only sound if the trait is object-safe. We say a method `m` on trait
`T` is object-safe if it is legal (in current Rust) to call `x.m(...)` where `x`
has type `&T`, i.e., `x` is a trait object. If all methods in `T` are object-
safe, then we say `T` is object-safe.
has type `&T`, i.e., `x` is a trait object. If all methods in `T` are object-safe,
then we say `T` is object-safe.

If we ignore this restriction we could allow code such as the following:

Expand All @@ -61,8 +61,8 @@ traits. This makes both method call and using trait objects with generic code
simpler. The downside is that it makes Rust less flexible, since not all traits
can be used to create trait objects.

Software evolution is improved with this proposal: imagine adding a non-object-
safe method to a previously object-safe trait. With this proposal, you would
Software evolution is improved with this proposal: imagine adding a non-object-safe
method to a previously object-safe trait. With this proposal, you would
then get errors wherever a trait-object is created. The error would explain why
the trait object could not be created and point out exactly which method was to
blame and why. Without this proposal, the only errors you would get would be
Expand Down

0 comments on commit 7227deb

Please sign in to comment.