about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-05-24 16:15:04 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-06-01 13:31:12 -0400
commit4c599bc198fd882331cf4721536b2ca8fe2893d2 (patch)
tree30463b9601fa715b0f9c98010b995fd17a14e927
parentaf223fae27d2aa16743abadeb5635f8452a49894 (diff)
fix librustc_driver tests
-rw-r--r--src/librustc_driver/test.rs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs
index 1d236a96bf6..2b74d0a812b 100644
--- a/src/librustc_driver/test.rs
+++ b/src/librustc_driver/test.rs
@@ -46,6 +46,7 @@ use rustc::hir;
 struct Env<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     infcx: &'a infer::InferCtxt<'a, 'gcx, 'tcx>,
     region_maps: &'a mut RegionMaps,
+    param_env: ty::ParamEnv<'tcx>,
 }
 
 struct RH<'a> {
@@ -153,9 +154,13 @@ fn test_env<F>(source_string: &str,
                              index,
                              "test_crate",
                              |tcx| {
-        tcx.infer_ctxt((), Reveal::UserFacing).enter(|infcx| {
+        tcx.infer_ctxt(()).enter(|infcx| {
             let mut region_maps = RegionMaps::new();
-            body(Env { infcx: &infcx, region_maps: &mut region_maps });
+            body(Env {
+                infcx: &infcx,
+                region_maps: &mut region_maps,
+                param_env: ty::ParamEnv::empty(Reveal::UserFacing),
+            });
             let free_regions = FreeRegionMap::new();
             let def_id = tcx.hir.local_def_id(ast::CRATE_NODE_ID);
             infcx.resolve_regions_and_report_errors(def_id, &region_maps, &free_regions);
@@ -250,14 +255,14 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
     }
 
     pub fn make_subtype(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
-        match self.infcx.sub_types(true, &ObligationCause::dummy(), a, b) {
+        match self.infcx.at(&ObligationCause::dummy(), self.param_env).sub(a, b) {
             Ok(_) => true,
             Err(ref e) => panic!("Encountered error: {}", e),
         }
     }
 
     pub fn is_subtype(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
-        self.infcx.can_sub_types(a, b).is_ok()
+        self.infcx.can_sub(self.param_env, a, b).is_ok()
     }
 
     pub fn assert_subtype(&self, a: Ty<'tcx>, b: Ty<'tcx>) {
@@ -354,30 +359,23 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
                                   self.tcx().types.isize)
     }
 
-    pub fn dummy_type_trace(&self) -> infer::TypeTrace<'tcx> {
-        infer::TypeTrace::dummy(self.tcx())
-    }
-
-    pub fn sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
-        let trace = self.dummy_type_trace();
-        self.infcx.sub(true, trace, &t1, &t2)
+    pub fn sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, ()> {
+        self.infcx.at(&ObligationCause::dummy(), self.param_env).sub(t1, t2)
     }
 
     pub fn lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
-        let trace = self.dummy_type_trace();
-        self.infcx.lub(true, trace, &t1, &t2)
+        self.infcx.at(&ObligationCause::dummy(), self.param_env).lub(t1, t2)
     }
 
     pub fn glb(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
-        let trace = self.dummy_type_trace();
-        self.infcx.glb(true, trace, &t1, &t2)
+        self.infcx.at(&ObligationCause::dummy(), self.param_env).glb(t1, t2)
     }
 
     /// Checks that `t1 <: t2` is true (this may register additional
     /// region checks).
     pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
         match self.sub(t1, t2) {
-            Ok(InferOk { obligations, .. }) => {
+            Ok(InferOk { obligations, value: () }) => {
                 // None of these tests should require nested obligations:
                 assert!(obligations.is_empty());
             }