about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/validity/wrong-dyn-trait-generic.rs
blob: 9b1cefc4b1d3de914f174d5cb96cfe07b1c350dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
use std::mem;

// Make sure we notice the mismatch also if the difference is "only" in the generic
// parameters of the trait.

trait Trait<T> {}
impl<T> Trait<T> for T {}

fn main() {
    let x: &dyn Trait<i32> = &0;
    let _y: *const dyn Trait<u32> = unsafe { mem::transmute(x) }; //~ERROR: wrong trait
}