@@ -1017,34 +1017,25 @@ impl<'tcx> ty::TyS<'tcx> {
1017
1017
}
1018
1018
1019
1019
fn is_copy_raw < ' tcx > ( tcx : TyCtxt < ' tcx > , query : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> bool {
1020
- let ( param_env, ty) = query. into_parts ( ) ;
1021
- let trait_def_id = tcx. require_lang_item ( lang_items:: CopyTraitLangItem , None ) ;
1022
- tcx. infer_ctxt ( )
1023
- . enter ( |infcx| traits:: type_known_to_meet_bound_modulo_regions (
1024
- & infcx,
1025
- param_env,
1026
- ty,
1027
- trait_def_id,
1028
- DUMMY_SP ,
1029
- ) )
1020
+ is_item_raw ( tcx, query, lang_items:: CopyTraitLangItem )
1030
1021
}
1031
1022
1032
1023
fn is_sized_raw < ' tcx > ( tcx : TyCtxt < ' tcx > , query : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> bool {
1033
- let ( param_env, ty) = query. into_parts ( ) ;
1034
- let trait_def_id = tcx. require_lang_item ( lang_items:: SizedTraitLangItem , None ) ;
1035
- tcx. infer_ctxt ( )
1036
- . enter ( |infcx| traits:: type_known_to_meet_bound_modulo_regions (
1037
- & infcx,
1038
- param_env,
1039
- ty,
1040
- trait_def_id,
1041
- DUMMY_SP ,
1042
- ) )
1024
+ is_item_raw ( tcx, query, lang_items:: SizedTraitLangItem )
1025
+
1043
1026
}
1044
1027
1045
1028
fn is_freeze_raw < ' tcx > ( tcx : TyCtxt < ' tcx > , query : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> bool {
1029
+ is_item_raw ( tcx, query, lang_items:: FreezeTraitLangItem )
1030
+ }
1031
+
1032
+ fn is_item_raw < ' tcx > (
1033
+ tcx : TyCtxt < ' tcx > ,
1034
+ query : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ,
1035
+ item : LangItem
1036
+ ) -> bool {
1046
1037
let ( param_env, ty) = query. into_parts ( ) ;
1047
- let trait_def_id = tcx. require_lang_item ( lang_items :: FreezeTraitLangItem , None ) ;
1038
+ let trait_def_id = tcx. require_lang_item ( item , None ) ;
1048
1039
tcx. infer_ctxt ( )
1049
1040
. enter ( |infcx| traits:: type_known_to_meet_bound_modulo_regions (
1050
1041
& infcx,
0 commit comments