Skip to content

Commit 76a2f9f

Browse files
committed
fix feature error, test fallout
1 parent df611a6 commit 76a2f9f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/librustc_typeck/rscope.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,9 @@ impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> StaticRscope<'a, 'gcx, 'tcx> {
229229

230230
impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> RegionScope for StaticRscope<'a, 'gcx, 'tcx> {
231231
fn anon_regions(&self,
232-
_span: Span,
232+
span: Span,
233233
count: usize)
234234
-> Result<Vec<ty::Region>, Option<Vec<ElisionFailureInfo>>> {
235-
Ok(vec![ty::ReStatic; count])
236-
}
237-
238-
fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
239-
Some(self.base_object_lifetime_default(span))
240-
}
241-
242-
fn base_object_lifetime_default(&self, span: Span) -> ty::Region {
243235
if !self.tcx.sess.features.borrow().static_in_const {
244236
self.tcx
245237
.sess
@@ -248,6 +240,14 @@ impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> RegionScope for StaticRscope<'a, 'gcx, 'tcx>
248240
`static_in_const` feature, see #35897")
249241
.emit();
250242
}
243+
Ok(vec![ty::ReStatic; count])
244+
}
245+
246+
fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
247+
Some(self.base_object_lifetime_default(span))
248+
}
249+
250+
fn base_object_lifetime_default(&self, _span: Span) -> ty::Region {
251251
ty::ReStatic
252252
}
253253
}

src/test/compile-fail/const-unsized.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
1515
//~| NOTE `std::fmt::Debug + Sync + 'static: std::marker::Sized` not satisfied
1616
//~| NOTE does not have a constant size known at compile-time
1717
//~| NOTE constant expressions must have a statically known size
18-
//~| ERROR this needs a `'static` lifetime or the `static_in_const` feature
1918

2019
const CONST_FOO: str = *"foo";
2120
//~^ ERROR `str: std::marker::Sized` is not satisfied
@@ -28,7 +27,6 @@ static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync));
2827
//~| NOTE `std::fmt::Debug + Sync + 'static: std::marker::Sized` not satisfied
2928
//~| NOTE does not have a constant size known at compile-time
3029
//~| NOTE constant expressions must have a statically known size
31-
//~| ERROR this needs a `'static` lifetime or the `static_in_const` feature
3230

3331
static STATIC_BAR: str = *"bar";
3432
//~^ ERROR `str: std::marker::Sized` is not satisfied

src/test/compile-fail/issue-24446.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ fn main() {
1212
static foo: Fn() -> u32 = || -> u32 {
1313
//~^ ERROR: mismatched types
1414
//~| ERROR: `std::ops::Fn() -> u32 + 'static: std::marker::Sized` is not satisfied
15-
//~| ERROR: this needs a `'static` lifetime or the `static_in_const` feature
1615
0
1716
};
1817
}

0 commit comments

Comments
 (0)