Skip to content

Commit d570b36

Browse files
committed
Auto merge of #54778 - scottmcm:stabilize-ihle, r=pnkfelix
Stabilize impl_header_lifetime_elision in 2015 ~~This is currently blocked on #54902; it should be good after that~~ It's already stable in 2018; this finishes the stabilization. FCP completed (#15872 (comment)), proposal (#15872 (comment)). Tracking issue: #15872 Usage examples (from libcore): #54687
2 parents 979fb16 + 18f7db3 commit d570b36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+156
-264
lines changed

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#![feature(doc_spotlight)]
8888
#![feature(extern_types)]
8989
#![feature(fundamental)]
90-
#![feature(impl_header_lifetime_elision)]
90+
#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
9191
#![feature(intrinsics)]
9292
#![feature(lang_items)]
9393
#![feature(link_llvm_intrinsics)]

src/libcore/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#![feature(flt2dec)]
2020
#![feature(fmt_internals)]
2121
#![feature(hashmap_internals)]
22-
#![feature(impl_header_lifetime_elision)]
22+
#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
2323
#![feature(pattern)]
2424
#![feature(range_is_empty)]
2525
#![feature(raw)]

src/librustc/hir/lowering.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ pub struct LoweringContext<'a> {
125125

126126
// Whether or not in-band lifetimes are being collected. This is used to
127127
// indicate whether or not we're in a place where new lifetimes will result
128-
// in in-band lifetime definitions, such a function or an impl header.
129-
// This will always be false unless the `in_band_lifetimes` or
130-
// `impl_header_lifetime_elision` feature is enabled.
128+
// in in-band lifetime definitions, such a function or an impl header,
129+
// including implicit lifetimes from `impl_header_lifetime_elision`.
131130
is_collecting_in_band_lifetimes: bool,
132131

133132
// Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB.
@@ -709,12 +708,8 @@ impl<'a> LoweringContext<'a> {
709708
assert!(self.lifetimes_to_define.is_empty());
710709
let old_anonymous_lifetime_mode = self.anonymous_lifetime_mode;
711710

712-
if self.sess.features_untracked().impl_header_lifetime_elision {
713-
self.anonymous_lifetime_mode = anonymous_lifetime_mode;
714-
self.is_collecting_in_band_lifetimes = true;
715-
} else if self.sess.features_untracked().in_band_lifetimes {
716-
self.is_collecting_in_band_lifetimes = true;
717-
}
711+
self.anonymous_lifetime_mode = anonymous_lifetime_mode;
712+
self.is_collecting_in_band_lifetimes = true;
718713

719714
let (in_band_ty_params, res) = f(self);
720715

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#![feature(step_trait)]
6868
#![feature(integer_atomics)]
6969
#![feature(test)]
70-
#![feature(impl_header_lifetime_elision)]
70+
#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
7171
#![feature(in_band_lifetimes)]
7272
#![feature(macro_at_most_once_rep)]
7373
#![feature(crate_visibility_modifier)]

src/librustc_data_structures/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
html_root_url = "https://doc.rust-lang.org/nightly/")]
2222

2323
#![feature(in_band_lifetimes)]
24-
#![feature(impl_header_lifetime_elision)]
24+
#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
2525
#![feature(unboxed_closures)]
2626
#![feature(fn_traits)]
2727
#![feature(unsize)]

src/librustc_mir/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
1616

1717
#![feature(nll)]
1818
#![feature(in_band_lifetimes)]
19-
#![feature(impl_header_lifetime_elision)]
19+
#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
2020
#![feature(slice_patterns)]
2121
#![feature(slice_sort_by_cached_key)]
2222
#![feature(box_patterns)]

src/libsyntax/diagnostic_list.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,15 @@ and likely to change in the future.
375375

376376
E0705: r##"
377377
A `#![feature]` attribute was declared for a feature that is stable in
378-
the current edition.
378+
the current edition, but not in all editions.
379379
380380
Erroneous code example:
381381
382382
```ignore (limited to a warning during 2018 edition development)
383383
#![feature(rust_2018_preview)]
384-
#![feature(impl_header_lifetime_elision)] // error: the feature
385-
// `impl_header_lifetime_elision` is
386-
// included in the Rust 2018 edition
384+
#![feature(test_2018_feature)] // error: the feature
385+
// `test_2018_feature` is
386+
// included in the Rust 2018 edition
387387
```
388388
389389
"##,

src/libsyntax/feature_gate.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,8 @@ declare_features! (
462462

463463
(active, abi_amdgpu_kernel, "1.29.0", Some(51575), None),
464464

465-
// impl<I:Iterator> Iterator for &mut Iterator
466-
// impl Debug for Foo<'_>
467-
(active, impl_header_lifetime_elision, "1.30.0", Some(15872), Some(Edition::Edition2018)),
465+
// Perma-unstable; added for testing E0705
466+
(active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)),
468467

469468
// Support for arbitrary delimited token streams in non-macro attributes
470469
(active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None),
@@ -684,6 +683,9 @@ declare_features! (
684683
(accepted, min_const_fn, "1.31.0", Some(53555), None),
685684
// Scoped lints
686685
(accepted, tool_lints, "1.31.0", Some(44690), None),
686+
// impl<I:Iterator> Iterator for &mut Iterator
687+
// impl Debug for Foo<'_>
688+
(accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
687689
);
688690

689691
// If you change this, please modify src/doc/unstable-book as well. You must

src/test/ui/E0705.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010

1111
// compile-pass
1212

13-
#![feature(impl_header_lifetime_elision)]
14-
//~^ WARN the feature `impl_header_lifetime_elision` is included in the Rust 2018 edition
13+
// This is a stub feature that doesn't control anything, so to make tidy happy,
14+
// gate-test-test_2018_feature
15+
16+
#![feature(test_2018_feature)]
17+
//~^ WARN the feature `test_2018_feature` is included in the Rust 2018 edition
1518
#![feature(rust_2018_preview)]
1619

1720
fn main() {}

src/test/ui/E0705.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
warning[E0705]: the feature `impl_header_lifetime_elision` is included in the Rust 2018 edition
2-
--> $DIR/E0705.rs:13:12
1+
warning[E0705]: the feature `test_2018_feature` is included in the Rust 2018 edition
2+
--> $DIR/E0705.rs:16:12
33
|
4-
LL | #![feature(impl_header_lifetime_elision)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | #![feature(test_2018_feature)]
5+
| ^^^^^^^^^^^^^^^^^
66

0 commit comments

Comments
 (0)