diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-22 21:33:19 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-23 15:40:27 +0000 |
| commit | 0d4a5c725a3f0cbc2f2597be7e9dec9ba27409ff (patch) | |
| tree | 2c6378893e44776023fa55507815f71edb03ccd0 /src/test | |
| parent | 11a5386256c3d9bf835cf51f0798dfffa51d00f0 (diff) | |
| download | rust-0d4a5c725a3f0cbc2f2597be7e9dec9ba27409ff.tar.gz rust-0d4a5c725a3f0cbc2f2597be7e9dec9ba27409ff.zip | |
Make `deref_into_dyn_supertrait` lint the impl and not the usage
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/traits/trait-upcasting/migrate-lint-deny.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/traits/trait-upcasting/migrate-lint-deny.stderr | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/test/ui/traits/trait-upcasting/migrate-lint-deny.rs b/src/test/ui/traits/trait-upcasting/migrate-lint-deny.rs index 5f5a2574bab..ae36115be7b 100644 --- a/src/test/ui/traits/trait-upcasting/migrate-lint-deny.rs +++ b/src/test/ui/traits/trait-upcasting/migrate-lint-deny.rs @@ -7,7 +7,11 @@ use core::ops::Deref; // issue 89190 trait A {} trait B: A {} + impl<'a> Deref for dyn 'a + B { + //~^ ERROR `(dyn B + 'a)` implements `Deref` with supertrait `A` as output + //~| WARN this was previously accepted by the compiler but is being phased out; + type Target = dyn A; fn deref(&self) -> &Self::Target { todo!() @@ -18,8 +22,6 @@ fn take_a(_: &dyn A) {} fn whoops(b: &dyn B) { take_a(b) - //~^ ERROR `dyn B` implements `Deref` with supertrait `A` as output - //~^^ WARN this was previously accepted by the compiler but is being phased out; } fn main() {} diff --git a/src/test/ui/traits/trait-upcasting/migrate-lint-deny.stderr b/src/test/ui/traits/trait-upcasting/migrate-lint-deny.stderr index 41381a3ffd1..03317d09eb6 100644 --- a/src/test/ui/traits/trait-upcasting/migrate-lint-deny.stderr +++ b/src/test/ui/traits/trait-upcasting/migrate-lint-deny.stderr @@ -1,8 +1,14 @@ -error: `dyn B` implements `Deref` with supertrait `A` as output - --> $DIR/migrate-lint-deny.rs:20:12 +error: `(dyn B + 'a)` implements `Deref` with supertrait `A` as output + --> $DIR/migrate-lint-deny.rs:11:1 | -LL | take_a(b) - | ^ +LL | / impl<'a> Deref for dyn 'a + B { +LL | | +LL | | +LL | | +... | +LL | | } +LL | | } + | |_^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460> |
