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,7 +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 )
42+ visit_implementation_of_const_param_ty ( checker)
4443 } ) ?;
4544 checker. check ( lang_items. coerce_unsized_trait ( ) , visit_implementation_of_coerce_unsized) ?;
4645 checker
@@ -135,12 +134,7 @@ fn visit_implementation_of_copy(checker: &Checker<'_>) -> Result<(), ErrorGuaran
135134 }
136135}
137136
138- fn visit_implementation_of_const_param_ty (
139- checker : & Checker < ' _ > ,
140- kind : LangItem ,
141- ) -> Result < ( ) , ErrorGuaranteed > {
142- assert_matches ! ( kind, LangItem :: ConstParamTy ) ;
143-
137+ fn visit_implementation_of_const_param_ty ( checker : & Checker < ' _ > ) -> Result < ( ) , ErrorGuaranteed > {
144138 let tcx = checker. tcx ;
145139 let header = checker. impl_header ;
146140 let impl_did = checker. impl_def_id ;
@@ -154,7 +148,7 @@ fn visit_implementation_of_const_param_ty(
154148 }
155149
156150 let cause = traits:: ObligationCause :: misc ( DUMMY_SP , impl_did) ;
157- 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) {
158152 Ok ( ( ) ) => Ok ( ( ) ) ,
159153 Err ( ConstParamTyImplementationError :: InfrigingFields ( fields) ) => {
160154 let span = tcx. hir_expect_item ( impl_did) . expect_impl ( ) . self_ty . span ;
0 commit comments