about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-04-07 18:12:40 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-04-07 18:12:40 +0530
commitdaf2e365cfecabcc5c62b09b5098fa95e614e98c (patch)
treee642bd437bc5202f2469a02f18ed16a85b457031
parent4faf0befaa3b2d214c60d2dcd7458a88892ff0d4 (diff)
parent49f2a566663b125334245563f4dbe51778296feb (diff)
downloadrust-daf2e365cfecabcc5c62b09b5098fa95e614e98c.tar.gz
rust-daf2e365cfecabcc5c62b09b5098fa95e614e98c.zip
Rollup merge of #24057 - nikomatsakis:lifetime-shadowing-hard-error, r=huon
-rw-r--r--src/librustc/middle/resolve_lifetime.rs6
-rw-r--r--src/test/compile-fail/shadowed-lifetime.rs11
-rw-r--r--src/test/run-pass/overloaded-index-assoc-list.rs2
3 files changed, 4 insertions, 15 deletions
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index a3d71c989bf..1036c97a5ad 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -507,7 +507,7 @@ impl<'a> LifetimeContext<'a> {
                 EarlyScope(_, lifetimes, s) |
                 LateScope(lifetimes, s) => {
                     if let Some((_, lifetime_def)) = search_lifetimes(lifetimes, lifetime) {
-                        self.sess.span_warn(
+                        self.sess.span_err(
                             lifetime.span,
                             &format!("lifetime name `{}` shadows another \
                                      lifetime name that is already in scope",
@@ -516,10 +516,6 @@ impl<'a> LifetimeContext<'a> {
                             lifetime_def.span,
                             &format!("shadowed lifetime `{}` declared here",
                                      token::get_name(lifetime.name)));
-                        self.sess.span_note(
-                            lifetime.span,
-                            "shadowed lifetimes are deprecated \
-                             and will become a hard error before 1.0");
                         return;
                     }
 
diff --git a/src/test/compile-fail/shadowed-lifetime.rs b/src/test/compile-fail/shadowed-lifetime.rs
index 725f83d4957..110b1a0d90c 100644
--- a/src/test/compile-fail/shadowed-lifetime.rs
+++ b/src/test/compile-fail/shadowed-lifetime.rs
@@ -15,16 +15,14 @@ struct Foo<'a>(&'a isize);
 impl<'a> Foo<'a> {
     //~^ NOTE shadowed lifetime `'a` declared here
     fn shadow_in_method<'a>(&'a self) -> &'a isize {
-        //~^ WARNING lifetime name `'a` shadows another lifetime name that is already in scope
-        //~| NOTE deprecated
+        //~^ ERROR lifetime name `'a` shadows another lifetime name that is already in scope
         self.0
     }
 
     fn shadow_in_type<'b>(&'b self) -> &'b isize {
         //~^ NOTE shadowed lifetime `'b` declared here
         let x: for<'b> fn(&'b isize) = panic!();
-        //~^ WARNING lifetime name `'b` shadows another lifetime name that is already in scope
-        //~| NOTE deprecated
+        //~^ ERROR lifetime name `'b` shadows another lifetime name that is already in scope
         self.0
     }
 
@@ -35,9 +33,4 @@ impl<'a> Foo<'a> {
 }
 
 fn main() {
-    // intentional error that occurs after `resolve_lifetime` runs,
-    // just to ensure that this test fails to compile; when shadowed
-    // lifetimes become either an error or a proper lint, this will
-    // not be needed.
-    let x: isize = 3_usize; //~ ERROR mismatched types
 }
diff --git a/src/test/run-pass/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded-index-assoc-list.rs
index 131098d7c94..d98b1d9deae 100644
--- a/src/test/run-pass/overloaded-index-assoc-list.rs
+++ b/src/test/run-pass/overloaded-index-assoc-list.rs
@@ -35,7 +35,7 @@ impl<K,V> AssociationList<K,V> {
 impl<'a, K: PartialEq + std::fmt::Debug, V:Clone> Index<&'a K> for AssociationList<K,V> {
     type Output = V;
 
-    fn index<'a>(&'a self, index: &K) -> &'a V {
+    fn index(&self, index: &K) -> &V {
         for pair in &self.pairs {
             if pair.key == *index {
                 return &pair.value