about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-07-14 19:36:15 -0400
committerNiko Matsakis <niko@alum.mit.edu>2015-07-14 19:36:15 -0400
commitde6b3c282e2e400ce114b5553c3f7080a1434a5f (patch)
treee4d6c344ad0de96ea216ffc91afc3a0b9b5fc0be
parent5708b1a18a39b3730f9a1af905b049f1b3600da7 (diff)
downloadrust-de6b3c282e2e400ce114b5553c3f7080a1434a5f.tar.gz
rust-de6b3c282e2e400ce114b5553c3f7080a1434a5f.zip
Transition to the new object lifetime defaults, replacing the old
defaults completely.
-rw-r--r--src/librustc/metadata/tydecode.rs9
-rw-r--r--src/librustc/metadata/tyencode.rs2
-rw-r--r--src/librustc/middle/infer/bivariate.rs5
-rw-r--r--src/librustc/middle/infer/equate.rs5
-rw-r--r--src/librustc/middle/infer/error_reporting.rs6
-rw-r--r--src/librustc/middle/infer/glb.rs10
-rw-r--r--src/librustc/middle/infer/lub.rs5
-rw-r--r--src/librustc/middle/infer/mod.rs4
-rw-r--r--src/librustc/middle/infer/region_inference/mod.rs47
-rw-r--r--src/librustc/middle/infer/sub.rs18
-rw-r--r--src/librustc/middle/traits/select.rs1
-rw-r--r--src/librustc/middle/ty.rs5
-rw-r--r--src/librustc/middle/ty_fold.rs1
-rw-r--r--src/librustc/middle/ty_match.rs5
-rw-r--r--src/librustc/middle/ty_relate/mod.rs17
-rw-r--r--src/librustc/util/ppaux.rs4
-rw-r--r--src/librustc_trans/trans/common.rs10
-rw-r--r--src/librustc_typeck/astconv.rs12
-rw-r--r--src/librustc_typeck/rscope.rs47
-rw-r--r--src/test/compile-fail/lifetime-bound-will-change-warning.rs10
-rw-r--r--src/test/compile-fail/object-lifetime-default-ambiguous.rs5
-rw-r--r--src/test/compile-fail/object-lifetime-default-elision.rs6
-rw-r--r--src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs31
-rw-r--r--src/test/compile-fail/object-lifetime-default-from-rptr-struct-error.rs37
-rw-r--r--src/test/compile-fail/object-lifetime-default-mybox.rs5
-rw-r--r--src/test/run-pass/lang-item-public.rs22
-rw-r--r--src/test/run-pass/object-lifetime-default-from-rptr-box.rs4
-rw-r--r--src/test/run-pass/object-lifetime-default-from-rptr-struct.rs4
28 files changed, 97 insertions, 240 deletions
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 57157560f1f..ee9e199a6c5 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -887,16 +887,9 @@ fn parse_existential_bounds_<'a,'tcx, F>(st: &mut PState<'a,'tcx>,
         }
     }
 
-    let region_bound_will_change = match next(st) {
-        'y' => true,
-        'n' => false,
-        c => panic!("parse_ty: expected y/n not '{}'", c)
-    };
-
     return ty::ExistentialBounds { region_bound: region_bound,
                                    builtin_bounds: builtin_bounds,
-                                   projection_bounds: projection_bounds,
-                                   region_bound_will_change: region_bound_will_change };
+                                   projection_bounds: projection_bounds };
 }
 
 fn parse_builtin_bounds<F>(st: &mut PState, mut _conv: F) -> ty::BuiltinBounds where
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index a932ada61f1..e29c0f2b837 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -390,8 +390,6 @@ pub fn enc_existential_bounds<'a,'tcx>(w: &mut Encoder,
     }
 
     mywrite!(w, ".");
-
-    mywrite!(w, "{}", if bs.region_bound_will_change {'y'} else {'n'});
 }
 
 pub fn enc_region_bounds<'a, 'tcx>(w: &mut Encoder,
diff --git a/src/librustc/middle/infer/bivariate.rs b/src/librustc/middle/infer/bivariate.rs
index ad53fb4a8a2..d2268894b20 100644
--- a/src/librustc/middle/infer/bivariate.rs
+++ b/src/librustc/middle/infer/bivariate.rs
@@ -49,11 +49,6 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Bivariate<'a, 'tcx> {
 
     fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
 
-    fn will_change(&mut self, _: bool, _: bool) -> bool {
-        // since we are not comparing regions, we don't care
-        false
-    }
-
     fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
                                                variance: ty::Variance,
                                                a: &T,
diff --git a/src/librustc/middle/infer/equate.rs b/src/librustc/middle/infer/equate.rs
index c0dcda1792b..cbbf73d9420 100644
--- a/src/librustc/middle/infer/equate.rs
+++ b/src/librustc/middle/infer/equate.rs
@@ -34,11 +34,6 @@ impl<'a, 'tcx> TypeRelation<'a,'tcx> for Equate<'a, 'tcx> {
 
     fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
 
-    fn will_change(&mut self, a: bool, b: bool) -> bool {
-        // if either side changed from what it was, that could cause equality to fail
-        a || b
-    }
-
     fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
                                                _: ty::Variance,
                                                a: &T,
diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs
index 1ad7df9cd3a..8d66ffac5d1 100644
--- a/src/librustc/middle/infer/error_reporting.rs
+++ b/src/librustc/middle/infer/error_reporting.rs
@@ -593,8 +593,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
                                sub: Region,
                                sup: Region) {
         match origin {
-            infer::Subtype(trace) |
-            infer::DefaultExistentialBound(trace) => {
+            infer::Subtype(trace) => {
                 let terr = TypeError::RegionsDoesNotOutlive(sup, sub);
                 self.report_and_explain_type_error(trace, &terr);
             }
@@ -1570,8 +1569,7 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
 
     fn note_region_origin(&self, origin: &SubregionOrigin<'tcx>) {
         match *origin {
-            infer::Subtype(ref trace) |
-            infer::DefaultExistentialBound(ref trace) => {
+            infer::Subtype(ref trace) => {
                 let desc = match trace.origin {
                     infer::Misc(_) => {
                         "types are compatible"
diff --git a/src/librustc/middle/infer/glb.rs b/src/librustc/middle/infer/glb.rs
index adfd1a8a7d7..d6b03266b1f 100644
--- a/src/librustc/middle/infer/glb.rs
+++ b/src/librustc/middle/infer/glb.rs
@@ -35,16 +35,6 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Glb<'a, 'tcx> {
 
     fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
 
-    fn will_change(&mut self, a: bool, b: bool) -> bool {
-        // Hmm, so the result of GLB will still be a LB if one or both
-        // sides change to 'static, but it may no longer be the GLB.
-        // I'm going to go with `a || b` here to be conservative,
-        // since the result of this operation may be affected, though
-        // I think it would mostly be more accepting than before (since the result
-        // would be a bigger region).
-        a || b
-    }
-
     fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
                                                variance: ty::Variance,
                                                a: &T,
diff --git a/src/librustc/middle/infer/lub.rs b/src/librustc/middle/infer/lub.rs
index f10d4adc8e5..9d993ead5ca 100644
--- a/src/librustc/middle/infer/lub.rs
+++ b/src/librustc/middle/infer/lub.rs
@@ -35,11 +35,6 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Lub<'a, 'tcx> {
 
     fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
 
-    fn will_change(&mut self, a: bool, b: bool) -> bool {
-        // result will be 'static if a || b
-        a || b
-    }
-
     fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
                                                variance: ty::Variance,
                                                a: &T,
diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs
index 0495209f0d0..a293170966a 100644
--- a/src/librustc/middle/infer/mod.rs
+++ b/src/librustc/middle/infer/mod.rs
@@ -191,9 +191,6 @@ pub enum SubregionOrigin<'tcx> {
     // Arose from a subtyping relation
     Subtype(TypeTrace<'tcx>),
 
-    // Arose from a subtyping relation
-    DefaultExistentialBound(TypeTrace<'tcx>),
-
     // Stack-allocated closures cannot outlive innermost loop
     // or function so as to ensure we only require finite stack
     InfStackClosure(Span),
@@ -1466,7 +1463,6 @@ impl<'tcx> SubregionOrigin<'tcx> {
     pub fn span(&self) -> Span {
         match *self {
             Subtype(ref a) => a.span(),
-            DefaultExistentialBound(ref a) => a.span(),
             InfStackClosure(a) => a,
             InvokeClosure(a) => a,
             DerefPointer(a) => a,
diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs
index cbd195eee4a..4528abfb929 100644
--- a/src/librustc/middle/infer/region_inference/mod.rs
+++ b/src/librustc/middle/infer/region_inference/mod.rs
@@ -1357,56 +1357,9 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
             }
         }
 
-        // Check for future hostile edges tied to a bad default
-        self.report_future_hostility(&graph);
-
         (0..self.num_vars() as usize).map(|idx| var_data[idx].value).collect()
     }
 
-    fn report_future_hostility(&self, graph: &RegionGraph) {
-        let constraints = self.constraints.borrow();
-        for edge in graph.all_edges() {
-            match constraints[&edge.data] {
-                SubregionOrigin::DefaultExistentialBound(_) => {
-                    // this will become 'static in the future
-                }
-                _ => { continue; }
-            }
-
-            // this constraint will become a 'static constraint in the
-            // future, so walk outward and see if we have any hard
-            // bounds that could not be inferred to 'static
-            for nid in graph.depth_traverse(edge.target()) {
-                for (_, succ) in graph.outgoing_edges(nid) {
-                    match succ.data {
-                        ConstrainVarSubReg(_, r) => {
-                            match r {
-                                ty::ReStatic | ty::ReInfer(_) => {
-                                    /* OK */
-                                }
-                                ty::ReFree(_) | ty::ReScope(_) | ty::ReEmpty => {
-                                    span_warn!(
-                                        self.tcx.sess,
-                                        constraints[&edge.data].span(),
-                                        E0398,
-                                        "this code may fail to compile in Rust 1.3 due to \
-                                         the proposed change in object lifetime bound defaults");
-                                    return; // only issue the warning once per fn
-                                }
-                                ty::ReEarlyBound(..) | ty::ReLateBound(..) => {
-                                    self.tcx.sess.span_bug(
-                                        constraints[&succ.data].span(),
-                                        "relation to bound region");
-                                }
-                            }
-                        }
-                        _ => { }
-                    }
-                }
-            }
-        }
-    }
-
     fn construct_graph(&self) -> RegionGraph {
         let num_vars = self.num_vars();
 
diff --git a/src/librustc/middle/infer/sub.rs b/src/librustc/middle/infer/sub.rs
index 7c40e96a2f7..4d76d613392 100644
--- a/src/librustc/middle/infer/sub.rs
+++ b/src/librustc/middle/infer/sub.rs
@@ -45,14 +45,6 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Sub<'a, 'tcx> {
         r
     }
 
-    fn will_change(&mut self, a: bool, b: bool) -> bool {
-        // if we have (Foo+'a) <: (Foo+'b), this requires that 'a:'b.
-        // So if 'a becomes 'static, no additional errors can occur.
-        // OTOH, if 'a stays the same, but 'b becomes 'static, we
-        // could have a problem.
-        !a && b
-    }
-
     fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
                                                variance: ty::Variance,
                                                a: &T,
@@ -106,12 +98,10 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Sub<'a, 'tcx> {
     fn regions(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> {
         debug!("{}.regions({:?}, {:?}) self.cause={:?}",
                self.tag(), a, b, self.fields.cause);
-        let origin = match self.fields.cause {
-            Some(Cause::ExistentialRegionBound(true)) =>
-                SubregionOrigin::DefaultExistentialBound(self.fields.trace.clone()),
-            _ =>
-                SubregionOrigin::Subtype(self.fields.trace.clone()),
-        };
+        // FIXME -- we have more fine-grained information available
+        // from the "cause" field, we could perhaps give more tailored
+        // error messages.
+        let origin = SubregionOrigin::Subtype(self.fields.trace.clone());
         self.fields.infcx.region_vars.make_subregion(origin, a, b);
         Ok(a)
     }
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index e8a2e29b590..81e59f57ae7 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -2462,7 +2462,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                     region_bound: data_b.bounds.region_bound,
                     builtin_bounds: data_b.bounds.builtin_bounds,
                     projection_bounds: data_a.bounds.projection_bounds.clone(),
-                    region_bound_will_change: data_b.bounds.region_bound_will_change,
                 };
 
                 let new_trait = tcx.mk_trait(data_a.principal.clone(), bounds);
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 5200ed1eb5b..ef337b41630 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -1989,11 +1989,6 @@ pub struct ExistentialBounds<'tcx> {
     pub region_bound: ty::Region,
     pub builtin_bounds: BuiltinBounds,
     pub projection_bounds: Vec<PolyProjectionPredicate<'tcx>>,
-
-    // If true, this TyTrait used a "default bound" in the surface
-    // syntax.  This makes no difference to the type system but is
-    // handy for error reporting.
-    pub region_bound_will_change: bool,
 }
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs
index 3cf5e6ffa03..eae2bb49664 100644
--- a/src/librustc/middle/ty_fold.rs
+++ b/src/librustc/middle/ty_fold.rs
@@ -700,7 +700,6 @@ pub fn super_fold_existential_bounds<'tcx, T: TypeFolder<'tcx>>(
         region_bound: bounds.region_bound.fold_with(this),
         builtin_bounds: bounds.builtin_bounds,
         projection_bounds: bounds.projection_bounds.fold_with(this),
-        region_bound_will_change: bounds.region_bound_will_change,
     }
 }
 
diff --git a/src/librustc/middle/ty_match.rs b/src/librustc/middle/ty_match.rs
index 56b90e198a5..4aa0e553a7a 100644
--- a/src/librustc/middle/ty_match.rs
+++ b/src/librustc/middle/ty_match.rs
@@ -42,11 +42,6 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Match<'a, 'tcx> {
     fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.tcx }
     fn a_is_expected(&self) -> bool { true } // irrelevant
 
-    fn will_change(&mut self, _: bool, _: bool) -> bool {
-        // we're ignoring regions in this code
-        false
-    }
-
     fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
                                                _: ty::Variance,
                                                a: &T,
diff --git a/src/librustc/middle/ty_relate/mod.rs b/src/librustc/middle/ty_relate/mod.rs
index 3a4bb102146..0159801d5be 100644
--- a/src/librustc/middle/ty_relate/mod.rs
+++ b/src/librustc/middle/ty_relate/mod.rs
@@ -24,7 +24,7 @@ pub type RelateResult<'tcx, T> = Result<T, ty::TypeError<'tcx>>;
 
 #[derive(Clone, Debug)]
 pub enum Cause {
-    ExistentialRegionBound(bool), // if true, this is a default, else explicit
+    ExistentialRegionBound, // relating an existential region bound
 }
 
 pub trait TypeRelation<'a,'tcx> : Sized {
@@ -43,13 +43,6 @@ pub trait TypeRelation<'a,'tcx> : Sized {
         f(self)
     }
 
-    /// Hack for deciding whether the lifetime bound defaults change
-    /// will be a breaking change or not. The bools indicate whether
-    /// `a`/`b` have a default that will change to `'static`; the
-    /// result is true if this will potentially affect the affect of
-    /// relating `a` and `b`.
-    fn will_change(&mut self, a: bool, b: bool) -> bool;
-
     /// Generic relation routine suitable for most anything.
     fn relate<T:Relate<'a,'tcx>>(&mut self, a: &T, b: &T) -> RelateResult<'tcx, T> {
         Relate::relate(self, a, b)
@@ -384,12 +377,9 @@ impl<'a,'tcx:'a> Relate<'a,'tcx> for ty::ExistentialBounds<'tcx> {
                  -> RelateResult<'tcx, ty::ExistentialBounds<'tcx>>
         where R: TypeRelation<'a,'tcx>
     {
-        let will_change = relation.will_change(a.region_bound_will_change,
-                                               b.region_bound_will_change);
-
         let r =
             try!(relation.with_cause(
-                Cause::ExistentialRegionBound(will_change),
+                Cause::ExistentialRegionBound,
                 |relation| relation.relate_with_variance(ty::Contravariant,
                                                          &a.region_bound,
                                                          &b.region_bound)));
@@ -397,8 +387,7 @@ impl<'a,'tcx:'a> Relate<'a,'tcx> for ty::ExistentialBounds<'tcx> {
         let pb = try!(relation.relate(&a.projection_bounds, &b.projection_bounds));
         Ok(ty::ExistentialBounds { region_bound: r,
                                    builtin_bounds: nb,
-                                   projection_bounds: pb,
-                                   region_bound_will_change: will_change })
+                                   projection_bounds: pb })
     }
 }
 
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 4d60500ecf6..b0510a76385 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -300,10 +300,6 @@ impl<'tcx> fmt::Display for ty::TraitTy<'tcx> {
             try!(write!(f, " + {}", bound));
         }
 
-        if bounds.region_bound_will_change && verbose() {
-            try!(write!(f, " [WILL-CHANGE]"));
-        }
-
         Ok(())
     }
 }
diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs
index 2f5f5345e64..d7d3be699cb 100644
--- a/src/librustc_trans/trans/common.rs
+++ b/src/librustc_trans/trans/common.rs
@@ -82,16 +82,6 @@ pub fn erase_regions<'tcx,T>(cx: &ty::ctxt<'tcx>, value: &T) -> T
             return t_norm;
         }
 
-        fn fold_existential_bounds(&mut self, s: &ty::ExistentialBounds<'tcx>)
-                                   -> ty::ExistentialBounds<'tcx> {
-            let mut s = ty_fold::super_fold_existential_bounds(self, s);
-
-            // this annoying flag messes up trans normalization
-            s.region_bound_will_change = false;
-
-            s
-        }
-
         fn fold_binder<T>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T>
             where T : TypeFoldable<'tcx>
         {
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index a57fc60e923..3bb3a630041 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -2040,23 +2040,22 @@ pub fn conv_existential_bounds_from_partitioned_bounds<'tcx>(
                                       principal_trait_ref,
                                       builtin_bounds);
 
-    let (region_bound, will_change) = match region_bound {
-        Some(r) => (r, false),
+    let region_bound = match region_bound {
+        Some(r) => r,
         None => {
             match rscope.object_lifetime_default(span) {
-                Some(r) => (r, rscope.object_lifetime_default_will_change_in_1_3()),
+                Some(r) => r,
                 None => {
                     span_err!(this.tcx().sess, span, E0228,
                               "the lifetime bound for this object type cannot be deduced \
                                from context; please supply an explicit bound");
-                    (ty::ReStatic, false)
+                    ty::ReStatic
                 }
             }
         }
     };
 
-    debug!("region_bound: {:?} will_change: {:?}",
-           region_bound, will_change);
+    debug!("region_bound: {:?}", region_bound);
 
     ty::sort_bounds_list(&mut projection_bounds);
 
@@ -2064,7 +2063,6 @@ pub fn conv_existential_bounds_from_partitioned_bounds<'tcx>(
         region_bound: region_bound,
         builtin_bounds: builtin_bounds,
         projection_bounds: projection_bounds,
-        region_bound_will_change: will_change,
     }
 }
 
diff --git a/src/librustc_typeck/rscope.rs b/src/librustc_typeck/rscope.rs
index 1b33f588e92..28403ab2282 100644
--- a/src/librustc_typeck/rscope.rs
+++ b/src/librustc_typeck/rscope.rs
@@ -51,19 +51,6 @@ pub trait RegionScope {
     /// computing `object_lifetime_default` (in particular, in legacy
     /// modes, it may not be relevant).
     fn base_object_lifetime_default(&self, span: Span) -> ty::Region;
-
-    /// Used to issue warnings in Rust 1.2, not needed after that.
-    /// True if the result of `object_lifetime_default` will change in 1.3.
-    fn object_lifetime_default_will_change_in_1_3(&self) -> bool {
-        false
-    }
-
-    /// Used to issue warnings in Rust 1.2, not needed after that.
-    /// True if the result of `base_object_lifetime_default` differs
-    /// from the result of `object_lifetime_default`.
-    fn base_object_lifetime_default_differs(&self) -> bool {
-        false
-    }
 }
 
 // A scope in which all regions must be explicitly named. This is used
@@ -216,11 +203,8 @@ impl<'r> RegionScope for ObjectLifetimeDefaultRscope<'r> {
                 None,
 
             ty::ObjectLifetimeDefault::BaseDefault =>
-                if false { // this will become the behavior in Rust 1.3
-                    Some(self.base_object_lifetime_default(span))
-                } else {
-                    self.base_scope.object_lifetime_default(span)
-                },
+                // NB: This behavior changed in Rust 1.3.
+                Some(self.base_object_lifetime_default(span)),
 
             ty::ObjectLifetimeDefault::Specific(r) =>
                 Some(r),
@@ -228,36 +212,9 @@ impl<'r> RegionScope for ObjectLifetimeDefaultRscope<'r> {
     }
 
     fn base_object_lifetime_default(&self, span: Span) -> ty::Region {
-        assert!(false, "this code should not execute until Rust 1.3");
         self.base_scope.base_object_lifetime_default(span)
     }
 
-    fn object_lifetime_default_will_change_in_1_3(&self) -> bool {
-        debug!("object_lifetime_default_will_change_in_1_3: {:?}", self.default);
-
-        match self.default {
-            ty::ObjectLifetimeDefault::Ambiguous |
-            ty::ObjectLifetimeDefault::Specific(_) =>
-                false,
-
-            ty::ObjectLifetimeDefault::BaseDefault =>
-                self.base_scope.base_object_lifetime_default_differs()
-        }
-    }
-
-    fn base_object_lifetime_default_differs(&self) -> bool {
-        debug!("base_object_lifetime_default_differs: {:?}", self.default);
-
-        match self.default {
-            ty::ObjectLifetimeDefault::Ambiguous |
-            ty::ObjectLifetimeDefault::Specific(_) =>
-                true,
-
-            ty::ObjectLifetimeDefault::BaseDefault =>
-                self.base_scope.base_object_lifetime_default_differs(),
-        }
-    }
-
     fn anon_regions(&self,
                     span: Span,
                     count: usize)
diff --git a/src/test/compile-fail/lifetime-bound-will-change-warning.rs b/src/test/compile-fail/lifetime-bound-will-change-warning.rs
index 4b575703e7c..7e9a4f82478 100644
--- a/src/test/compile-fail/lifetime-bound-will-change-warning.rs
+++ b/src/test/compile-fail/lifetime-bound-will-change-warning.rs
@@ -10,8 +10,8 @@
 
 // aux-build:lifetime_bound_will_change_warning_lib.rs
 
-// Test that we get suitable warnings when lifetime bound change will
-// cause breakage.
+// Test that various corner cases cause an error. These are tests
+// that used to pass before we tweaked object defaults.
 
 #![allow(dead_code)]
 #![allow(unused_variables)]
@@ -41,12 +41,12 @@ fn test1cc<'a>(x: &'a Box<Fn()+'a>) {
 
 fn test2<'a>(x: &'a Box<Fn()+'a>) {
     // but ref_obj will not, so warn.
-    ref_obj(x) //~ WARNING this code may fail to compile in Rust 1.3
+    ref_obj(x) //~ ERROR mismatched types
 }
 
 fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
     // same as test2, but cross crate
-    lib::ref_obj(x) //~ WARNING this code may fail to compile in Rust 1.3
+    lib::ref_obj(x) //~ ERROR mismatched types
 }
 
 fn test3<'a>(x: &'a Box<Fn()+'static>) {
@@ -60,5 +60,5 @@ fn test3cc<'a>(x: &'a Box<Fn()+'static>) {
 }
 
 #[rustc_error]
-fn main() { //~ ERROR compilation successful
+fn main() {
 }
diff --git a/src/test/compile-fail/object-lifetime-default-ambiguous.rs b/src/test/compile-fail/object-lifetime-default-ambiguous.rs
index 322283a4ca9..3df83d91999 100644
--- a/src/test/compile-fail/object-lifetime-default-ambiguous.rs
+++ b/src/test/compile-fail/object-lifetime-default-ambiguous.rs
@@ -47,10 +47,7 @@ fn d(t: Ref2<Ref1<Test>>) {
 }
 
 fn e(t: Ref2<Ref0<Test>>) {
-    //~^ ERROR lifetime bound for this object type cannot be deduced from context
-    //
-    // In this case, Ref2 is ambiguous, and Ref0 inherits the
-    // ambiguity.
+    // In this case, Ref2 is ambiguous, but Ref0 overrides with 'static.
 }
 
 fn f(t: &Ref2<Test>) {
diff --git a/src/test/compile-fail/object-lifetime-default-elision.rs b/src/test/compile-fail/object-lifetime-default-elision.rs
index 75ee0bdc9c7..fb75b9aa1dd 100644
--- a/src/test/compile-fail/object-lifetime-default-elision.rs
+++ b/src/test/compile-fail/object-lifetime-default-elision.rs
@@ -34,13 +34,11 @@ fn load0<'a>(ss: &'a Box<SomeTrait>) -> Box<SomeTrait> {
     //
     // Under new rules the result is:
     //
-    // for<'a> fn(&'a Box<SomeTrait+'a>) -> Box<SomeTrait+'static>
+    // for<'a> fn(&'a Box<SomeTrait+'static>) -> Box<SomeTrait+'static>
     //
-    // Therefore, we get a type error attempting to return `deref(ss)`
-    // since `SomeTrait+'a <: SomeTrait+'static` does not hold.
+    // Therefore, no type error.
 
     deref(ss)
-        //~^ ERROR cannot infer
 }
 
 fn load1(ss: &SomeTrait) -> &SomeTrait {
diff --git a/src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs b/src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs
new file mode 100644
index 00000000000..e351c84c8af
--- /dev/null
+++ b/src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs
@@ -0,0 +1,31 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that the lifetime from the enclosing `&` is "inherited"
+// through the `Box` struct.
+
+// pretty-expanded FIXME #23616
+
+#![allow(dead_code)]
+
+trait Test {
+    fn foo(&self) { }
+}
+
+struct SomeStruct<'a> {
+    t: &'a Box<Test>,
+}
+
+fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
+    ss.t = t; //~ ERROR mismatched types
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/object-lifetime-default-from-rptr-struct-error.rs b/src/test/compile-fail/object-lifetime-default-from-rptr-struct-error.rs
new file mode 100644
index 00000000000..93268559e8e
--- /dev/null
+++ b/src/test/compile-fail/object-lifetime-default-from-rptr-struct-error.rs
@@ -0,0 +1,37 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that the lifetime from the enclosing `&` is "inherited"
+// through the `MyBox` struct.
+
+// pretty-expanded FIXME #23616
+
+#![allow(dead_code)]
+#![feature(rustc_error)]
+
+trait Test {
+    fn foo(&self) { }
+}
+
+struct SomeStruct<'a> {
+    t: &'a MyBox<Test>,
+    u: &'a MyBox<Test+'a>,
+}
+
+struct MyBox<T:?Sized> {
+    b: Box<T>
+}
+
+fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
+    ss.t = t; //~ ERROR mismatched types
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/object-lifetime-default-mybox.rs b/src/test/compile-fail/object-lifetime-default-mybox.rs
index b5c4e0c767b..80dbee3c481 100644
--- a/src/test/compile-fail/object-lifetime-default-mybox.rs
+++ b/src/test/compile-fail/object-lifetime-default-mybox.rs
@@ -27,7 +27,7 @@ fn deref<T>(ss: &T) -> T {
 }
 
 fn load0(ss: &MyBox<SomeTrait>) -> MyBox<SomeTrait> {
-    deref(ss) //~ ERROR cannot infer
+    deref(ss)
 }
 
 fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
@@ -36,11 +36,10 @@ fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
 {
     a
       //~^ ERROR cannot infer
-      //~| ERROR mismatched types
 }
 
 fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> {
-    load0(ss) //~ WARNING E0398
+    load0(ss) //~ ERROR mismatched types
 }
 
 fn main() {
diff --git a/src/test/run-pass/lang-item-public.rs b/src/test/run-pass/lang-item-public.rs
deleted file mode 100644
index 57a32ba599f..00000000000
--- a/src/test/run-pass/lang-item-public.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:lang-item-public.rs
-// ignore-android
-
-#![feature(start, no_std)]
-#![no_std]
-
-extern crate lang_item_public as lang_lib;
-
-#[start]
-fn main(_: isize, _: *const *const u8) -> isize {
-    1_isize % 1_isize
-}
diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs
index e2047ee3256..af8018b7653 100644
--- a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs
+++ b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs
@@ -32,9 +32,7 @@ fn b<'a>(t: &'a Box<Test>, mut ss: SomeStruct<'a>) {
     ss.u = t;
 }
 
-fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
-    ss.t = t;
-}
+// see also compile-fail/object-lifetime-default-from-rptr-box-error.rs
 
 fn d<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
     ss.u = t;
diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs b/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs
index 3c2419e420d..fcff5fd6f17 100644
--- a/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs
+++ b/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs
@@ -36,9 +36,7 @@ fn b<'a>(t: &'a MyBox<Test>, mut ss: SomeStruct<'a>) {
     ss.u = t;
 }
 
-fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
-    ss.t = t;
-}
+// see also compile-fail/object-lifetime-default-from-rptr-box-error.rs
 
 fn d<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
     ss.u = t;