File tree 1 file changed +11
-4
lines changed
compiler/rustc_const_eval/src/transform/check_consts
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -830,10 +830,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
830
830
return ;
831
831
}
832
832
Ok ( Some ( ImplSource :: UserDefined ( data) ) ) => {
833
- if let hir:: Constness :: NotConst = tcx. impl_constness ( data. impl_def_id ) {
834
- self . check_op ( ops:: FnCallNonConst ( None ) ) ;
835
- return ;
836
- }
837
833
let callee_name = tcx. item_name ( callee) ;
838
834
if let Some ( & did) = tcx
839
835
. associated_item_def_ids ( data. impl_def_id )
@@ -845,6 +841,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
845
841
substs = InternalSubsts :: identity_for_item ( tcx, did) ;
846
842
callee = did;
847
843
}
844
+
845
+ if let hir:: Constness :: NotConst = tcx. impl_constness ( data. impl_def_id ) {
846
+ self . check_op ( ops:: FnCallNonConst {
847
+ caller,
848
+ callee,
849
+ substs,
850
+ span : * fn_span,
851
+ from_hir_call : * from_hir_call,
852
+ } ) ;
853
+ return ;
854
+ }
848
855
}
849
856
_ if !tcx. is_const_fn_raw ( callee) => {
850
857
// At this point, it is only legal when the caller is marked with
You can’t perform that action at this time.
0 commit comments