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>(
45
45
ty:: InstanceDef :: ThreadLocalShim ( _) => Some ( "tls" ) ,
46
46
ty:: InstanceDef :: VTableShim ( _) => Some ( "vtable" ) ,
47
47
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 " ) ,
50
50
51
51
ty:: InstanceDef :: ConstructCoroutineInClosureShim { .. }
52
52
| 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