eliminate the Lrc of a slice and just return the slice
Also, introduce `Clauses` and `Goals` type alises for readability.
This commit is contained in:
parent
294cae22ee
commit
7fa3c8f445
4 changed files with 32 additions and 34 deletions
|
|
@ -282,7 +282,7 @@ pub enum QuantifierKind {
|
|||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum Goal<'tcx> {
|
||||
Implies(&'tcx Slice<Clause<'tcx>>, &'tcx Goal<'tcx>),
|
||||
Implies(Clauses<'tcx>, &'tcx Goal<'tcx>),
|
||||
And(&'tcx Goal<'tcx>, &'tcx Goal<'tcx>),
|
||||
Not(&'tcx Goal<'tcx>),
|
||||
DomainGoal(DomainGoal<'tcx>),
|
||||
|
|
@ -290,6 +290,8 @@ pub enum Goal<'tcx> {
|
|||
CannotProve,
|
||||
}
|
||||
|
||||
pub type Goals<'tcx> = &'tcx Slice<Goal<'tcx>>;
|
||||
|
||||
impl<'tcx> Goal<'tcx> {
|
||||
pub fn from_poly_domain_goal<'a>(
|
||||
domain_goal: PolyDomainGoal<'tcx>,
|
||||
|
|
@ -319,6 +321,9 @@ pub enum Clause<'tcx> {
|
|||
ForAll(ty::Binder<ProgramClause<'tcx>>),
|
||||
}
|
||||
|
||||
/// Multiple clauses.
|
||||
pub type Clauses<'tcx> = &'tcx Slice<Clause<'tcx>>;
|
||||
|
||||
/// A "program clause" has the form `D :- G1, ..., Gn`. It is saying
|
||||
/// that the domain goal `D` is true if `G1...Gn` are provable. This
|
||||
/// is equivalent to the implication `G1..Gn => D`; we usually write
|
||||
|
|
@ -331,7 +336,7 @@ pub struct ProgramClause<'tcx> {
|
|||
pub goal: DomainGoal<'tcx>,
|
||||
|
||||
/// ...if we can prove these hypotheses (there may be no hypotheses at all):
|
||||
pub hypotheses: &'tcx Slice<Goal<'tcx>>,
|
||||
pub hypotheses: Goals<'tcx>,
|
||||
}
|
||||
|
||||
pub type Selection<'tcx> = Vtable<'tcx, PredicateObligation<'tcx>>;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ use ty::subst::{Kind, Substs};
|
|||
use ty::ReprOptions;
|
||||
use ty::Instance;
|
||||
use traits;
|
||||
use traits::{Clause, Goal};
|
||||
use traits::{Clause, Clauses, Goal, Goals};
|
||||
use ty::{self, Ty, TypeAndMut};
|
||||
use ty::{TyS, TypeVariants, Slice};
|
||||
use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorInterior, Region, Const};
|
||||
|
|
@ -2517,7 +2517,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn intern_clauses(self, ts: &[Clause<'tcx>]) -> &'tcx Slice<Clause<'tcx>> {
|
||||
pub fn intern_clauses(self, ts: &[Clause<'tcx>]) -> Clauses<'tcx> {
|
||||
if ts.len() == 0 {
|
||||
Slice::empty()
|
||||
} else {
|
||||
|
|
@ -2525,7 +2525,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn intern_goals(self, ts: &[Goal<'tcx>]) -> &'tcx Slice<Goal<'tcx>> {
|
||||
pub fn intern_goals(self, ts: &[Goal<'tcx>]) -> Goals<'tcx> {
|
||||
if ts.len() == 0 {
|
||||
Slice::empty()
|
||||
} else {
|
||||
|
|
@ -2579,13 +2579,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
self.mk_substs(iter::once(s).chain(t.into_iter().cloned()).map(Kind::from))
|
||||
}
|
||||
|
||||
pub fn mk_clauses<I: InternAs<[Clause<'tcx>],
|
||||
&'tcx Slice<Clause<'tcx>>>>(self, iter: I) -> I::Output {
|
||||
pub fn mk_clauses<I: InternAs<[Clause<'tcx>], Clauses<'tcx>>>(self, iter: I) -> I::Output {
|
||||
iter.intern_with(|xs| self.intern_clauses(xs))
|
||||
}
|
||||
|
||||
pub fn mk_goals<I: InternAs<[Goal<'tcx>],
|
||||
&'tcx Slice<Goal<'tcx>>>>(self, iter: I) -> I::Output {
|
||||
pub fn mk_goals<I: InternAs<[Goal<'tcx>], Goals<'tcx>>>(self, iter: I) -> I::Output {
|
||||
iter.intern_with(|xs| self.intern_goals(xs))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ use traits::query::{CanonicalProjectionGoal, CanonicalTyGoal, NoSolution};
|
|||
use traits::query::dropck_outlives::{DtorckConstraint, DropckOutlivesResult};
|
||||
use traits::query::normalize::NormalizationResult;
|
||||
use traits::specialization_graph;
|
||||
use traits::Clause;
|
||||
use ty::{self, CrateInherentImpls, ParamEnvAnd, Slice, Ty, TyCtxt};
|
||||
use traits::Clauses;
|
||||
use ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
|
||||
use ty::steal::Steal;
|
||||
use ty::subst::Substs;
|
||||
use util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
|
||||
|
|
@ -445,11 +445,11 @@ define_maps! { <'tcx>
|
|||
|
||||
[] fn features_query: features_node(CrateNum) -> Lrc<feature_gate::Features>,
|
||||
|
||||
[] fn program_clauses_for: ProgramClausesFor(DefId) -> Lrc<&'tcx Slice<Clause<'tcx>>>,
|
||||
[] fn program_clauses_for: ProgramClausesFor(DefId) -> Clauses<'tcx>,
|
||||
|
||||
[] fn program_clauses_for_env: ProgramClausesForEnv(
|
||||
ty::ParamEnv<'tcx>
|
||||
) -> Lrc<&'tcx Slice<Clause<'tcx>>>,
|
||||
) -> Clauses<'tcx>,
|
||||
|
||||
[] fn wasm_custom_sections: WasmCustomSections(CrateNum) -> Lrc<Vec<DefId>>,
|
||||
[] fn wasm_import_module_map: WasmImportModuleMap(CrateNum)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue