Error when selected impl is not const in constck
This commit is contained in:
parent
7ae5508426
commit
7fd6ddfba2
1 changed files with 5 additions and 1 deletions
|
@ -811,7 +811,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
|||
param_env,
|
||||
Binder::dummy(TraitPredicate {
|
||||
trait_ref,
|
||||
constness: ty::BoundConstness::ConstIfConst,
|
||||
constness: ty::BoundConstness::NotConst,
|
||||
polarity: ty::ImplPolarity::Positive,
|
||||
}),
|
||||
);
|
||||
|
@ -830,6 +830,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
|||
return;
|
||||
}
|
||||
Ok(Some(ImplSource::UserDefined(data))) => {
|
||||
if let hir::Constness::NotConst = tcx.impl_constness(data.impl_def_id) {
|
||||
self.check_op(ops::FnCallNonConst(None));
|
||||
return;
|
||||
}
|
||||
let callee_name = tcx.item_name(callee);
|
||||
if let Some(&did) = tcx
|
||||
.associated_item_def_ids(data.impl_def_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue