From 76a2f9f4542ccb15d6eb2426b162ce91094f04e2 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Thu, 8 Sep 2016 22:59:21 +0200 Subject: [PATCH] fix feature error, test fallout --- src/librustc_typeck/rscope.rs | 18 +++++++++--------- src/test/compile-fail/const-unsized.rs | 2 -- src/test/compile-fail/issue-24446.rs | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/librustc_typeck/rscope.rs b/src/librustc_typeck/rscope.rs index be44dce8a8aca..131ecfc6e0c78 100644 --- a/src/librustc_typeck/rscope.rs +++ b/src/librustc_typeck/rscope.rs @@ -229,17 +229,9 @@ impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> StaticRscope<'a, 'gcx, 'tcx> { impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> RegionScope for StaticRscope<'a, 'gcx, 'tcx> { fn anon_regions(&self, - _span: Span, + span: Span, count: usize) -> Result, Option>> { - Ok(vec![ty::ReStatic; count]) - } - - fn object_lifetime_default(&self, span: Span) -> Option { - 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 @@ impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> RegionScope for StaticRscope<'a, 'gcx, 'tcx> `static_in_const` feature, see #35897") .emit(); } + Ok(vec![ty::ReStatic; count]) + } + + fn object_lifetime_default(&self, span: Span) -> Option { + Some(self.base_object_lifetime_default(span)) + } + + fn base_object_lifetime_default(&self, _span: Span) -> ty::Region { ty::ReStatic } } diff --git a/src/test/compile-fail/const-unsized.rs b/src/test/compile-fail/const-unsized.rs index d3c0bf0021350..a73164b957c83 100644 --- a/src/test/compile-fail/const-unsized.rs +++ b/src/test/compile-fail/const-unsized.rs @@ -15,7 +15,6 @@ const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); //~| 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 @@ static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); //~| 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 diff --git a/src/test/compile-fail/issue-24446.rs b/src/test/compile-fail/issue-24446.rs index bcc1d3c3e42d9..acd50bcf9e112 100644 --- a/src/test/compile-fail/issue-24446.rs +++ b/src/test/compile-fail/issue-24446.rs @@ -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 }; }