@@ -69,7 +69,7 @@ fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
6969pub fn provide ( providers : & mut Providers ) {
7070 * providers = Providers {
7171 opt_const_param_of : type_of:: opt_const_param_of,
72- type_of : type_of:: type_of ,
72+ try_type_of : type_of:: try_type_of ,
7373 item_bounds : item_bounds:: item_bounds,
7474 explicit_item_bounds : item_bounds:: explicit_item_bounds,
7575 generics_of,
@@ -251,12 +251,12 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
251251 hir:: GenericParamKind :: Lifetime { .. } => { }
252252 hir:: GenericParamKind :: Type { default : Some ( _) , .. } => {
253253 let def_id = self . tcx . hir ( ) . local_def_id ( param. hir_id ) ;
254- self . tcx . ensure ( ) . type_of ( def_id) ;
254+ self . tcx . ensure ( ) . try_type_of ( def_id) ;
255255 }
256256 hir:: GenericParamKind :: Type { .. } => { }
257257 hir:: GenericParamKind :: Const { .. } => {
258258 let def_id = self . tcx . hir ( ) . local_def_id ( param. hir_id ) ;
259- self . tcx . ensure ( ) . type_of ( def_id) ;
259+ self . tcx . ensure ( ) . try_type_of ( def_id) ;
260260 // FIXME(const_generics_defaults)
261261 }
262262 }
@@ -268,7 +268,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
268268 if let hir:: ExprKind :: Closure ( ..) = expr. kind {
269269 let def_id = self . tcx . hir ( ) . local_def_id ( expr. hir_id ) ;
270270 self . tcx . ensure ( ) . generics_of ( def_id) ;
271- self . tcx . ensure ( ) . type_of ( def_id) ;
271+ self . tcx . ensure ( ) . try_type_of ( def_id) ;
272272 }
273273 intravisit:: walk_expr ( self , expr) ;
274274 }
@@ -727,7 +727,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
727727 for item in items {
728728 let item = tcx. hir ( ) . foreign_item ( item. id ) ;
729729 tcx. ensure ( ) . generics_of ( item. def_id ) ;
730- tcx. ensure ( ) . type_of ( item. def_id ) ;
730+ tcx. ensure ( ) . try_type_of ( item. def_id ) ;
731731 tcx. ensure ( ) . predicates_of ( item. def_id ) ;
732732 if let hir:: ForeignItemKind :: Fn ( ..) = item. kind {
733733 tcx. ensure ( ) . fn_sig ( item. def_id ) ;
@@ -736,13 +736,13 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
736736 }
737737 hir:: ItemKind :: Enum ( ref enum_definition, _) => {
738738 tcx. ensure ( ) . generics_of ( def_id) ;
739- tcx. ensure ( ) . type_of ( def_id) ;
739+ tcx. ensure ( ) . try_type_of ( def_id) ;
740740 tcx. ensure ( ) . predicates_of ( def_id) ;
741741 convert_enum_variant_types ( tcx, def_id. to_def_id ( ) , & enum_definition. variants ) ;
742742 }
743743 hir:: ItemKind :: Impl { .. } => {
744744 tcx. ensure ( ) . generics_of ( def_id) ;
745- tcx. ensure ( ) . type_of ( def_id) ;
745+ tcx. ensure ( ) . try_type_of ( def_id) ;
746746 tcx. ensure ( ) . impl_trait_ref ( def_id) ;
747747 tcx. ensure ( ) . predicates_of ( def_id) ;
748748 }
@@ -759,13 +759,13 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
759759 }
760760 hir:: ItemKind :: Struct ( ref struct_def, _) | hir:: ItemKind :: Union ( ref struct_def, _) => {
761761 tcx. ensure ( ) . generics_of ( def_id) ;
762- tcx. ensure ( ) . type_of ( def_id) ;
762+ tcx. ensure ( ) . try_type_of ( def_id) ;
763763 tcx. ensure ( ) . predicates_of ( def_id) ;
764764
765765 for f in struct_def. fields ( ) {
766766 let def_id = tcx. hir ( ) . local_def_id ( f. hir_id ) ;
767767 tcx. ensure ( ) . generics_of ( def_id) ;
768- tcx. ensure ( ) . type_of ( def_id) ;
768+ tcx. ensure ( ) . try_type_of ( def_id) ;
769769 tcx. ensure ( ) . predicates_of ( def_id) ;
770770 }
771771
@@ -790,7 +790,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
790790 | hir:: ItemKind :: Const ( ..)
791791 | hir:: ItemKind :: Fn ( ..) => {
792792 tcx. ensure ( ) . generics_of ( def_id) ;
793- tcx. ensure ( ) . type_of ( def_id) ;
793+ tcx. ensure ( ) . try_type_of ( def_id) ;
794794 tcx. ensure ( ) . predicates_of ( def_id) ;
795795 match it. kind {
796796 hir:: ItemKind :: Fn ( ..) => tcx. ensure ( ) . fn_sig ( def_id) ,
@@ -807,16 +807,16 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
807807
808808 match trait_item. kind {
809809 hir:: TraitItemKind :: Fn ( ..) => {
810- tcx. ensure ( ) . type_of ( trait_item_id. def_id ) ;
810+ tcx. ensure ( ) . try_type_of ( trait_item_id. def_id ) ;
811811 tcx. ensure ( ) . fn_sig ( trait_item_id. def_id ) ;
812812 }
813813
814814 hir:: TraitItemKind :: Const ( .., Some ( _) ) => {
815- tcx. ensure ( ) . type_of ( trait_item_id. def_id ) ;
815+ tcx. ensure ( ) . try_type_of ( trait_item_id. def_id ) ;
816816 }
817817
818818 hir:: TraitItemKind :: Const ( ..) => {
819- tcx. ensure ( ) . type_of ( trait_item_id. def_id ) ;
819+ tcx. ensure ( ) . try_type_of ( trait_item_id. def_id ) ;
820820 // Account for `const C: _;`.
821821 let mut visitor = PlaceholderHirTyCollector :: default ( ) ;
822822 visitor. visit_trait_item ( trait_item) ;
@@ -825,7 +825,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
825825
826826 hir:: TraitItemKind :: Type ( _, Some ( _) ) => {
827827 tcx. ensure ( ) . item_bounds ( trait_item_id. def_id ) ;
828- tcx. ensure ( ) . type_of ( trait_item_id. def_id ) ;
828+ tcx. ensure ( ) . try_type_of ( trait_item_id. def_id ) ;
829829 // Account for `type T = _;`.
830830 let mut visitor = PlaceholderHirTyCollector :: default ( ) ;
831831 visitor. visit_trait_item ( trait_item) ;
@@ -849,7 +849,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
849849fn convert_impl_item ( tcx : TyCtxt < ' _ > , impl_item_id : hir:: ImplItemId ) {
850850 let def_id = impl_item_id. def_id ;
851851 tcx. ensure ( ) . generics_of ( def_id) ;
852- tcx. ensure ( ) . type_of ( def_id) ;
852+ tcx. ensure ( ) . try_type_of ( def_id) ;
853853 tcx. ensure ( ) . predicates_of ( def_id) ;
854854 let impl_item = tcx. hir ( ) . impl_item ( impl_item_id) ;
855855 match impl_item. kind {
@@ -870,7 +870,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) {
870870fn convert_variant_ctor ( tcx : TyCtxt < ' _ > , ctor_id : hir:: HirId ) {
871871 let def_id = tcx. hir ( ) . local_def_id ( ctor_id) ;
872872 tcx. ensure ( ) . generics_of ( def_id) ;
873- tcx. ensure ( ) . type_of ( def_id) ;
873+ tcx. ensure ( ) . try_type_of ( def_id) ;
874874 tcx. ensure ( ) . predicates_of ( def_id) ;
875875}
876876
@@ -908,7 +908,7 @@ fn convert_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId, variants: &[hir::V
908908 for f in variant. data . fields ( ) {
909909 let def_id = tcx. hir ( ) . local_def_id ( f. hir_id ) ;
910910 tcx. ensure ( ) . generics_of ( def_id) ;
911- tcx. ensure ( ) . type_of ( def_id) ;
911+ tcx. ensure ( ) . try_type_of ( def_id) ;
912912 tcx. ensure ( ) . predicates_of ( def_id) ;
913913 }
914914
0 commit comments