8
8
//! For now, we are developing everything inside `rustc`, thus, we keep this module private.
9
9
10
10
use std:: marker:: PointeeSized ;
11
- use std:: ops:: RangeInclusive ;
12
11
use std:: cell:: RefCell ;
13
12
use std:: fmt:: Debug ;
14
13
@@ -18,8 +17,6 @@ use rustc_middle::mir;
18
17
use rustc_middle:: mir:: interpret:: AllocId ;
19
18
use rustc_middle:: ty:: { self , Instance , Ty , TyCtxt } ;
20
19
use rustc_span:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
21
- use stable_mir:: { CtorKind , ItemKind } ;
22
- use tracing:: debug;
23
20
24
21
use crate :: rustc_internal:: IndexMap ;
25
22
use crate :: stable_mir;
@@ -154,51 +151,6 @@ where
154
151
}
155
152
}
156
153
157
- /// Build a stable mir crate from a given crate number.
158
- pub ( crate ) fn smir_crate ( tcx : TyCtxt < ' _ > , crate_num : CrateNum ) -> stable_mir:: Crate {
159
- let crate_name = tcx. crate_name ( crate_num) . to_string ( ) ;
160
- let is_local = crate_num == LOCAL_CRATE ;
161
- debug ! ( ?crate_name, ?crate_num, "smir_crate" ) ;
162
- stable_mir:: Crate { id : crate_num. into ( ) , name : crate_name, is_local }
163
- }
164
-
165
- pub ( crate ) fn new_item_kind ( kind : DefKind ) -> ItemKind {
166
- match kind {
167
- DefKind :: Mod
168
- | DefKind :: Struct
169
- | DefKind :: Union
170
- | DefKind :: Enum
171
- | DefKind :: Variant
172
- | DefKind :: Trait
173
- | DefKind :: TyAlias
174
- | DefKind :: ForeignTy
175
- | DefKind :: TraitAlias
176
- | DefKind :: AssocTy
177
- | DefKind :: TyParam
178
- | DefKind :: ConstParam
179
- | DefKind :: Macro ( _)
180
- | DefKind :: ExternCrate
181
- | DefKind :: Use
182
- | DefKind :: ForeignMod
183
- | DefKind :: OpaqueTy
184
- | DefKind :: Field
185
- | DefKind :: LifetimeParam
186
- | DefKind :: Impl { .. }
187
- | DefKind :: GlobalAsm => {
188
- unreachable ! ( "Not a valid item kind: {kind:?}" ) ;
189
- }
190
- DefKind :: Closure | DefKind :: AssocFn | DefKind :: Fn | DefKind :: SyntheticCoroutineBody => {
191
- ItemKind :: Fn
192
- }
193
- DefKind :: Const | DefKind :: InlineConst | DefKind :: AssocConst | DefKind :: AnonConst => {
194
- ItemKind :: Const
195
- }
196
- DefKind :: Static { .. } => ItemKind :: Static ,
197
- DefKind :: Ctor ( _, rustc_hir:: def:: CtorKind :: Const ) => ItemKind :: Ctor ( CtorKind :: Const ) ,
198
- DefKind :: Ctor ( _, rustc_hir:: def:: CtorKind :: Fn ) => ItemKind :: Ctor ( CtorKind :: Fn ) ,
199
- }
200
- }
201
-
202
154
/// Trait used to convert between an internal MIR type to a Stable MIR type.
203
155
pub trait Stable < ' cx > : PointeeSized {
204
156
/// The stable representation of the type implementing Stable.
0 commit comments