File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
compiler/rustc_const_eval/src/transform/check_consts Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -832,10 +832,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
832832 return ;
833833 }
834834 Ok ( Some ( ImplSource :: UserDefined ( data) ) ) => {
835- if let hir:: Constness :: NotConst = tcx. impl_constness ( data. impl_def_id ) {
836- self . check_op ( ops:: FnCallNonConst ( None ) ) ;
837- return ;
838- }
839835 let callee_name = tcx. item_name ( callee) ;
840836 if let Some ( & did) = tcx
841837 . associated_item_def_ids ( data. impl_def_id )
@@ -847,6 +843,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
847843 substs = InternalSubsts :: identity_for_item ( tcx, did) ;
848844 callee = did;
849845 }
846+
847+ if let hir:: Constness :: NotConst = tcx. impl_constness ( data. impl_def_id ) {
848+ self . check_op ( ops:: FnCallNonConst {
849+ caller,
850+ callee,
851+ substs,
852+ span : * fn_span,
853+ from_hir_call : * from_hir_call,
854+ } ) ;
855+ return ;
856+ }
850857 }
851858 _ if !tcx. is_const_fn_raw ( callee) => {
852859 // 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