Failing test

This commit is contained in:
Michael Goulet 2023-08-17 17:43:38 +00:00
parent 19dd953540
commit 55ce976e06
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,37 @@
- // MIR for `call` before Inline
+ // MIR for `call` after Inline
fn call(_1: &T) -> TypeId {
debug s => _1;
let mut _0: std::any::TypeId;
let mut _2: &T;
+ scope 1 (inlined <T as Any>::type_id) {
+ debug self => _2;
+ scope 2 (inlined TypeId::of::<T>) {
+ let _3: u128;
+ let mut _4: u128;
+ scope 3 {
+ debug t => _3;
+ }
+ }
+ }
bb0: {
StorageLive(_2);
_2 = &(*_1);
- _0 = <T as Any>::type_id(move _2) -> [return: bb1, unwind unreachable];
+ StorageLive(_3);
+ _3 = std::intrinsics::type_id::<T>() -> [return: bb1, unwind unreachable];
}
bb1: {
+ StorageLive(_4);
+ _4 = _3;
+ _0 = TypeId { t: move _4 };
+ StorageDead(_4);
+ StorageDead(_3);
StorageDead(_2);
return;
}
}

View File

@ -0,0 +1,15 @@
// unit-test: Inline
// compile-flags: --crate-type=lib -C panic=abort
use std::any::Any;
use std::any::TypeId;
struct A<T: ?Sized + 'static> {
a: i32,
b: T,
}
// EMIT_MIR dont_inline_type_id.call.Inline.diff
fn call<T: ?Sized + 'static>(s: &T) -> TypeId {
s.type_id()
}