We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ae5508 commit 7fd6ddfCopy full SHA for 7fd6ddf
compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -811,7 +811,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
811
param_env,
812
Binder::dummy(TraitPredicate {
813
trait_ref,
814
- constness: ty::BoundConstness::ConstIfConst,
+ constness: ty::BoundConstness::NotConst,
815
polarity: ty::ImplPolarity::Positive,
816
}),
817
);
@@ -830,6 +830,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
830
return;
831
}
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
let callee_name = tcx.item_name(callee);
838
if let Some(&did) = tcx
839
.associated_item_def_ids(data.impl_def_id)
0 commit comments