@@ -50,18 +50,10 @@ pub enum CanonAbi {
50
50
51
51
impl fmt:: Display for CanonAbi {
52
52
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
53
- self . to_erased_extern_abi ( ) . as_str ( ) . fmt ( f)
54
- }
55
- }
56
-
57
- impl CanonAbi {
58
- /// convert to the ExternAbi that *shares a string* with this CanonAbi
59
- ///
60
- /// A target-insensitive mapping of CanonAbi to ExternAbi, convenient for "forwarding" impls.
61
- /// Importantly, the set of CanonAbi values is a logical *subset* of ExternAbi values,
62
- /// so this is injective: if you take an ExternAbi to a CanonAbi and back, you have lost data.
63
- const fn to_erased_extern_abi ( self ) -> ExternAbi {
64
- match self {
53
+ // convert to the ExternAbi that *shares a string* with this CanonAbi.
54
+ // FIXME: ideally we'd avoid printing `CanonAbi`, and preserve `ExternAbi` everywhere
55
+ // that we need to generate error messages.
56
+ let erased_abi = match self {
65
57
CanonAbi :: C => ExternAbi :: C { unwind : false } ,
66
58
CanonAbi :: Rust => ExternAbi :: Rust ,
67
59
CanonAbi :: RustCold => ExternAbi :: RustCold ,
@@ -87,7 +79,8 @@ impl CanonAbi {
87
79
X86Call :: Vectorcall => ExternAbi :: Vectorcall { unwind : false } ,
88
80
X86Call :: Win64 => ExternAbi :: Win64 { unwind : false } ,
89
81
} ,
90
- }
82
+ } ;
83
+ erased_abi. as_str ( ) . fmt ( f)
91
84
}
92
85
}
93
86
0 commit comments