This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi Expand file tree Collapse file tree 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> {
146146 !is_zst
147147 } ) ;
148148 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) ) ;
150150 // Generalize any repr(transparent) user-defined type that is either a
151151 // pointer or reference, and either references itself or any other type that
152152 // 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