-
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.
- Loading branch information
Showing
6 changed files
with
168 additions
and
1 deletion.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#![deny(deref_into_dyn_supertrait)] | ||
|
||
extern crate core; | ||
|
||
use core::ops::Deref; | ||
|
||
// issue 89190 | ||
trait A {} | ||
trait B: A {} | ||
impl<'a> Deref for dyn 'a + B { | ||
type Target = dyn A; | ||
fn deref(&self) -> &Self::Target { | ||
todo!() | ||
} | ||
} | ||
|
||
fn take_a(_: &dyn A) {} | ||
|
||
fn whoops(b: &dyn B) { | ||
take_a(b) | ||
//~^ ERROR `dyn B` implements `Deref` with supertrait `(dyn A + 'static)` as output | ||
//~^^ WARN this was previously accepted by the compiler but is being phased out; | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/traits/trait-upcasting/migrate-lint-deny.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,16 @@ | ||
error: `dyn B` implements `Deref` with supertrait `(dyn A + 'static)` as output | ||
--> $DIR/migrate-lint-deny.rs:20:12 | ||
| | ||
LL | take_a(b) | ||
| ^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/migrate-lint-deny.rs:1:9 | ||
| | ||
LL | #![deny(deref_into_dyn_supertrait)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= 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> | ||
|
||
error: aborting due to previous error | ||
|