@@ -42,7 +42,7 @@ but normally isn't.
42
42
43
43
The overlap check has various modes (see [ ` OverlapMode ` ] ).
44
44
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.
46
46
47
47
[ `OverlapMode` ] : https://doc.rust-lang.org/beta/nightly-rustc/rustc_middle/traits/specialization_graph/enum.OverlapMode.html
48
48
@@ -54,15 +54,15 @@ This check tries to find a negative trait implementation.
54
54
For example:
55
55
56
56
``` rust
57
- struct MyCustomBox < T : ? Sized >( Box < T >)
57
+ struct MyCustomErrorType ;
58
58
59
59
// 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 {}
62
62
```
63
63
64
64
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 ` .
66
66
67
67
And thus, these two implementations would overlap.
68
68
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
71
71
Note that for this kind of negative impl check, we must have explicit negative implementations provided.
72
72
This is not currently stable.
73
73
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
75
75
76
76
### The implicit negative impl check
77
77
@@ -93,5 +93,3 @@ Importantly, this works even if there isn't a `impl !Error for MyLocalType`.
93
93
94
94
[ `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
95
95
96
-
97
-
0 commit comments