diff options
| author | lcnr <rust@lcnr.de> | 2022-03-23 10:06:29 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2022-05-20 11:49:29 +0200 |
| commit | 5ac973426eb1f6b3dd9b883daedbfe71f27da704 (patch) | |
| tree | 4e9543400f0b74d623163dae2129bd53fe040cb9 /src | |
| parent | f3f68324cc0eddf115270a71147738eb94cbcad0 (diff) | |
rewrite `ensure_drop_params_and_item_params_correspond`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/auto-traits/suspicious-impls-lint.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/dropck/issue-38868.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/dropck/reject-specialized-drops-8142.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/dropck/reject-specialized-drops-8142.stderr | 63 |
4 files changed, 35 insertions, 45 deletions
diff --git a/src/test/ui/auto-traits/suspicious-impls-lint.stderr b/src/test/ui/auto-traits/suspicious-impls-lint.stderr index e299e5369fe..03460b28dcd 100644 --- a/src/test/ui/auto-traits/suspicious-impls-lint.stderr +++ b/src/test/ui/auto-traits/suspicious-impls-lint.stderr @@ -11,12 +11,12 @@ LL | #![deny(suspicious_auto_trait_impls)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> + = note: `&T` is not a generic parameter note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:8:1 | LL | struct MayImplementSendErr<T>(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: `&T` is not a generic parameter error: cross-crate traits with a default impl, like `Send`, should not be specialized --> $DIR/suspicious-impls-lint.rs:21:1 @@ -26,12 +26,12 @@ LL | unsafe impl Send for ContainsVec<i32> {} | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> + = note: `i32` is not a generic parameter note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:20:1 | LL | struct ContainsVec<T>(Vec<T>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: `i32` is not a generic parameter error: cross-crate traits with a default impl, like `Send`, should not be specialized --> $DIR/suspicious-impls-lint.rs:32:1 @@ -41,12 +41,12 @@ LL | unsafe impl<T: Send> Send for TwoParamsSame<T, T> {} | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> + = note: `T` is mentioned multiple times note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:31:1 | LL | struct TwoParamsSame<T, U>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: `T` is mentioned multiple times error: cross-crate traits with a default impl, like `Send`, should not be specialized --> $DIR/suspicious-impls-lint.rs:40:1 @@ -56,12 +56,12 @@ LL | unsafe impl<T> Send for WithPhantomDataSend<*const T, i8> {} | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> + = note: `*const T` is not a generic parameter note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:39:1 | LL | pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: `*const T` is not a generic parameter error: cross-crate traits with a default impl, like `Sync`, should not be specialized --> $DIR/suspicious-impls-lint.rs:46:1 @@ -71,12 +71,12 @@ LL | unsafe impl<T> Sync for WithLifetime<'static, Vec<T>> {} | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> + = note: `Vec<T>` is not a generic parameter note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:44:1 | LL | pub struct WithLifetime<'a, T>(&'a (), T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: `Vec<T>` is not a generic parameter error: aborting due to 5 previous errors diff --git a/src/test/ui/dropck/issue-38868.stderr b/src/test/ui/dropck/issue-38868.stderr index 10d1e7c4e66..f369b74cf55 100644 --- a/src/test/ui/dropck/issue-38868.stderr +++ b/src/test/ui/dropck/issue-38868.stderr @@ -8,6 +8,7 @@ LL | | } LL | | } | |_^ | + = note: `i32` is not a generic parameter note: use the same sequence of generic type, lifetime and const parameters as the struct definition --> $DIR/issue-38868.rs:1:1 | diff --git a/src/test/ui/dropck/reject-specialized-drops-8142.rs b/src/test/ui/dropck/reject-specialized-drops-8142.rs index c9599f6e805..7a3bbe7cb09 100644 --- a/src/test/ui/dropck/reject-specialized-drops-8142.rs +++ b/src/test/ui/dropck/reject-specialized-drops-8142.rs @@ -32,9 +32,7 @@ impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // RE impl<'ml> Drop for M<'ml> { fn drop(&mut self) { } } // ACCEPT impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT -//~^ ERROR mismatched types -//~| expected struct `N<'n>` -//~| found struct `N<'static>` +//~^ ERROR `Drop` impls cannot be specialized impl<COkNoBound> Drop for O<COkNoBound> { fn drop(&mut self) { } } // ACCEPT @@ -57,7 +55,7 @@ impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT //~^ ERROR `Drop` impls cannot be specialized impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT -//~^ ERROR cannot infer an appropriate lifetime for lifetime parameter `'lw` +//~^ ERROR `Drop` impls cannot be specialized impl Drop for X<3> { fn drop(&mut self) { } } // REJECT //~^ ERROR `Drop` impls cannot be specialized diff --git a/src/test/ui/dropck/reject-specialized-drops-8142.stderr b/src/test/ui/dropck/reject-specialized-drops-8142.stderr index 8dbde9d417d..82e95ea075d 100644 --- a/src/test/ui/dropck/reject-specialized-drops-8142.stderr +++ b/src/test/ui/dropck/reject-specialized-drops-8142.stderr @@ -22,27 +22,26 @@ note: the implementor must specify the same requirement LL | struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types +error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:34:1 | LL | impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected struct `N<'n>` - found struct `N<'static>` -note: the lifetime `'n` as defined here... - --> $DIR/reject-specialized-drops-8142.rs:7:10 + = note: `'static` is not a generic parameter +note: use the same sequence of generic type, lifetime and const parameters as the struct definition + --> $DIR/reject-specialized-drops-8142.rs:7:1 | LL | struct N<'n> { x: &'n i8 } - | ^^ - = note: ...does not necessarily outlive the static lifetime + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized - --> $DIR/reject-specialized-drops-8142.rs:41:1 + --> $DIR/reject-specialized-drops-8142.rs:39:1 | LL | impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `i8` is not a generic parameter note: use the same sequence of generic type, lifetime and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:9:1 | @@ -50,7 +49,7 @@ LL | struct P<Tp> { x: *const Tp } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not - --> $DIR/reject-specialized-drops-8142.rs:44:14 + --> $DIR/reject-specialized-drops-8142.rs:42:14 | LL | impl<AddsBnd:Bound> Drop for Q<AddsBnd> { fn drop(&mut self) { } } // REJECT | ^^^^^ @@ -62,7 +61,7 @@ LL | struct Q<Tq> { x: *const Tq } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsRBnd: 'rbnd` but the struct it is implemented for does not - --> $DIR/reject-specialized-drops-8142.rs:47:21 + --> $DIR/reject-specialized-drops-8142.rs:45:21 | LL | impl<'rbnd,AddsRBnd:'rbnd> Drop for R<AddsRBnd> { fn drop(&mut self) { } } // REJECT | ^^^^^ @@ -74,47 +73,38 @@ LL | struct R<Tr> { x: *const Tr } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized - --> $DIR/reject-specialized-drops-8142.rs:56:1 + --> $DIR/reject-specialized-drops-8142.rs:54:1 | LL | impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `One` is mentioned multiple times note: use the same sequence of generic type, lifetime and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:15:1 | LL | struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'lw` due to conflicting requirements - --> $DIR/reject-specialized-drops-8142.rs:59:1 +error[E0366]: `Drop` impls cannot be specialized + --> $DIR/reject-specialized-drops-8142.rs:57:1 | LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'l1` as defined here... - --> $DIR/reject-specialized-drops-8142.rs:16:10 - | -LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } - | ^^^ -note: ...but the lifetime must also be valid for the lifetime `'l2` as defined here... - --> $DIR/reject-specialized-drops-8142.rs:16:15 + = note: `'lw` is mentioned multiple times +note: use the same sequence of generic type, lifetime and const parameters as the struct definition + --> $DIR/reject-specialized-drops-8142.rs:16:1 | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } - | ^^^ -note: ...so that the types are compatible - --> $DIR/reject-specialized-drops-8142.rs:59:1 - | -LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `W<'l1, 'l2>` - found `W<'_, '_>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized - --> $DIR/reject-specialized-drops-8142.rs:62:1 + --> $DIR/reject-specialized-drops-8142.rs:60:1 | LL | impl Drop for X<3> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `3_usize` is not a generic parameter note: use the same sequence of generic type, lifetime and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:17:1 | @@ -122,11 +112,12 @@ LL | struct X<const Ca: usize>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized - --> $DIR/reject-specialized-drops-8142.rs:65:1 + --> $DIR/reject-specialized-drops-8142.rs:63:1 | LL | impl<const Ca: usize> Drop for Y<Ca, Ca> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: `Ca` is mentioned multiple times note: use the same sequence of generic type, lifetime and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:18:1 | @@ -134,7 +125,7 @@ LL | struct Y<const Ca: usize, const Cb: usize>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not - --> $DIR/reject-specialized-drops-8142.rs:68:14 + --> $DIR/reject-specialized-drops-8142.rs:66:14 | LL | impl<AddsBnd:Bound> Drop for Enum<AddsBnd> { fn drop(&mut self) { } } // REJECT | ^^^^^ @@ -146,7 +137,7 @@ LL | enum Enum<T> { Variant(T) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not - --> $DIR/reject-specialized-drops-8142.rs:71:14 + --> $DIR/reject-specialized-drops-8142.rs:69:14 | LL | impl<AddsBnd:Bound> Drop for TupleStruct<AddsBnd> { fn drop(&mut self) { } } // REJECT | ^^^^^ @@ -158,7 +149,7 @@ LL | struct TupleStruct<T>(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the union it is implemented for does not - --> $DIR/reject-specialized-drops-8142.rs:74:21 + --> $DIR/reject-specialized-drops-8142.rs:72:21 | LL | impl<AddsBnd:Copy + Bound> Drop for Union<AddsBnd> { fn drop(&mut self) { } } // REJECT | ^^^^^ @@ -171,5 +162,5 @@ LL | union Union<T: Copy> { f: T } error: aborting due to 13 previous errors -Some errors have detailed explanations: E0308, E0366, E0367, E0495. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0366, E0367. +For more information about an error, try `rustc --explain E0366`. |
