Deduplicate GenericPredicates
This commit is contained in:
parent
17ffb59d39
commit
0c301e9d36
3 changed files with 5 additions and 11 deletions
|
|
@ -108,10 +108,10 @@ impl<'tcx> Context for Tables<'tcx> {
|
|||
generics.stable(self)
|
||||
}
|
||||
|
||||
fn predicates_of(&mut self, def_id: stable_mir::DefId) -> stable_mir::GenericPredicates {
|
||||
fn 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.predicates_of(def_id);
|
||||
stable_mir::GenericPredicates {
|
||||
stable_mir::ty::GenericPredicates {
|
||||
parent: parent.map(|did| self.trait_def(did)),
|
||||
predicates: predicates
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use std::cell::Cell;
|
|||
use crate::rustc_smir::Tables;
|
||||
|
||||
use self::ty::{
|
||||
Generics, ImplDef, ImplTrait, PredicateKind, Span, TraitDecl, TraitDef, Ty, TyKind,
|
||||
GenericPredicates, Generics, ImplDef, ImplTrait, Span, TraitDecl, TraitDef, Ty, TyKind,
|
||||
};
|
||||
|
||||
pub mod mir;
|
||||
|
|
@ -41,12 +41,6 @@ pub type TraitDecls = Vec<TraitDef>;
|
|||
/// A list of impl trait decls.
|
||||
pub type ImplTraitDecls = Vec<ImplDef>;
|
||||
|
||||
/// A list of predicates.
|
||||
pub struct GenericPredicates {
|
||||
pub parent: Option<TraitDef>,
|
||||
pub predicates: Vec<(PredicateKind, Span)>,
|
||||
}
|
||||
|
||||
/// Holds information about a crate.
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct Crate {
|
||||
|
|
|
|||
|
|
@ -499,8 +499,8 @@ pub struct GenericParamDef {
|
|||
}
|
||||
|
||||
pub struct GenericPredicates {
|
||||
pub parent: Option<DefId>,
|
||||
pub predicates: Vec<PredicateKind>,
|
||||
pub parent: Option<TraitDef>,
|
||||
pub predicates: Vec<(PredicateKind, Span)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue