88//! For now, we are developing everything inside `rustc`, thus, we keep this module private.
99
1010use std:: marker:: PointeeSized ;
11- use std:: ops:: RangeInclusive ;
1211use std:: cell:: RefCell ;
1312use std:: fmt:: Debug ;
1413
@@ -18,8 +17,6 @@ use rustc_middle::mir;
1817use rustc_middle:: mir:: interpret:: AllocId ;
1918use rustc_middle:: ty:: { self , Instance , Ty , TyCtxt } ;
2019use rustc_span:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
21- use stable_mir:: { CtorKind , ItemKind } ;
22- use tracing:: debug;
2320
2421use crate :: rustc_internal:: IndexMap ;
2522use crate :: stable_mir;
@@ -154,51 +151,6 @@ where
154151 }
155152}
156153
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-
202154/// Trait used to convert between an internal MIR type to a Stable MIR type.
203155pub trait Stable < ' cx > : PointeeSized {
204156 /// The stable representation of the type implementing Stable.
0 commit comments