mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Add passing & failing test for bultin dyn trait generation
This commit is contained in:
parent
22e9fe644e
commit
09f05489e3
15
tests/ui/traits/ice-with-dyn-pointee-errors.rs
Normal file
15
tests/ui/traits/ice-with-dyn-pointee-errors.rs
Normal file
@ -0,0 +1,15 @@
|
||||
#![feature(ptr_metadata)]
|
||||
// Address issue #112737 -- ICE with dyn Pointee
|
||||
extern crate core;
|
||||
use core::ptr::Pointee;
|
||||
|
||||
fn unknown_sized_object_ptr_in(_: &(impl Pointee<Metadata = ()> + ?Sized)) {}
|
||||
|
||||
fn raw_pointer_in(x: &dyn Pointee<Metadata = ()>) {
|
||||
unknown_sized_object_ptr_in(x)
|
||||
//~^ ERROR type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>::Metadata == ()`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
raw_pointer_in(&42)
|
||||
}
|
19
tests/ui/traits/ice-with-dyn-pointee-errors.stderr
Normal file
19
tests/ui/traits/ice-with-dyn-pointee-errors.stderr
Normal file
@ -0,0 +1,19 @@
|
||||
error[E0271]: type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>::Metadata == ()`
|
||||
--> $DIR/ice-with-dyn-pointee-errors.rs:9:33
|
||||
|
|
||||
LL | unknown_sized_object_ptr_in(x)
|
||||
| --------------------------- ^ expected `()`, found `DynMetadata<dyn Pointee<Metadata = ...>>`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found struct `DynMetadata<dyn Pointee<Metadata = ()>>`
|
||||
note: required by a bound in `unknown_sized_object_ptr_in`
|
||||
--> $DIR/ice-with-dyn-pointee-errors.rs:6:50
|
||||
|
|
||||
LL | fn unknown_sized_object_ptr_in(_: &(impl Pointee<Metadata = ()> + ?Sized)) {}
|
||||
| ^^^^^^^^^^^^^ required by this bound in `unknown_sized_object_ptr_in`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
11
tests/ui/traits/ice-with-dyn-pointee.rs
Normal file
11
tests/ui/traits/ice-with-dyn-pointee.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// run-pass
|
||||
#![feature(ptr_metadata)]
|
||||
// Address issue #112737 -- ICE with dyn Pointee
|
||||
extern crate core;
|
||||
use core::ptr::Pointee;
|
||||
|
||||
fn raw_pointer_in(_: &dyn Pointee<Metadata = ()>) {}
|
||||
|
||||
fn main() {
|
||||
raw_pointer_in(&42)
|
||||
}
|
Loading…
Reference in New Issue
Block a user