-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't consider regions in deref_into_dyn_supertrait lint
- Loading branch information
1 parent
069a4af
commit bea815b
Showing
5 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![deny(deref_into_dyn_supertrait)] | ||
|
||
use std::ops::Deref; | ||
|
||
trait Bar<'a> {} | ||
trait Foo<'a>: Bar<'a> {} | ||
|
||
impl<'a> Deref for dyn Foo<'a> { | ||
//~^ ERROR dyn Foo<'_>` implements `Deref` with supertrait `Bar<'_>` as target | ||
//~| WARN this was previously accepted by the compiler | ||
type Target = dyn Bar<'a>; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() {} |
19 changes: 19 additions & 0 deletions
19
tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error: `dyn Foo<'_>` implements `Deref` with supertrait `Bar<'_>` as target | ||
--> $DIR/migrate-lint-deny-regions.rs:8:1 | ||
| | ||
LL | impl<'a> Deref for dyn Foo<'a> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | type Target = dyn Bar<'a>; | ||
| -------------------------- target type is set here | ||
| | ||
= 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> | ||
note: the lint level is defined here | ||
--> $DIR/migrate-lint-deny-regions.rs:1:9 | ||
| | ||
LL | #![deny(deref_into_dyn_supertrait)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters