From 0a98cca2e60c5ac56f09c3bfe4dbadcbf622e3ed Mon Sep 17 00:00:00 2001 From: csmoe Date: Mon, 23 Sep 2019 15:47:26 +0000 Subject: [PATCH] replace Output type parameters with FactTypes --- polonius-engine/src/output/mod.rs | 35 ++++++++++--------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/polonius-engine/src/output/mod.rs b/polonius-engine/src/output/mod.rs index 2b919b3c08a..be118a36ccd 100644 --- a/polonius-engine/src/output/mod.rs +++ b/polonius-engine/src/output/mod.rs @@ -18,7 +18,7 @@ mod initialization; mod liveness; mod location_insensitive; mod naive; -use facts::{AllFacts, Atom}; +use facts::{AllFacts, Atom, FactTypes}; #[derive(Debug, Clone, Copy)] pub enum Algorithm { @@ -62,21 +62,14 @@ impl ::std::str::FromStr for Algorithm { } #[derive(Clone, Debug)] -pub struct Output -where - Region: Atom, - Region: Atom, - Loan: Atom, - Point: Atom, - Variable: Atom, - MovePath: Atom, +pub struct Output { - pub errors: FxHashMap>, + pub errors: FxHashMap>, pub dump_enabled: bool, // these are just for debugging - pub borrow_live_at: FxHashMap>, + pub borrow_live_at: FxHashMap>, pub restricts: FxHashMap>>, pub restricts_anywhere: FxHashMap>, pub region_live_at: FxHashMap>, @@ -125,16 +118,10 @@ fn compare_errors( differ } -impl Output -where - Region: Atom, - Loan: Atom, - Point: Atom, - Variable: Atom, - MovePath: Atom, +impl Output { pub fn compute( - all_facts: &AllFacts, + all_facts: &AllFacts, algorithm: Algorithm, dump_enabled: bool, ) -> Self { @@ -180,21 +167,21 @@ where } } - pub fn errors_at(&self, location: Point) -> &[Loan] { + pub fn errors_at(&self, location: T::Point) -> &[T::Loan] { match self.errors.get(&location) { Some(v) => v, None => &[], } } - pub fn borrows_in_scope_at(&self, location: Point) -> &[Loan] { + pub fn borrows_in_scope_at(&self, location: T::Point) -> &[T::Loan] { match self.borrow_live_at.get(&location) { Some(p) => p, None => &[], } } - pub fn restricts_at(&self, location: Point) -> Cow<'_, BTreeMap>> { + pub fn restricts_at(&self, location: T::Point) -> Cow<'_, BTreeMap>> { assert!(self.dump_enabled); match self.restricts.get(&location) { Some(map) => Cow::Borrowed(map), @@ -202,7 +189,7 @@ where } } - pub fn regions_live_at(&self, location: Point) -> &[Region] { + pub fn regions_live_at(&self, location: T::Point) -> &[T::Region] { assert!(self.dump_enabled); match self.region_live_at.get(&location) { Some(v) => v, @@ -210,7 +197,7 @@ where } } - pub fn subsets_at(&self, location: Point) -> Cow<'_, BTreeMap>> { + pub fn subsets_at(&self, location: T::Point) -> Cow<'_, BTreeMap>> { assert!(self.dump_enabled); match self.subset.get(&location) { Some(v) => Cow::Borrowed(v),