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
5 changed files
with
32 additions
and
7 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
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,13 @@ | ||
trait Foo {} | ||
|
||
trait Bar: Foo {} | ||
|
||
impl Foo for () {} | ||
|
||
impl Bar for () {} | ||
|
||
fn main() { | ||
let bar: &dyn Bar = &(); | ||
let foo: &dyn Foo = bar; | ||
//~^ ERROR trait upcasting is experimental [E0658] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/feature-gates/feature-gate-trait_upcasting.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,12 @@ | ||
error[E0658]: trait upcasting is experimental | ||
--> $DIR/feature-gate-trait_upcasting.rs:11:25 | ||
| | ||
LL | let foo: &dyn Foo = bar; | ||
| ^^^ | ||
| | ||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information | ||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
error[E0308]: mismatched types | ||
error[E0658]: trait upcasting is experimental | ||
--> $DIR/issue-11515.rs:9:33 | ||
| | ||
LL | let test = box Test { func: closure }; | ||
| ^^^^^^^ expected trait `FnMut`, found trait `Fn` | ||
| ^^^^^^^ | ||
| | ||
= note: expected struct `Box<(dyn FnMut() + 'static)>` | ||
found struct `Box<(dyn Fn() + 'static)>` | ||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information | ||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. | ||
For more information about this error, try `rustc --explain E0658`. |