Skip to content

Commit ca1fbc1

Browse files
committed
Adapt new change
1 parent ba8fb09 commit ca1fbc1

File tree

1 file changed

+11
-4
lines changed
  • compiler/rustc_const_eval/src/transform/check_consts

1 file changed

+11
-4
lines changed

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -830,10 +830,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
830830
return;
831831
}
832832
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-
}
837833
let callee_name = tcx.item_name(callee);
838834
if let Some(&did) = tcx
839835
.associated_item_def_ids(data.impl_def_id)
@@ -845,6 +841,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
845841
substs = InternalSubsts::identity_for_item(tcx, did);
846842
callee = did;
847843
}
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+
}
848855
}
849856
_ if !tcx.is_const_fn_raw(callee) => {
850857
// At this point, it is only legal when the caller is marked with

0 commit comments

Comments
 (0)