File tree 2 files changed +19
-1
lines changed
compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for TransformTy<'tcx> {
146
146
!is_zst
147
147
} ) ;
148
148
if let Some ( field) = field {
149
- let ty0 = self . tcx . type_of ( field. did ) . instantiate ( self . tcx , args) ;
149
+ let ty0 = self . tcx . erase_regions ( field. ty ( self . tcx , args) ) ;
150
150
// Generalize any repr(transparent) user-defined type that is either a
151
151
// pointer or reference, and either references itself or any other type that
152
152
// contains or references itself, to avoid a reference cycle.
Original file line number Diff line number Diff line change
1
+ //@ needs-sanitizer-cfi
2
+ //@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
3
+ //@ no-prefer-dynamic
4
+ //@ only-x86_64-unknown-linux-gnu
5
+ //@ build-pass
6
+
7
+ pub trait Trait { }
8
+
9
+ impl Trait for i32 { }
10
+
11
+ #[ repr( transparent) ]
12
+ struct BoxedTrait ( Box < dyn Trait + ' static > ) ;
13
+
14
+ fn hello ( x : BoxedTrait ) { }
15
+
16
+ fn main ( ) {
17
+ hello ( BoxedTrait ( Box :: new ( 1 ) ) ) ;
18
+ }
You can’t perform that action at this time.
0 commit comments