]> git.lizzy.rs Git - rust.git/commitdiff
fix feature error, test fallout
authorAndre Bogus <bogusandre@gmail.com>
Thu, 8 Sep 2016 20:59:21 +0000 (22:59 +0200)
committerAndre Bogus <bogusandre@gmail.com>
Thu, 8 Sep 2016 20:59:21 +0000 (22:59 +0200)
src/librustc_typeck/rscope.rs
src/test/compile-fail/const-unsized.rs
src/test/compile-fail/issue-24446.rs

index be44dce8a8acadd55895d0b213d3d0a71ff33359..131ecfc6e0c78339d9ddb0e4972e70a33b081690 100644 (file)
@@ -229,17 +229,9 @@ pub fn new(tcx: &'a ty::TyCtxt<'a, 'gcx, 'tcx>) -> Self {
 
 impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> RegionScope for StaticRscope<'a, 'gcx, 'tcx> {
     fn anon_regions(&self,
-                    _span: Span,
+                    span: Span,
                     count: usize)
                     -> Result<Vec<ty::Region>, Option<Vec<ElisionFailureInfo>>> {
-        Ok(vec![ty::ReStatic; count])
-    }
-
-    fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
-        Some(self.base_object_lifetime_default(span))
-    }
-
-    fn base_object_lifetime_default(&self, span: Span) -> ty::Region {
         if !self.tcx.sess.features.borrow().static_in_const {
             self.tcx
                 .sess
@@ -248,6 +240,14 @@ fn base_object_lifetime_default(&self, span: Span) -> ty::Region {
                                  `static_in_const` feature, see #35897")
                 .emit();
         }
+        Ok(vec![ty::ReStatic; count])
+    }
+
+    fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
+        Some(self.base_object_lifetime_default(span))
+    }
+
+    fn base_object_lifetime_default(&self, _span: Span) -> ty::Region {
         ty::ReStatic
     }
 }
index d3c0bf0021350d402f5150bad4d811d32e591314..a73164b957c831a8896859fb196858d2b3fb493d 100644 (file)
@@ -15,7 +15,6 @@
 //~| NOTE `std::fmt::Debug + Sync + 'static: std::marker::Sized` not satisfied
 //~| NOTE does not have a constant size known at compile-time
 //~| NOTE constant expressions must have a statically known size
-//~| ERROR this needs a `'static` lifetime or the `static_in_const` feature
 
 const CONST_FOO: str = *"foo";
 //~^ ERROR `str: std::marker::Sized` is not satisfied
@@ -28,7 +27,6 @@
 //~| NOTE `std::fmt::Debug + Sync + 'static: std::marker::Sized` not satisfied
 //~| NOTE does not have a constant size known at compile-time
 //~| NOTE constant expressions must have a statically known size
-//~| ERROR this needs a `'static` lifetime or the `static_in_const` feature
 
 static STATIC_BAR: str = *"bar";
 //~^ ERROR `str: std::marker::Sized` is not satisfied
index bcc1d3c3e42d9f4f3eddb3f21264f375452e6655..acd50bcf9e112fa0d608ba26e8f97f1c61b8f49b 100644 (file)
@@ -12,7 +12,6 @@ fn main() {
     static foo: Fn() -> u32 = || -> u32 {
         //~^ ERROR: mismatched types
         //~| ERROR: `std::ops::Fn() -> u32 + 'static: std::marker::Sized` is not satisfied
-        //~| ERROR: this needs a `'static` lifetime or the `static_in_const` feature
         0
     };
 }