66
66
//! on traits with methods can.
67
67
68
68
use rustc_data_structures:: fx:: FxHashSet ;
69
- use rustc_hir as hir;
70
69
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
71
70
use rustc_infer:: infer:: TyCtxtInferExt ;
72
71
use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
@@ -134,7 +133,6 @@ fn check_always_applicable(
134
133
unconstrained_parent_impl_args ( tcx, impl2_def_id, impl2_args)
135
134
} ;
136
135
137
- res = res. and ( check_constness ( tcx, impl1_def_id, impl2_node, span) ) ;
138
136
res = res. and ( check_static_lifetimes ( tcx, & parent_args, span) ) ;
139
137
res = res. and ( check_duplicate_params ( tcx, impl1_args, parent_args, span) ) ;
140
138
res = res. and ( check_predicates ( tcx, impl1_def_id, impl1_args, impl2_node, impl2_args, span) ) ;
@@ -157,30 +155,6 @@ fn check_has_items(
157
155
Ok ( ( ) )
158
156
}
159
157
160
- /// Check that the specializing impl `impl1` is at least as const as the base
161
- /// impl `impl2`
162
- fn check_constness (
163
- tcx : TyCtxt < ' _ > ,
164
- impl1_def_id : LocalDefId ,
165
- impl2_node : Node ,
166
- span : Span ,
167
- ) -> Result < ( ) , ErrorGuaranteed > {
168
- if impl2_node. is_from_trait ( ) {
169
- // This isn't a specialization
170
- return Ok ( ( ) ) ;
171
- }
172
-
173
- let impl1_constness = tcx. constness ( impl1_def_id. to_def_id ( ) ) ;
174
- let impl2_constness = tcx. constness ( impl2_node. def_id ( ) ) ;
175
-
176
- if let hir:: Constness :: Const = impl2_constness {
177
- if let hir:: Constness :: NotConst = impl1_constness {
178
- return Err ( tcx. dcx ( ) . emit_err ( errors:: ConstSpecialize { span } ) ) ;
179
- }
180
- }
181
- Ok ( ( ) )
182
- }
183
-
184
158
/// Given a specializing impl `impl1`, and the base impl `impl2`, returns two
185
159
/// generic parameters `(S1, S2)` that equate their trait references.
186
160
/// The returned types are expressed in terms of the generics of `impl1`.
0 commit comments