summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2016-10-19 11:22:49 -0700
committerGitHub <noreply@github.com>2016-10-19 11:22:49 -0700
commitd4f39402a0c2c2b94ec0375cd7f7f6d7918113cd (patch)
tree0a3f7ab1668706d533e6692e8ce853c2aec4609a /src/librustc
parent3191fbae9da539442351f883bdabcad0d72efcb6 (diff)
parent2d493421cacc42d04e7626259cc08a51ef6c24cb (diff)
downloadrust-1.12.1.tar.gz
rust-1.12.1.zip
Merge pull request #37173 from brson/stable-next 1.12.1
[stable] Backports for 1.12.1
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/ty/flags.rs5
-rw-r--r--src/librustc/ty/fold.rs2
-rw-r--r--src/librustc/ty/item_path.rs2
-rw-r--r--src/librustc/ty/mod.rs4
4 files changed, 11 insertions, 2 deletions
diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs
index 0997d6c1a75..a428c99119a 100644
--- a/src/librustc/ty/flags.rs
+++ b/src/librustc/ty/flags.rs
@@ -107,6 +107,11 @@ impl FlagComputation {
             }
 
             &ty::TyProjection(ref data) => {
+                // currently we can't normalize projections that
+                // include bound regions, so track those separately.
+                if !data.has_escaping_regions() {
+                    self.add_flags(TypeFlags::HAS_NORMALIZABLE_PROJECTION);
+                }
                 self.add_flags(TypeFlags::HAS_PROJECTION);
                 self.add_projection_ty(data);
             }
diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs
index 3eeff6ee579..a8826f0b23b 100644
--- a/src/librustc/ty/fold.rs
+++ b/src/librustc/ty/fold.rs
@@ -105,7 +105,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
                              TypeFlags::HAS_FREE_REGIONS |
                              TypeFlags::HAS_TY_INFER |
                              TypeFlags::HAS_PARAMS |
-                             TypeFlags::HAS_PROJECTION |
+                             TypeFlags::HAS_NORMALIZABLE_PROJECTION |
                              TypeFlags::HAS_TY_ERR |
                              TypeFlags::HAS_SELF)
     }
diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs
index 8ddd8bef36a..5e4e7b342d6 100644
--- a/src/librustc/ty/item_path.rs
+++ b/src/librustc/ty/item_path.rs
@@ -305,7 +305,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
     /// Returns the def-id of `def_id`'s parent in the def tree. If
     /// this returns `None`, then `def_id` represents a crate root or
     /// inlined root.
-    fn parent_def_id(&self, def_id: DefId) -> Option<DefId> {
+    pub fn parent_def_id(&self, def_id: DefId) -> Option<DefId> {
         let key = self.def_key(def_id);
         key.parent.map(|index| DefId { krate: def_id.krate, index: index })
     }
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index cfc2e89f9d5..02be1573bf1 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -527,6 +527,10 @@ bitflags! {
         // Only set for TyInfer other than Fresh.
         const KEEP_IN_LOCAL_TCX  = 1 << 11,
 
+        // Is there a projection that does not involve a bound region?
+        // Currently we can't normalize projections w/ bound regions.
+        const HAS_NORMALIZABLE_PROJECTION = 1 << 12,
+
         const NEEDS_SUBST        = TypeFlags::HAS_PARAMS.bits |
                                    TypeFlags::HAS_SELF.bits |
                                    TypeFlags::HAS_RE_EARLY_BOUND.bits,