Auto merge of #100982 - fee1-dead-contrib:const-impl-requires-const-trait, r=oli-obk
Require `#[const_trait]` on `Trait` for `impl const Trait` r? `@oli-obk`
This commit is contained in:
commit
7a8636c843
80 changed files with 433 additions and 245 deletions
|
@ -428,12 +428,18 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
|||
}
|
||||
|
||||
if let ty::FnDef(def_id, substs) = *constant.literal.ty().kind() {
|
||||
// const_trait_impl: use a non-const param env when checking that a FnDef type is well formed.
|
||||
// this is because the well-formedness of the function does not need to be proved to have `const`
|
||||
// impls for trait bounds.
|
||||
let instantiated_predicates = tcx.predicates_of(def_id).instantiate(tcx, substs);
|
||||
let prev = self.cx.param_env;
|
||||
self.cx.param_env = prev.without_const();
|
||||
self.cx.normalize_and_prove_instantiated_predicates(
|
||||
def_id,
|
||||
instantiated_predicates,
|
||||
locations,
|
||||
);
|
||||
self.cx.param_env = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue