Skip to content

Commit 09f0548

Browse files
author
Anthony Kalaitzis
committed
Add passing & failing test for bultin dyn trait generation
1 parent 22e9fe6 commit 09f0548

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(ptr_metadata)]
2+
// Address issue #112737 -- ICE with dyn Pointee
3+
extern crate core;
4+
use core::ptr::Pointee;
5+
6+
fn unknown_sized_object_ptr_in(_: &(impl Pointee<Metadata = ()> + ?Sized)) {}
7+
8+
fn raw_pointer_in(x: &dyn Pointee<Metadata = ()>) {
9+
unknown_sized_object_ptr_in(x)
10+
//~^ ERROR type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>::Metadata == ()`
11+
}
12+
13+
fn main() {
14+
raw_pointer_in(&42)
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0271]: type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>::Metadata == ()`
2+
--> $DIR/ice-with-dyn-pointee-errors.rs:9:33
3+
|
4+
LL | unknown_sized_object_ptr_in(x)
5+
| --------------------------- ^ expected `()`, found `DynMetadata<dyn Pointee<Metadata = ...>>`
6+
| |
7+
| required by a bound introduced by this call
8+
|
9+
= note: expected unit type `()`
10+
found struct `DynMetadata<dyn Pointee<Metadata = ()>>`
11+
note: required by a bound in `unknown_sized_object_ptr_in`
12+
--> $DIR/ice-with-dyn-pointee-errors.rs:6:50
13+
|
14+
LL | fn unknown_sized_object_ptr_in(_: &(impl Pointee<Metadata = ()> + ?Sized)) {}
15+
| ^^^^^^^^^^^^^ required by this bound in `unknown_sized_object_ptr_in`
16+
17+
error: aborting due to previous error
18+
19+
For more information about this error, try `rustc --explain E0271`.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// run-pass
2+
#![feature(ptr_metadata)]
3+
// Address issue #112737 -- ICE with dyn Pointee
4+
extern crate core;
5+
use core::ptr::Pointee;
6+
7+
fn raw_pointer_in(_: &dyn Pointee<Metadata = ()>) {}
8+
9+
fn main() {
10+
raw_pointer_in(&42)
11+
}

0 commit comments

Comments
 (0)