Skip to content

Commit 5311c59

Browse files
committed
Clarify the need for #[refine] with unsafe
1 parent f298eda commit 5311c59

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

text/3245-refined-impls.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This RFC generalizes the [`safe_unsafe_trait_methods` RFC][safe_unsafe], allowin
1515
# Motivation
1616
[motivation]: #motivation
1717

18-
[RFC 2316][safe_unsafe] introduced the notion of _safe implementations_ of unsafe trait methods. This allows code that knows it is calling a safe implementation of an unsafe trait method to do so without using an unsafe block. In other words, this works today:
18+
[RFC 2316][safe_unsafe] introduced the notion of _safe implementations_ of unsafe trait methods. This allows code that knows it is calling a safe implementation of an unsafe trait method to do so without using an unsafe block. In other words, this works under RFC 2316, which is not yet implemented:
1919

2020
```rust
2121
trait Foo {
@@ -149,7 +149,7 @@ impl Sink for SimpleSink {
149149
}
150150
```
151151

152-
Finally, methods marked `unsafe` in traits can be implemented as safe APIs, allowing code to call them without using `unsafe` blocks.
152+
Finally, methods marked `unsafe` in traits can be refined as safe APIs, allowing code to call them without using `unsafe` blocks.
153153

154154
[^rpitit]: At the time of writing, return position impl Trait is not allowed in traits. The guide text written here is only for the purpose of illustrating how we would document this feature if it were allowed.
155155

@@ -224,6 +224,10 @@ This RFC establishes a policy that anytime the signature of an associated item i
224224

225225
This RFC specifically does not specify that new language features involving traits *should* allow refined impls wherever possible. The language could choose not to accept refined implementation signatures for that feature. This should be decided on a case-by-case basis for each feature.
226226

227+
## RFC 2316
228+
229+
[RFC 2316][safe_unsafe] is amended by this RFC to require `#[refine]` on safe implementations of unsafe trait methods.
230+
227231
## Interaction with other features
228232

229233
### Implied bounds

0 commit comments

Comments
 (0)