Add explicit_predicates_of to SMIR
This commit is contained in:
parent
55e5c9d705
commit
3678dbc382
@ -135,6 +135,23 @@ fn predicates_of(&mut self, def_id: stable_mir::DefId) -> stable_mir::ty::Generi
|
|||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn explicit_predicates_of(
|
||||||
|
&mut self,
|
||||||
|
def_id: stable_mir::DefId,
|
||||||
|
) -> stable_mir::ty::GenericPredicates {
|
||||||
|
let def_id = self[def_id];
|
||||||
|
let ty::GenericPredicates { parent, predicates } = self.tcx.explicit_predicates_of(def_id);
|
||||||
|
stable_mir::ty::GenericPredicates {
|
||||||
|
parent: parent.map(|did| self.trait_def(did)),
|
||||||
|
predicates: predicates
|
||||||
|
.iter()
|
||||||
|
.map(|(clause, span)| {
|
||||||
|
(clause.as_predicate().kind().skip_binder().stable(self), span.stable(self))
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -149,6 +149,7 @@ pub trait Context {
|
|||||||
fn trait_impl(&mut self, trait_impl: &ImplDef) -> ImplTrait;
|
fn trait_impl(&mut self, trait_impl: &ImplDef) -> ImplTrait;
|
||||||
fn generics_of(&mut self, def_id: DefId) -> Generics;
|
fn generics_of(&mut self, def_id: DefId) -> Generics;
|
||||||
fn predicates_of(&mut self, def_id: DefId) -> GenericPredicates;
|
fn predicates_of(&mut self, def_id: DefId) -> GenericPredicates;
|
||||||
|
fn explicit_predicates_of(&mut self, def_id: DefId) -> GenericPredicates;
|
||||||
/// Get information about the local crate.
|
/// Get information about the local crate.
|
||||||
fn local_crate(&self) -> Crate;
|
fn local_crate(&self) -> Crate;
|
||||||
/// Retrieve a list of all external crates.
|
/// Retrieve a list of all external crates.
|
||||||
|
@ -395,6 +395,10 @@ pub fn generics_of(&self) -> Generics {
|
|||||||
pub fn predicates_of(&self) -> GenericPredicates {
|
pub fn predicates_of(&self) -> GenericPredicates {
|
||||||
with(|cx| cx.predicates_of(self.def_id.0))
|
with(|cx| cx.predicates_of(self.def_id.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn explicit_predicates_of(&self) -> GenericPredicates {
|
||||||
|
with(|cx| cx.explicit_predicates_of(self.def_id.0))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type ImplTrait = EarlyBinder<TraitRef>;
|
pub type ImplTrait = EarlyBinder<TraitRef>;
|
||||||
|
Loading…
Reference in New Issue
Block a user