Auto merge of #39265 - est31:master, r=petrochenkov
Stabilize static lifetime in statics Stabilize the "static_in_const" feature. Blockers before this PR can be merged: * [x] The [FCP with inclination to stabilize](https://github.com/rust-lang/rust/issues/35897#issuecomment-270441437) needs to be over. FCP lasts roughly three weeks, so will be over at Jan 25, aka this thursday. * [x] Documentation needs to be added (#37928) Closes #35897.
This commit is contained in:
commit
1129ce51a6
7 changed files with 3 additions and 34 deletions
|
|
@ -238,8 +238,6 @@ enum Elide {
|
|||
FreshLateAnon(Cell<u32>),
|
||||
/// Always use this one lifetime.
|
||||
Exact(Region),
|
||||
/// Like `Exact(Static)` but requires `#![feature(static_in_const)]`.
|
||||
Static,
|
||||
/// Less or more than one lifetime were found, error on unspecified.
|
||||
Error(Vec<ElisionFailureInfo>)
|
||||
}
|
||||
|
|
@ -324,7 +322,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
hir::ItemConst(..) => {
|
||||
// No lifetime parameters, but implied 'static.
|
||||
let scope = Scope::Elision {
|
||||
elide: Elide::Static,
|
||||
elide: Elide::Exact(Region::Static),
|
||||
s: ROOT_SCOPE
|
||||
};
|
||||
self.with(scope, |_, this| intravisit::walk_item(this, item));
|
||||
|
|
@ -1307,16 +1305,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
return;
|
||||
}
|
||||
Elide::Exact(l) => l.shifted(late_depth),
|
||||
Elide::Static => {
|
||||
if !self.sess.features.borrow().static_in_const {
|
||||
self.sess
|
||||
.struct_span_err(span,
|
||||
"this needs a `'static` lifetime or the \
|
||||
`static_in_const` feature, see #35897")
|
||||
.emit();
|
||||
}
|
||||
Region::Static
|
||||
}
|
||||
Elide::Error(ref e) => break Some(e)
|
||||
};
|
||||
for lifetime_ref in lifetime_refs {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue