11//! Implementation of [`rustc_type_ir::Interner`] for [`TyCtxt`].
22
33use std:: fmt;
4+ use std:: ops:: Range ;
45
5- use rustc_abi:: ExternAbi ;
6+ use rustc_abi:: { ExternAbi , VariantIdx } ;
67use rustc_data_structures:: debug_assert_matches;
78use rustc_data_structures:: intern:: Interned ;
89use rustc_errors:: ErrorGuaranteed ;
@@ -22,8 +23,8 @@ use crate::traits::solve::{
2223 self , CanonicalInput , ExternalConstraints , ExternalConstraintsData , QueryResult , inspect,
2324} ;
2425use crate :: ty:: {
25- self , Clause , Const , List , ParamTy , Pattern , PolyExistentialPredicate , Predicate , Region , Ty ,
26- TyCtxt ,
26+ self , AdtDef , Clause , Const , List , ParamTy , Pattern , PolyExistentialPredicate , Predicate ,
27+ Region , Ty , TyCtxt , VariantDef ,
2728} ;
2829
2930#[ allow( rustc:: usage_of_ty_tykind) ]
@@ -41,11 +42,14 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
4142 type CoroutineClosureId = DefId ;
4243 type CoroutineId = DefId ;
4344 type AdtId = DefId ;
45+ type AdtDef = AdtDef ;
46+ type VariantDef = VariantDef ;
4447 type ImplId = DefId ;
4548 type UnevaluatedConstId = DefId ;
4649 type Span = Span ;
4750 type Interned < T : Copy + Clone + std:: fmt:: Debug + std:: hash:: Hash + Eq + PartialEq > =
4851 Interned < ' tcx , T > ;
52+ type VariantIdx = VariantIdx ;
4953
5054 type GenericArgs = ty:: GenericArgsRef < ' tcx > ;
5155
@@ -738,6 +742,23 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
738742 bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
739743 } )
740744 }
745+
746+ fn u8_type ( self ) -> Ty < ' tcx > {
747+ self . types . u8
748+ }
749+
750+ fn is_async_drop_in_place_coroutine ( self , def_id : DefId ) -> bool {
751+ self . is_lang_item ( self . parent ( def_id) , LangItem :: AsyncDropInPlace )
752+ }
753+
754+ #[ inline]
755+ fn coroutine_variant_range (
756+ self ,
757+ def_id : DefId ,
758+ coroutine_args : ty:: CoroutineArgs < Self > ,
759+ ) -> Range < VariantIdx > {
760+ self . coroutine_variant_range ( def_id, coroutine_args)
761+ }
741762}
742763
743764/// Defines trivial conversion functions between the main [`LangItem`] enum,
0 commit comments