File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed
compiler/rustc_symbol_mangling/src Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ pub(super) fn mangle<'tcx>(
4545 ty:: InstanceDef :: ThreadLocalShim ( _) => Some ( "tls" ) ,
4646 ty:: InstanceDef :: VTableShim ( _) => Some ( "vtable" ) ,
4747 ty:: InstanceDef :: ReifyShim ( _, None ) => Some ( "reify" ) ,
48- ty:: InstanceDef :: ReifyShim ( _, Some ( ReifyReason :: FnPtr ) ) => Some ( "reify-fnptr " ) ,
49- ty:: InstanceDef :: ReifyShim ( _, Some ( ReifyReason :: Vtable ) ) => Some ( "reify-vtable " ) ,
48+ ty:: InstanceDef :: ReifyShim ( _, Some ( ReifyReason :: FnPtr ) ) => Some ( "reify_fnptr " ) ,
49+ ty:: InstanceDef :: ReifyShim ( _, Some ( ReifyReason :: Vtable ) ) => Some ( "reify_vtable " ) ,
5050
5151 ty:: InstanceDef :: ConstructCoroutineInClosureShim { .. }
5252 | ty:: InstanceDef :: CoroutineKindShim { .. } => Some ( "fn_once" ) ,
Original file line number Diff line number Diff line change 1+ // Check KCFI extra mangling works correctly on v0
2+
3+ //@ needs-sanitizer-kcfi
4+ //@ no-prefer-dynamic
5+ //@ compile-flags: -C panic=abort -Zsanitizer=kcfi -C symbol-mangling-version=v0
6+ //@ build-pass
7+
8+ trait Foo {
9+ fn foo ( & self ) ;
10+ }
11+
12+ struct Bar ;
13+ impl Foo for Bar {
14+ fn foo ( & self ) { }
15+ }
16+
17+ struct Baz ;
18+ impl Foo for Baz {
19+ #[ track_caller]
20+ fn foo ( & self ) { }
21+ }
22+
23+ fn main ( ) {
24+ // Produces `ReifyShim(_, ReifyReason::FnPtr)`
25+ let f: fn ( & Bar ) = Bar :: foo;
26+ f ( & Bar ) ;
27+ // Produces `ReifyShim(_, ReifyReason::Vtable)`
28+ let v: & dyn Foo = & Baz as _ ;
29+ v. foo ( ) ;
30+ }
You can’t perform that action at this time.
0 commit comments