Skip to content

Commit a328b7d

Browse files
committed
fix comments after discussion
1 parent 8fc6554 commit a328b7d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/coherence.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ but normally isn't.
4242

4343
The overlap check has various modes (see [`OverlapMode`]).
4444
Importantly, there's the explicit negative impl check, and the implicit negative impl check.
45-
Both try to apply negative reasoning to prove that an overlap is definitely impossible.
45+
Both try to prove that an overlap is definitely impossible.
4646

4747
[`OverlapMode`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_middle/traits/specialization_graph/enum.OverlapMode.html
4848

@@ -54,15 +54,15 @@ This check tries to find a negative trait implementation.
5454
For example:
5555

5656
```rust
57-
struct MyCustomBox<T: ?Sized>(Box<T>)
57+
struct MyCustomErrorType;
5858

5959
// both in your own crate
60-
impl From<&str> for MyCustomBox<dyn Error> {}
61-
impl<E> From<E> for MyCustomBox<dyn Error> where E: Error {}
60+
impl From<&str> for MyCustomErrorType {}
61+
impl<E> From<E> for MyCustomErrorType where E: Error {}
6262
```
6363

6464
In this example, we'd get:
65-
`MyCustomBox<dyn Error>: From<&str>` and `MyCustomBox<dyn Error>: From<?E>`, giving `?E = &str`.
65+
`MyCustomErrorType: From<&str>` and `MyCustomErrorType: From<?E>`, giving `?E = &str`.
6666

6767
And thus, these two implementations would overlap.
6868
However, libstd provides `&str: !Error`, and therefore guarantees that there
@@ -71,7 +71,7 @@ will never be a positive implementation of `&str: Error`, and thus there is no o
7171
Note that for this kind of negative impl check, we must have explicit negative implementations provided.
7272
This is not currently stable.
7373

74-
[`impl_intersection_has_negative_obligation`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_trait_selection/traits/coherence/fn.impl_intersection_has_impossible_obligation.htmlhttps://doc.rust-lang.org/beta/nightly-rustc/rustc_trait_selection/traits/coherence/fn.impl_intersection_has_negative_obligation.html
74+
[`impl_intersection_has_negative_obligation`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_trait_selection/traits/coherence/fn.impl_intersection_has_negative_obligation.html
7575

7676
### The implicit negative impl check
7777

@@ -93,5 +93,3 @@ Importantly, this works even if there isn't a `impl !Error for MyLocalType`.
9393

9494
[`impl_intersection_has_impossible_obligation`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_trait_selection/traits/coherence/fn.impl_intersection_has_impossible_obligation.html
9595

96-
97-

0 commit comments

Comments
 (0)