The param_env of an existential type is its function's param_env
This commit is contained in:
parent
d4ea2c43f5
commit
ad9ede4d64
1 changed files with 6 additions and 0 deletions
|
|
@ -2857,6 +2857,12 @@ fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option
|
|||
fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> ParamEnv<'tcx> {
|
||||
|
||||
// The param_env of an existential type is its parent's param_env
|
||||
if let Some(Def::Existential(_)) = tcx.describe_def(def_id) {
|
||||
let parent = tcx.parent_def_id(def_id).expect("impl trait item w/o a parent");
|
||||
return param_env(tcx, parent);
|
||||
}
|
||||
// Compute the bounds on Self and the type parameters.
|
||||
|
||||
let bounds = tcx.predicates_of(def_id).instantiate_identity(tcx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue