1
- //! Conversion of internal Rust compiler `rustc_target::abi ` and `rustc_abi` items to stable ones.
1
+ //! Conversion of internal Rust compiler `rustc_target` and `rustc_abi` items to stable ones.
2
2
3
3
#![ allow( rustc:: usage_of_qualified_ty) ]
4
4
5
5
use rustc_middle:: ty;
6
- use rustc_target:: abi :: call :: Conv ;
6
+ use rustc_target:: callconv :: { self , Conv } ;
7
7
use stable_mir:: abi:: {
8
8
AddressSpace , ArgAbi , CallConvention , FieldsShape , FloatLength , FnAbi , IntegerLength , Layout ,
9
9
LayoutShape , PassMode , Primitive , Scalar , TagEncoding , TyAndLayout , ValueAbi , VariantsShape ,
@@ -15,7 +15,7 @@ use stable_mir::ty::{Align, IndexedVal, VariantIdx};
15
15
16
16
use crate :: rustc_smir:: { Stable , Tables } ;
17
17
18
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: VariantIdx {
18
+ impl < ' tcx > Stable < ' tcx > for rustc_abi :: VariantIdx {
19
19
type T = VariantIdx ;
20
20
fn stable ( & self , _: & mut Tables < ' _ > ) -> Self :: T {
21
21
VariantIdx :: to_val ( self . as_usize ( ) )
@@ -33,25 +33,23 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Endian {
33
33
}
34
34
}
35
35
36
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: TyAndLayout < ' tcx , ty:: Ty < ' tcx > > {
36
+ impl < ' tcx > Stable < ' tcx > for rustc_abi :: TyAndLayout < ' tcx , ty:: Ty < ' tcx > > {
37
37
type T = TyAndLayout ;
38
38
39
39
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
40
40
TyAndLayout { ty : self . ty . stable ( tables) , layout : self . layout . stable ( tables) }
41
41
}
42
42
}
43
43
44
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: Layout < ' tcx > {
44
+ impl < ' tcx > Stable < ' tcx > for rustc_abi :: Layout < ' tcx > {
45
45
type T = Layout ;
46
46
47
47
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
48
48
tables. layout_id ( tables. tcx . lift ( * self ) . unwrap ( ) )
49
49
}
50
50
}
51
51
52
- impl < ' tcx > Stable < ' tcx >
53
- for rustc_abi:: LayoutData < rustc_target:: abi:: FieldIdx , rustc_target:: abi:: VariantIdx >
54
- {
52
+ impl < ' tcx > Stable < ' tcx > for rustc_abi:: LayoutData < rustc_abi:: FieldIdx , rustc_abi:: VariantIdx > {
55
53
type T = LayoutShape ;
56
54
57
55
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
@@ -65,7 +63,7 @@ impl<'tcx> Stable<'tcx>
65
63
}
66
64
}
67
65
68
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: call :: FnAbi < ' tcx , ty:: Ty < ' tcx > > {
66
+ impl < ' tcx > Stable < ' tcx > for callconv :: FnAbi < ' tcx , ty:: Ty < ' tcx > > {
69
67
type T = FnAbi ;
70
68
71
69
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
@@ -81,7 +79,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::FnAbi<'tcx, ty::Ty<'tcx>> {
81
79
}
82
80
}
83
81
84
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: call :: ArgAbi < ' tcx , ty:: Ty < ' tcx > > {
82
+ impl < ' tcx > Stable < ' tcx > for callconv :: ArgAbi < ' tcx , ty:: Ty < ' tcx > > {
85
83
type T = ArgAbi ;
86
84
87
85
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
@@ -93,7 +91,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::ArgAbi<'tcx, ty::Ty<'tcx>>
93
91
}
94
92
}
95
93
96
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: call :: Conv {
94
+ impl < ' tcx > Stable < ' tcx > for callconv :: Conv {
97
95
type T = CallConvention ;
98
96
99
97
fn stable ( & self , _tables : & mut Tables < ' _ > ) -> Self :: T {
@@ -122,31 +120,29 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::Conv {
122
120
}
123
121
}
124
122
125
- impl < ' tcx > Stable < ' tcx > for rustc_target :: abi :: call :: PassMode {
123
+ impl < ' tcx > Stable < ' tcx > for callconv :: PassMode {
126
124
type T = PassMode ;
127
125
128
126
fn stable ( & self , _tables : & mut Tables < ' _ > ) -> Self :: T {
129
127
match self {
130
- rustc_target :: abi :: call :: PassMode :: Ignore => PassMode :: Ignore ,
131
- rustc_target :: abi :: call :: PassMode :: Direct ( attr) => PassMode :: Direct ( opaque ( attr) ) ,
132
- rustc_target :: abi :: call :: PassMode :: Pair ( first, second) => {
128
+ callconv :: PassMode :: Ignore => PassMode :: Ignore ,
129
+ callconv :: PassMode :: Direct ( attr) => PassMode :: Direct ( opaque ( attr) ) ,
130
+ callconv :: PassMode :: Pair ( first, second) => {
133
131
PassMode :: Pair ( opaque ( first) , opaque ( second) )
134
132
}
135
- rustc_target :: abi :: call :: PassMode :: Cast { pad_i32, cast } => {
133
+ callconv :: PassMode :: Cast { pad_i32, cast } => {
136
134
PassMode :: Cast { pad_i32 : * pad_i32, cast : opaque ( cast) }
137
135
}
138
- rustc_target:: abi:: call:: PassMode :: Indirect { attrs, meta_attrs, on_stack } => {
139
- PassMode :: Indirect {
140
- attrs : opaque ( attrs) ,
141
- meta_attrs : opaque ( meta_attrs) ,
142
- on_stack : * on_stack,
143
- }
144
- }
136
+ callconv:: PassMode :: Indirect { attrs, meta_attrs, on_stack } => PassMode :: Indirect {
137
+ attrs : opaque ( attrs) ,
138
+ meta_attrs : opaque ( meta_attrs) ,
139
+ on_stack : * on_stack,
140
+ } ,
145
141
}
146
142
}
147
143
}
148
144
149
- impl < ' tcx > Stable < ' tcx > for rustc_abi:: FieldsShape < rustc_target :: abi :: FieldIdx > {
145
+ impl < ' tcx > Stable < ' tcx > for rustc_abi:: FieldsShape < rustc_abi :: FieldIdx > {
150
146
type T = FieldsShape ;
151
147
152
148
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
@@ -163,9 +159,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::FieldsShape<rustc_target::abi::FieldIdx>
163
159
}
164
160
}
165
161
166
- impl < ' tcx > Stable < ' tcx >
167
- for rustc_abi:: Variants < rustc_target:: abi:: FieldIdx , rustc_target:: abi:: VariantIdx >
168
- {
162
+ impl < ' tcx > Stable < ' tcx > for rustc_abi:: Variants < rustc_abi:: FieldIdx , rustc_abi:: VariantIdx > {
169
163
type T = VariantsShape ;
170
164
171
165
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
@@ -185,7 +179,7 @@ impl<'tcx> Stable<'tcx>
185
179
}
186
180
}
187
181
188
- impl < ' tcx > Stable < ' tcx > for rustc_abi:: TagEncoding < rustc_target :: abi :: VariantIdx > {
182
+ impl < ' tcx > Stable < ' tcx > for rustc_abi:: TagEncoding < rustc_abi :: VariantIdx > {
189
183
type T = TagEncoding ;
190
184
191
185
fn stable ( & self , tables : & mut Tables < ' _ > ) -> Self :: T {
0 commit comments