about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2015-09-13 18:22:05 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2015-09-13 20:59:40 +0300
commit8478acf695ccd3bf4abe8c65f153dfbc99f3d28c (patch)
treed575d0e69148a2b00e087c73f9932ac9824d08b9 /src/librustc
parentcfd76b364cd01695517467299618ef63f1c0cc07 (diff)
sort the existential bounds list in tydecode
The sort key is a (DefId, Name), which is *not* stable between
runs, so we must re-sort when loading.

Fixes #24063
Fixes #25467
Fixes #27222
Fixes #28377
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/metadata/tydecode.rs5
-rw-r--r--src/librustc/middle/ty.rs15
2 files changed, 17 insertions, 3 deletions
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 0c802356af1..e58267f9291 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -680,9 +680,8 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> {
             }
         }
 
-        return ty::ExistentialBounds { region_bound: region_bound,
-                                       builtin_bounds: builtin_bounds,
-                                       projection_bounds: projection_bounds };
+        ty::ExistentialBounds::new(
+            region_bound, builtin_bounds, projection_bounds)
     }
 
     fn parse_builtin_bounds(&mut self) -> ty::BuiltinBounds {
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 483f2873166..0a330edb067 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -2137,6 +2137,21 @@ pub struct ExistentialBounds<'tcx> {
     pub projection_bounds: Vec<PolyProjectionPredicate<'tcx>>,
 }
 
+impl<'tcx> ExistentialBounds<'tcx> {
+    pub fn new(region_bound: ty::Region,
+               builtin_bounds: BuiltinBounds,
+               projection_bounds: Vec<PolyProjectionPredicate<'tcx>>)
+               -> Self {
+        let mut projection_bounds = projection_bounds;
+        ty::sort_bounds_list(&mut projection_bounds);
+        ExistentialBounds {
+            region_bound: region_bound,
+            builtin_bounds: builtin_bounds,
+            projection_bounds: projection_bounds
+        }
+    }
+}
+
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
 pub struct BuiltinBounds(EnumSet<BuiltinBound>);