about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2020-02-10 20:39:11 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2020-03-14 14:14:51 +0100
commit796ca64e9ad95a8cba0f2ab8d252fb4c5b5fb9b4 (patch)
tree3629334feaf937a716e0a776072430802cf77066
parent98444ca53e8a589cd681fb2788fc37c4859d399c (diff)
downloadrust-796ca64e9ad95a8cba0f2ab8d252fb4c5b5fb9b4.tar.gz
rust-796ca64e9ad95a8cba0f2ab8d252fb4c5b5fb9b4.zip
Move traits::query::outlives_bounds::explicit_outlives_bounds to infer::outlives.
-rw-r--r--src/librustc_infer/infer/outlives/env.rs6
-rw-r--r--src/librustc_infer/infer/outlives/mod.rs22
-rw-r--r--src/librustc_infer/traits/query/outlives_bounds.rs19
-rw-r--r--src/librustc_mir/borrow_check/type_check/free_region_relations.rs5
4 files changed, 29 insertions, 23 deletions
diff --git a/src/librustc_infer/infer/outlives/env.rs b/src/librustc_infer/infer/outlives/env.rs
index aac6c7640ca..714108f88ec 100644
--- a/src/librustc_infer/infer/outlives/env.rs
+++ b/src/librustc_infer/infer/outlives/env.rs
@@ -1,11 +1,13 @@
 use crate::infer::{GenericKind, InferCtxt};
-use crate::traits::query::outlives_bounds::{self, OutlivesBound};
+use crate::traits::query::OutlivesBound;
 use rustc::ty::free_region_map::FreeRegionMap;
 use rustc::ty::{self, Ty};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_hir as hir;
 use rustc_span::Span;
 
+use super::explicit_outlives_bounds;
+
 /// The `OutlivesEnvironment` collects information about what outlives
 /// what in a given type-checking setting. For example, if we have a
 /// where-clause like `where T: 'a` in scope, then the
@@ -76,7 +78,7 @@ impl<'a, 'tcx> OutlivesEnvironment<'tcx> {
             region_bound_pairs_accum: vec![],
         };
 
-        env.add_outlives_bounds(None, outlives_bounds::explicit_outlives_bounds(param_env));
+        env.add_outlives_bounds(None, explicit_outlives_bounds(param_env));
 
         env
     }
diff --git a/src/librustc_infer/infer/outlives/mod.rs b/src/librustc_infer/infer/outlives/mod.rs
index 6fc72470c9f..75cf742de31 100644
--- a/src/librustc_infer/infer/outlives/mod.rs
+++ b/src/librustc_infer/infer/outlives/mod.rs
@@ -3,3 +3,25 @@
 pub mod env;
 pub mod obligations;
 pub mod verify;
+
+use rustc::traits::query::OutlivesBound;
+use rustc::ty;
+
+pub fn explicit_outlives_bounds<'tcx>(
+    param_env: ty::ParamEnv<'tcx>,
+) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
+    debug!("explicit_outlives_bounds()");
+    param_env.caller_bounds.into_iter().filter_map(move |predicate| match predicate {
+        ty::Predicate::Projection(..)
+        | ty::Predicate::Trait(..)
+        | ty::Predicate::Subtype(..)
+        | ty::Predicate::WellFormed(..)
+        | ty::Predicate::ObjectSafe(..)
+        | ty::Predicate::ClosureKind(..)
+        | ty::Predicate::TypeOutlives(..)
+        | ty::Predicate::ConstEvaluatable(..) => None,
+        ty::Predicate::RegionOutlives(ref data) => data
+            .no_bound_vars()
+            .map(|ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a)),
+    })
+}
diff --git a/src/librustc_infer/traits/query/outlives_bounds.rs b/src/librustc_infer/traits/query/outlives_bounds.rs
index eb32ebf5c4d..9ce17bcec27 100644
--- a/src/librustc_infer/traits/query/outlives_bounds.rs
+++ b/src/librustc_infer/traits/query/outlives_bounds.rs
@@ -82,22 +82,3 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
         result.value
     }
 }
-
-pub fn explicit_outlives_bounds<'tcx>(
-    param_env: ty::ParamEnv<'tcx>,
-) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
-    debug!("explicit_outlives_bounds()");
-    param_env.caller_bounds.into_iter().filter_map(move |predicate| match predicate {
-        ty::Predicate::Projection(..)
-        | ty::Predicate::Trait(..)
-        | ty::Predicate::Subtype(..)
-        | ty::Predicate::WellFormed(..)
-        | ty::Predicate::ObjectSafe(..)
-        | ty::Predicate::ClosureKind(..)
-        | ty::Predicate::TypeOutlives(..)
-        | ty::Predicate::ConstEvaluatable(..) => None,
-        ty::Predicate::RegionOutlives(ref data) => data
-            .no_bound_vars()
-            .map(|ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a)),
-    })
-}
diff --git a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
index 137216531a3..283d78062f3 100644
--- a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
+++ b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
@@ -1,11 +1,12 @@
 use rustc::mir::ConstraintCategory;
+use rustc::traits::query::OutlivesBound;
 use rustc::ty::free_region_map::FreeRegionRelations;
 use rustc::ty::{self, RegionVid, Ty, TyCtxt};
 use rustc_data_structures::transitive_relation::TransitiveRelation;
 use rustc_infer::infer::canonical::QueryRegionConstraints;
+use rustc_infer::infer::outlives;
 use rustc_infer::infer::region_constraints::GenericKind;
 use rustc_infer::infer::InferCtxt;
-use rustc_infer::traits::query::outlives_bounds::{self, OutlivesBound};
 use rustc_infer::traits::query::type_op::{self, TypeOp};
 use rustc_span::DUMMY_SP;
 use std::rc::Rc;
@@ -266,7 +267,7 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
 
         // Insert the facts we know from the predicates. Why? Why not.
         let param_env = self.param_env;
-        self.add_outlives_bounds(outlives_bounds::explicit_outlives_bounds(param_env));
+        self.add_outlives_bounds(outlives::explicit_outlives_bounds(param_env));
 
         // Finally:
         // - outlives is reflexive, so `'r: 'r` for every region `'r`