File tree 5 files changed +42
-80
lines changed
doc/rustc/src/lints/listing
5 files changed +42
-80
lines changed Original file line number Diff line number Diff line change @@ -239,3 +239,44 @@ error: invalid `crate_type` value
239
239
| ^^^^^^^^^^^^^^^^^^^^
240
240
|
241
241
```
242
+
243
+ ## incoherent-fundamental-impls
244
+
245
+ This lint detects potentially-conflicting impls that were erroneously allowed. Some
246
+ example code that triggers this lint:
247
+
248
+ ``` rust,ignore
249
+ pub trait Trait1<X> {
250
+ type Output;
251
+ }
252
+
253
+ pub trait Trait2<X> {}
254
+
255
+ pub struct A;
256
+
257
+ impl<X, T> Trait1<X> for T where T: Trait2<X> {
258
+ type Output = ();
259
+ }
260
+
261
+ impl<X> Trait1<Box<X>> for A {
262
+ type Output = i32;
263
+ }
264
+ ```
265
+
266
+ This will produce:
267
+
268
+ ``` text
269
+ error: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
270
+ --> src/main.rs:13:1
271
+ |
272
+ 9 | impl<X, T> Trait1<X> for T where T: Trait2<X> {
273
+ | --------------------------------------------- first implementation here
274
+ ...
275
+ 13 | impl<X> Trait1<Box<X>> for A {
276
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
277
+ |
278
+ = note: #[deny(incoherent_fundamental_impls)] on by default
279
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
280
+ = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
281
+ = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
282
+ ```
Original file line number Diff line number Diff line change @@ -117,47 +117,6 @@ warning: found struct without foreign-function-safe representation annotation in
117
117
|
118
118
```
119
119
120
- ## incoherent-fundamental-impls
121
-
122
- This lint detects potentially-conflicting impls that were erroneously allowed. Some
123
- example code that triggers this lint:
124
-
125
- ``` rust
126
- pub trait Trait1 <X > {
127
- type Output ;
128
- }
129
-
130
- pub trait Trait2 <X > {}
131
-
132
- pub struct A ;
133
-
134
- impl <X , T > Trait1 <X > for T where T : Trait2 <X > {
135
- type Output = ();
136
- }
137
-
138
- impl <X > Trait1 <Box <X >> for A {
139
- type Output = i32 ;
140
- }
141
- ```
142
-
143
- This will produce:
144
-
145
- ``` text
146
- warning: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
147
- --> src/main.rs:13:1
148
- |
149
- 9 | impl<X, T> Trait1<X> for T where T: Trait2<X> {
150
- | --------------------------------------------- first implementation here
151
- ...
152
- 13 | impl<X> Trait1<Box<X>> for A {
153
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
154
- |
155
- = note: #[warn(incoherent_fundamental_impls)] on by default
156
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
157
- = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
158
- = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
159
- ```
160
-
161
120
## late-bound-lifetime-arguments
162
121
163
122
This lint detects detects generic lifetime arguments in path segments with
Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ declare_lint! {
208
208
209
209
declare_lint ! {
210
210
pub INCOHERENT_FUNDAMENTAL_IMPLS ,
211
- Warn ,
211
+ Deny ,
212
212
"potentially-conflicting impls were erroneously allowed"
213
213
}
214
214
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- #![ deny( incoherent_fundamental_impls) ]
12
-
13
11
pub trait Trait1 < X > {
14
12
type Output ;
15
13
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments