Skip to content

Commit e6e6bd2

Browse files
committed
Stabilize underscore lifetimes
1 parent e5277c1 commit e6e6bd2

32 files changed

+27
-82
lines changed

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#![feature(slice_patterns)]
6969
#![feature(specialization)]
7070
#![feature(unboxed_closures)]
71-
#![feature(underscore_lifetimes)]
71+
#![cfg_attr(stage0, feature(underscore_lifetimes))]
7272
#![cfg_attr(stage0, feature(universal_impl_trait))]
7373
#![feature(trace_macros)]
7474
#![feature(trusted_len)]

src/librustc_data_structures/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#![cfg_attr(stage0, feature(i128_type, i128))]
3131
#![feature(specialization)]
3232
#![feature(optin_builtin_traits)]
33-
#![feature(underscore_lifetimes)]
33+
#![cfg_attr(stage0, feature(underscore_lifetimes))]
3434
#![feature(macro_vis_matcher)]
3535
#![feature(allow_internal_unstable)]
3636
#![cfg_attr(stage0, feature(universal_impl_trait))]

src/librustc_mir/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
3737
#![feature(placement_in_syntax)]
3838
#![feature(collection_placement)]
3939
#![feature(nonzero)]
40-
#![feature(underscore_lifetimes)]
40+
#![cfg_attr(stage0, feature(underscore_lifetimes))]
4141
#![cfg_attr(stage0, feature(never_type))]
4242
#![feature(inclusive_range_fields)]
4343

src/librustc_traits/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#![feature(crate_visibility_modifier)]
1717
#![cfg_attr(stage0, feature(match_default_bindings))]
18-
#![feature(underscore_lifetimes)]
18+
#![cfg_attr(stage0, feature(underscore_lifetimes))]
1919

2020
#[macro_use]
2121
extern crate log;

src/libsyntax/feature_gate.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ declare_features! (
385385
// allow `'_` placeholder lifetimes
386386
(active, underscore_lifetimes, "1.22.0", Some(44524), None),
387387

388+
// Default match binding modes (RFC 2005)
389+
(active, match_default_bindings, "1.22.0", Some(42640), None),
390+
388391
// Trait object syntax with `dyn` prefix
389392
(active, dyn_trait, "1.22.0", Some(44662), Some(Edition::Edition2018)),
390393

@@ -562,6 +565,8 @@ declare_features! (
562565
(accepted, i128_type, "1.26.0", Some(35118), None),
563566
// Default match binding modes (RFC 2005)
564567
(accepted, match_default_bindings, "1.26.0", Some(42640), None),
568+
// allow `'_` placeholder lifetimes
569+
(accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
565570
);
566571

567572
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1792,14 +1797,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
17921797

17931798
visit::walk_generic_param(self, param)
17941799
}
1795-
1796-
fn visit_lifetime(&mut self, lt: &'a ast::Lifetime) {
1797-
if lt.ident.name == keywords::UnderscoreLifetime.name() {
1798-
gate_feature_post!(&self, underscore_lifetimes, lt.span,
1799-
"underscore lifetimes are unstable");
1800-
}
1801-
visit::walk_lifetime(self, lt)
1802-
}
18031800
}
18041801

18051802
pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],

src/test/compile-fail/closure-expected-type/expect-fn-supply-fn-multiple.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// must-compile-successfully
1212

13-
#![feature(underscore_lifetimes)]
1413
#![allow(warnings)]
1514

1615
type Different<'a, 'b> = &'a mut (&'a (), &'b ());

src/test/compile-fail/closure-expected-type/expect-fn-supply-fn.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(underscore_lifetimes)]
12-
1311
fn with_closure_expecting_fn_with_free_region<F>(_: F)
1412
where F: for<'a> FnOnce(fn(&'a u32), &i32)
1513
{

src/test/compile-fail/underscore-lifetime-binders.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(underscore_lifetimes)]
12-
1311
struct Foo<'a>(&'a u8);
1412
struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier
1513

src/test/compile-fail/underscore-lifetime-elison-mismatch.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(underscore_lifetimes)]
12-
1311
fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
1412

1513
fn main() {}

src/test/run-pass/impl-trait/lifetimes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(underscore_lifetimes)]
1211
#![allow(warnings)]
1312

1413
use std::fmt::Debug;

0 commit comments

Comments
 (0)