11//! Check properties that are required by built-in traits and set
22//! up data structures required by type-checking/codegen.
33
4- use std:: assert_matches:: assert_matches;
54use std:: collections:: BTreeMap ;
65
76use rustc_data_structures:: fx:: FxHashSet ;
@@ -40,10 +39,7 @@ pub(super) fn check_trait<'tcx>(
4039 checker. check ( lang_items. async_drop_trait ( ) , visit_implementation_of_drop) ?;
4140 checker. check ( lang_items. copy_trait ( ) , visit_implementation_of_copy) ?;
4241 checker. check ( lang_items. const_param_ty_trait ( ) , |checker| {
43- visit_implementation_of_const_param_ty ( checker, LangItem :: ConstParamTy )
44- } ) ?;
45- checker. check ( lang_items. unsized_const_param_ty_trait ( ) , |checker| {
46- visit_implementation_of_const_param_ty ( checker, LangItem :: UnsizedConstParamTy )
42+ visit_implementation_of_const_param_ty ( checker)
4743 } ) ?;
4844 checker. check ( lang_items. coerce_unsized_trait ( ) , visit_implementation_of_coerce_unsized) ?;
4945 checker
@@ -138,12 +134,7 @@ fn visit_implementation_of_copy(checker: &Checker<'_>) -> Result<(), ErrorGuaran
138134 }
139135}
140136
141- fn visit_implementation_of_const_param_ty (
142- checker : & Checker < ' _ > ,
143- kind : LangItem ,
144- ) -> Result < ( ) , ErrorGuaranteed > {
145- assert_matches ! ( kind, LangItem :: ConstParamTy | LangItem :: UnsizedConstParamTy ) ;
146-
137+ fn visit_implementation_of_const_param_ty ( checker : & Checker < ' _ > ) -> Result < ( ) , ErrorGuaranteed > {
147138 let tcx = checker. tcx ;
148139 let header = checker. impl_header ;
149140 let impl_did = checker. impl_def_id ;
@@ -157,7 +148,7 @@ fn visit_implementation_of_const_param_ty(
157148 }
158149
159150 let cause = traits:: ObligationCause :: misc ( DUMMY_SP , impl_did) ;
160- match type_allowed_to_implement_const_param_ty ( tcx, param_env, self_type, kind , cause) {
151+ match type_allowed_to_implement_const_param_ty ( tcx, param_env, self_type, cause) {
161152 Ok ( ( ) ) => Ok ( ( ) ) ,
162153 Err ( ConstParamTyImplementationError :: InfrigingFields ( fields) ) => {
163154 let span = tcx. hir_expect_item ( impl_did) . expect_impl ( ) . self_ty . span ;
0 commit comments