@@ -410,6 +410,7 @@ impl<'tcx> Instance<'tcx> {
410410 let args = tcx. erase_regions ( args) ;
411411 tcx. resolve_instance ( tcx. erase_regions ( param_env. and ( ( def_id, args) ) ) )
412412 }
413+
413414 /// Behaves exactly like [`resolve`], but panics on error.
414415 pub fn expect_resolve (
415416 tcx : TyCtxt < ' tcx > ,
@@ -526,6 +527,7 @@ impl<'tcx> Instance<'tcx> {
526527 } )
527528 }
528529 }
530+
529531 /// Returns an instance representing closure of type `requested_kind` with `def_id` and subst set to `args`.
530532 pub fn resolve_closure (
531533 tcx : TyCtxt < ' tcx > ,
@@ -540,6 +542,7 @@ impl<'tcx> Instance<'tcx> {
540542 _ => Instance :: new ( def_id, args) ,
541543 }
542544 }
545+
543546 /// Returns an instance representing the function [`drop_in_place`] with its generic argument set to `ty`.
544547 pub fn resolve_drop_in_place ( tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > ) -> ty:: Instance < ' tcx > {
545548 let def_id = tcx. require_lang_item ( LangItem :: DropInPlace , None ) ;
@@ -573,6 +576,7 @@ impl<'tcx> Instance<'tcx> {
573576 debug ! ( ?self_ty, args=?tupled_inputs_ty. tuple_fields( ) ) ;
574577 Instance { def, args }
575578 }
579+
576580 pub fn try_resolve_item_for_coroutine (
577581 tcx : TyCtxt < ' tcx > ,
578582 trait_item_id : DefId ,
@@ -620,6 +624,7 @@ impl<'tcx> Instance<'tcx> {
620624 Some ( Instance :: new ( trait_item_id, rcvr_args) )
621625 }
622626 }
627+
623628 /// Depending on the kind of `InstanceDef`, the MIR body associated with an
624629 /// instance is expressed in terms of the generic parameters of `self.def_id()`, and in other
625630 /// cases the MIR body is expressed in terms of the types found in the substitution array.
@@ -633,6 +638,7 @@ impl<'tcx> Instance<'tcx> {
633638 fn args_for_mir_body ( & self ) -> Option < GenericArgsRef < ' tcx > > {
634639 self . def . has_polymorphic_mir_body ( ) . then_some ( self . args )
635640 }
641+
636642 /// Instantiates a generic value `v`(like `Vec<T>`), substituting its generic arguments and turning it into a concrete one(like `i32`, or `Vec<f32>`).
637643 /// If a value is not generic, this will do nothing.
638644 /// This function does not erase lifetimes, so a value like `&'a i32` will remain unchanged.
@@ -648,6 +654,7 @@ impl<'tcx> Instance<'tcx> {
648654 v. instantiate_identity ( )
649655 }
650656 }
657+
651658 /// Instantiates a generic value `v`(like `Vec<T>`), substituting its generic arguments and turning it into a concrete one(like `i32`, or `Vec<f32>`).
652659 /// This function erases lifetimes, so a value like `&'a i32` will become `&ReErased i32`.
653660 /// If a value is not generic and has no lifetime info, this will do nothing.
@@ -669,6 +676,7 @@ impl<'tcx> Instance<'tcx> {
669676 tcx. normalize_erasing_regions ( param_env, v. skip_binder ( ) )
670677 }
671678 }
679+
672680 /// A version of [`instantiate_mir_and_normalize_erasing_regions`] which will returns a [`NormalizationError`] on normalization failure instead of panicking.
673681 #[ inline( always) ]
674682 pub fn try_instantiate_mir_and_normalize_erasing_regions < T > (
@@ -847,30 +855,37 @@ impl UnusedGenericParams {
847855 bitset. set_range ( 0 ..amount) ;
848856 Self ( bitset)
849857 }
858+
850859 /// Creates a new [`UnusedGenericParams`] where all generic pameters are set as used.
851860 pub fn new_all_used ( ) -> Self {
852861 Self ( FiniteBitSet :: new_empty ( ) )
853862 }
863+
854864 /// Marks a generic paramenter at index `idx` as used.
855865 pub fn mark_used ( & mut self , idx : u32 ) {
856866 self . 0 . clear ( idx) ;
857867 }
868+
858869 /// Returns true if generic paramenter at index `idx` unused, and false otherwise.
859870 pub fn is_unused ( & self , idx : u32 ) -> bool {
860871 self . 0 . contains ( idx) . unwrap_or ( false )
861872 }
873+
862874 /// Returns true if generic paramenter at index `idx` used, and false otherwise.
863875 pub fn is_used ( & self , idx : u32 ) -> bool {
864876 !self . is_unused ( idx)
865877 }
878+
866879 /// Returns true if all generic parameters are used, and false otherwise.
867880 pub fn all_used ( & self ) -> bool {
868881 self . 0 . is_empty ( )
869882 }
883+
870884 /// Turns a [`UnusedGenericParams`] into its underlying bit representation.
871885 pub fn bits ( & self ) -> u32 {
872886 self . 0 . 0
873887 }
888+
874889 /// Creates a [`UnusedGenericParams`] from its bit representation.
875890 pub fn from_bits ( bits : u32 ) -> UnusedGenericParams {
876891 UnusedGenericParams ( FiniteBitSet ( bits) )
0 commit comments