diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 59cc312bee5fcc4064751bca256ed75592fa31ea..4156b1bec92a09dc1a9bb7ffcd5a0e1db9db6aed 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -87,7 +87,7 @@ #![feature(doc_spotlight)] #![feature(extern_types)] #![feature(fundamental)] -#![feature(impl_header_lifetime_elision)] +#![cfg_attr(stage0, feature(impl_header_lifetime_elision))] #![feature(intrinsics)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 965bd545eed591665b90be854ec0fab7c0fe9c1b..d340924aab1db7b602ef44070b11a1f7eaa3327f 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -19,7 +19,7 @@ #![feature(flt2dec)] #![feature(fmt_internals)] #![feature(hashmap_internals)] -#![feature(impl_header_lifetime_elision)] +#![cfg_attr(stage0, feature(impl_header_lifetime_elision))] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)] diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index cce872927b147c2a86d58c2e153d33f287cfb1cd..a1363168f0117b732e413dfae32c0edee0d94b3e 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -125,9 +125,8 @@ pub struct LoweringContext<'a> { // Whether or not in-band lifetimes are being collected. This is used to // indicate whether or not we're in a place where new lifetimes will result - // in in-band lifetime definitions, such a function or an impl header. - // This will always be false unless the `in_band_lifetimes` or - // `impl_header_lifetime_elision` feature is enabled. + // in in-band lifetime definitions, such a function or an impl header, + // including implicit lifetimes from `impl_header_lifetime_elision`. is_collecting_in_band_lifetimes: bool, // Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB. @@ -709,12 +708,8 @@ fn collect_in_band_defs( assert!(self.lifetimes_to_define.is_empty()); let old_anonymous_lifetime_mode = self.anonymous_lifetime_mode; - if self.sess.features_untracked().impl_header_lifetime_elision { - self.anonymous_lifetime_mode = anonymous_lifetime_mode; - self.is_collecting_in_band_lifetimes = true; - } else if self.sess.features_untracked().in_band_lifetimes { - self.is_collecting_in_band_lifetimes = true; - } + self.anonymous_lifetime_mode = anonymous_lifetime_mode; + self.is_collecting_in_band_lifetimes = true; let (in_band_ty_params, res) = f(self); diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 3c2caa39d76e07938995c828e1ba7dc23087989e..d8defabd3fe6616f90802efe8d956f438952c158 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -67,7 +67,7 @@ #![feature(step_trait)] #![feature(integer_atomics)] #![feature(test)] -#![feature(impl_header_lifetime_elision)] +#![cfg_attr(stage0, feature(impl_header_lifetime_elision))] #![feature(in_band_lifetimes)] #![feature(macro_at_most_once_rep)] #![feature(crate_visibility_modifier)] diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 5b01892dcb37ef7e7b41b2b187e0c0f35a33aecc..b197d29b184de11f6adec4e559c466290d270f06 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -21,7 +21,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(in_band_lifetimes)] -#![feature(impl_header_lifetime_elision)] +#![cfg_attr(stage0, feature(impl_header_lifetime_elision))] #![feature(unboxed_closures)] #![feature(fn_traits)] #![feature(unsize)] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index b3ef9eab8017da0f444876def3ea5a1dada7bb6e..2f44dff2e22c3472cc18c58232f2ab585600fb57 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -16,7 +16,7 @@ #![feature(nll)] #![feature(in_band_lifetimes)] -#![feature(impl_header_lifetime_elision)] +#![cfg_attr(stage0, feature(impl_header_lifetime_elision))] #![feature(slice_patterns)] #![feature(slice_sort_by_cached_key)] #![feature(box_patterns)] diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 5155ebbe19d475465f03b8890600c3fd03d31a6b..cd421de5f1db4a93d60dfb8decce359228a8aeaf 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -375,15 +375,15 @@ fn main() {} E0705: r##" A `#![feature]` attribute was declared for a feature that is stable in -the current edition. +the current edition, but not in all editions. Erroneous code example: ```ignore (limited to a warning during 2018 edition development) #![feature(rust_2018_preview)] -#![feature(impl_header_lifetime_elision)] // error: the feature - // `impl_header_lifetime_elision` is - // included in the Rust 2018 edition +#![feature(test_2018_feature)] // error: the feature + // `test_2018_feature` is + // included in the Rust 2018 edition ``` "##, diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index a110248439ee5b1e9822be4751fb3826b718f012..d0f407aa9243b84d8b410756c9a417eeb844e5d6 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -462,9 +462,8 @@ pub fn walk_feature_fields(&self, mut f: F) (active, abi_amdgpu_kernel, "1.29.0", Some(51575), None), - // impl Iterator for &mut Iterator - // impl Debug for Foo<'_> - (active, impl_header_lifetime_elision, "1.30.0", Some(15872), Some(Edition::Edition2018)), + // Perma-unstable; added for testing E0705 + (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)), // Support for arbitrary delimited token streams in non-macro attributes (active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None), @@ -684,6 +683,9 @@ pub fn walk_feature_fields(&self, mut f: F) (accepted, min_const_fn, "1.31.0", Some(53555), None), // Scoped lints (accepted, tool_lints, "1.31.0", Some(44690), None), + // impl Iterator for &mut Iterator + // impl Debug for Foo<'_> + (accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None), ); // If you change this, please modify src/doc/unstable-book as well. You must diff --git a/src/test/ui/E0705.rs b/src/test/ui/E0705.rs index 2e3492937acb976d514f606b93518cab0487db02..19f9ecc26cf0127545fe7f748f2d12146db8bc77 100644 --- a/src/test/ui/E0705.rs +++ b/src/test/ui/E0705.rs @@ -10,8 +10,11 @@ // compile-pass -#![feature(impl_header_lifetime_elision)] -//~^ WARN the feature `impl_header_lifetime_elision` is included in the Rust 2018 edition +// This is a stub feature that doesn't control anything, so to make tidy happy, +// gate-test-test_2018_feature + +#![feature(test_2018_feature)] +//~^ WARN the feature `test_2018_feature` is included in the Rust 2018 edition #![feature(rust_2018_preview)] fn main() {} diff --git a/src/test/ui/E0705.stderr b/src/test/ui/E0705.stderr index c40064d38d2ffda28f942c01f89e53eab11d7962..ccf8a04fdfc66cea1ff3a8024c51ed684494810a 100644 --- a/src/test/ui/E0705.stderr +++ b/src/test/ui/E0705.stderr @@ -1,6 +1,6 @@ -warning[E0705]: the feature `impl_header_lifetime_elision` is included in the Rust 2018 edition - --> $DIR/E0705.rs:13:12 +warning[E0705]: the feature `test_2018_feature` is included in the Rust 2018 edition + --> $DIR/E0705.rs:16:12 | -LL | #![feature(impl_header_lifetime_elision)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![feature(test_2018_feature)] + | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.stderr b/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.stderr deleted file mode 100644 index 9487d11d505ca184fc23c0aa838086b34505f0bb..0000000000000000000000000000000000000000 --- a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/feature-gate-impl_header_lifetime_elision-with-in_band.rs:18:22 - | -LL | impl MyTrait<'a> for &u32 { } - | ^ expected lifetime parameter - -error[E0106]: missing lifetime specifier - --> $DIR/feature-gate-impl_header_lifetime_elision-with-in_band.rs:24:23 - | -LL | impl MarkerTrait for &'_ MyStruct { } - | ^^ expected lifetime parameter - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.stderr b/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.stderr deleted file mode 100644 index 2c8a7dd4305a76e8777a251df1000616db422a90..0000000000000000000000000000000000000000 --- a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/feature-gate-impl_header_lifetime_elision.rs:15:26 - | -LL | impl<'a> MyTrait<'a> for &u32 { } - | ^ expected lifetime parameter - -error[E0106]: missing lifetime specifier - --> $DIR/feature-gate-impl_header_lifetime_elision.rs:18:18 - | -LL | impl<'a> MyTrait<'_> for &'a f32 { } - | ^^ expected lifetime parameter - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs index 23b30711cf3c0540ca5761918683d7f4ac21da67..ae1f81c2f5721fd54742b3036ebd2b7d0dcb8b60 100644 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs +++ b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs @@ -10,9 +10,6 @@ #![allow(warnings)] -// Make sure this related feature didn't accidentally enable this -#![feature(impl_header_lifetime_elision)] - fn foo(x: &'x u8) -> &'x u8 { x } //~^ ERROR use of undeclared lifetime name //~^^ ERROR use of undeclared lifetime name diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr index 5fe143959d2c5470e41e239b7fd4f4eb127c2739..cc0855306e162e97d984ca8807d8cebbd90b6aeb 100644 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr +++ b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr @@ -1,101 +1,101 @@ error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:16:12 + --> $DIR/feature-gate-in_band_lifetimes.rs:13:12 | LL | fn foo(x: &'x u8) -> &'x u8 { x } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:16:23 + --> $DIR/feature-gate-in_band_lifetimes.rs:13:23 | LL | fn foo(x: &'x u8) -> &'x u8 { x } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:28:12 + --> $DIR/feature-gate-in_band_lifetimes.rs:25:12 | LL | impl<'a> X<'b> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:30:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:27:27 | LL | fn inner_2(&self) -> &'b u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:36:8 + --> $DIR/feature-gate-in_band_lifetimes.rs:33:8 | LL | impl X<'b> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:38:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:35:27 | LL | fn inner_3(&self) -> &'b u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:46:9 + --> $DIR/feature-gate-in_band_lifetimes.rs:43:9 | LL | impl Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:48:25 + --> $DIR/feature-gate-in_band_lifetimes.rs:45:25 | LL | fn inner(&self) -> &'a u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:56:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:53:27 | LL | fn any_lifetime() -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:58:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 | LL | fn borrowed_lifetime(&'b self) -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:58:40 + --> $DIR/feature-gate-in_band_lifetimes.rs:55:40 | LL | fn borrowed_lifetime(&'b self) -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:63:14 + --> $DIR/feature-gate-in_band_lifetimes.rs:60:14 | LL | impl MyTrait<'a> for Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:63:25 + --> $DIR/feature-gate-in_band_lifetimes.rs:60:25 | LL | impl MyTrait<'a> for Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:66:31 + --> $DIR/feature-gate-in_band_lifetimes.rs:63:31 | LL | fn my_lifetime(&self) -> &'a u8 { self.0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:68:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:65:27 | LL | fn any_lifetime() -> &'b u8 { &0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:70:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:67:27 | LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:70:40 + --> $DIR/feature-gate-in_band_lifetimes.rs:67:40 | LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } | ^^ undeclared lifetime diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs index 15cf07771f2685409383672d4127b2913e557b88..49f528df8f6ccf88817e1fed056e6ee41684b0af 100644 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs @@ -13,8 +13,6 @@ #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - trait MyTrait { type Output; } diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr index 59b2cfd2226db121c670cd8515ca45db3547e337..022b8bc717b96120a93bc35a6e565fa32c2e3e5f 100644 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr @@ -1,11 +1,11 @@ error[E0106]: missing lifetime specifier - --> $DIR/assoc-type.rs:23:19 + --> $DIR/assoc-type.rs:21:19 | LL | type Output = &i32; | ^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/assoc-type.rs:28:20 + --> $DIR/assoc-type.rs:26:20 | LL | type Output = &'_ i32; | ^^ expected lifetime parameter diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs index 661bfa8bdcc9bd3673ed886eaf298b23f17a9fce..384c08ff5bb38f8e4b51ccd90c1c7b71678988a0 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs @@ -13,8 +13,6 @@ #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - use std::fmt::Debug; // Equivalent to `Box`: diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr index 3e54ebeb398d6dda554d04c2340cac6950edd2e6..f0e174a12074d8a24e098dff3beb54e4549439f5 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/dyn-trait.rs:32:16 + --> $DIR/dyn-trait.rs:30:16 | LL | static_val(x); //~ ERROR cannot infer | ^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 31:26... - --> $DIR/dyn-trait.rs:31:26 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 29:26... + --> $DIR/dyn-trait.rs:29:26 | LL | fn with_dyn_debug_static<'a>(x: Box) { | ^^ diff --git a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs index 56dd6691abbe52a246a062cc73b757fe1165204f..c0d454d9426464e83338c777de0dd44bfaf02a1c 100644 --- a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs +++ b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs @@ -12,8 +12,6 @@ #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - // This works for functions... fn foo<'a>(x: &str, y: &'a str) {} diff --git a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.rs b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs similarity index 71% rename from src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.rs rename to src/test/ui/impl-header-lifetime-elision/inherent-impl.rs index 3eb2ac1b00851b3aac677570bf39664a5ec9de93..d4b8acd60108bc7490eed0f472e2a1871f6a8749 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.rs +++ b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs @@ -8,14 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(warnings)] +// compile-pass -trait MyTrait<'a> { } +struct Foo<'a>(&'a u8); -impl<'a> MyTrait<'a> for &u32 { } -//~^ ERROR missing lifetime specifier - -impl<'a> MyTrait<'_> for &'a f32 { } -//~^ ERROR missing lifetime specifier +impl Foo<'_> { + fn x() {} +} fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.rs b/src/test/ui/impl-header-lifetime-elision/path-elided.rs index f88c899065c1bebc6323d3c3dd32f41731e63ee8..b68a0f375f60d5c5ffc0d8362ee3609bb6c42a96 100644 --- a/src/test/ui/impl-header-lifetime-elision/path-elided.rs +++ b/src/test/ui/impl-header-lifetime-elision/path-elided.rs @@ -9,8 +9,6 @@ // except according to those terms. #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - trait MyTrait { } struct Foo<'a> { x: &'a u32 } diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr index 6c1d72411bf57a31125d67f592a027e5a7332761..03e8f8c9ad5d2cb8ec2570785438eee54abbf7d6 100644 --- a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr +++ b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/path-elided.rs:18:18 + --> $DIR/path-elided.rs:16:18 | LL | impl MyTrait for Foo { | ^^^ expected lifetime parameter diff --git a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs b/src/test/ui/impl-header-lifetime-elision/path-underscore.rs index 38118f0d213335c030826aaee62038a9a4a5c7f0..b2c7a415efe98f4122e8cd55f0cea5df61e73ffe 100644 --- a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs +++ b/src/test/ui/impl-header-lifetime-elision/path-underscore.rs @@ -14,8 +14,6 @@ #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - trait MyTrait { } struct Foo<'a> { x: &'a u32 } diff --git a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs b/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs index 96a56aacd87cce5ddfbea3a3ff2e45398a9de5a7..e62e7dc56a4afa595ebfc2871b487dd0cdd962c1 100644 --- a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs +++ b/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs @@ -14,8 +14,6 @@ #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - trait MyTrait { } impl MyTrait for &i32 { diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs index afdf2200d909a5824a1cffc686219da8e25b73aa..1fb57b96ba9b444a1c7be9e2ae53f6f4d06e64af 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs @@ -9,8 +9,6 @@ // except according to those terms. #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - trait MyTrait<'a> { } impl MyTrait for u32 { diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr index fe3ded8e04c3309fe2db7b5932d53887eb7ee416..7138b321f97d46712c45ab98aaa1a257333e971f 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/trait-elided.rs:16:6 + --> $DIR/trait-elided.rs:14:6 | LL | impl MyTrait for u32 { | ^^^^^^^ expected lifetime parameter diff --git a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs index 98242ff6577955c5c37d8c6c0979b39725ab3e73..54d23f5f4dea8c4bbf532fcf96e0bba03ad70052 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs +++ b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs @@ -15,8 +15,6 @@ #![allow(warnings)] -#![feature(impl_header_lifetime_elision)] - trait MyTrait<'a> { } // This is equivalent to `MyTrait<'a> for &'b i32`, which is proven by diff --git a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.rs b/src/test/ui/issues/issue-17905-2.rs similarity index 50% rename from src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.rs rename to src/test/ui/issues/issue-17905-2.rs index b7e07e1dca6740fa249adcf7dac15da0718520c1..7b4a40e26b1bf2f2814796770ae38bc70a9ac7c3 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.rs +++ b/src/test/ui/issues/issue-17905-2.rs @@ -1,4 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,20 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(warnings)] +#[derive(Debug)] +struct Pair (T, V); -// Make sure this related feature didn't accidentally enable this -#![feature(in_band_lifetimes)] +impl Pair< + &str, + isize +> { + fn say(self: &Pair<&str, isize>) { + println!("{:?}", self); + } +} -trait MyTrait<'a> { } - -impl MyTrait<'a> for &u32 { } -//~^ ERROR missing lifetime specifier - -struct MyStruct; -trait MarkerTrait {} - -impl MarkerTrait for &'_ MyStruct { } -//~^ ERROR missing lifetime specifier - -fn main() {} +fn main() { + let result = &Pair("shane", 1); + result.say(); +} diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr new file mode 100644 index 0000000000000000000000000000000000000000..f6f23be2ab88a30d0bd28482911dff6e672282c5 --- /dev/null +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -0,0 +1,45 @@ +error[E0308]: mismatched method receiver + --> $DIR/issue-17905-2.rs:18:18 + | +LL | fn say(self: &Pair<&str, isize>) { + | ^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `Pair<&'_ str, _>` + found type `Pair<&str, _>` +note: the anonymous lifetime #2 defined on the method body at 18:5... + --> $DIR/issue-17905-2.rs:18:5 + | +LL | / fn say(self: &Pair<&str, isize>) { +LL | | println!("{:?}", self); +LL | | } + | |_____^ +note: ...does not necessarily outlive the lifetime '_ as defined on the impl at 15:5 + --> $DIR/issue-17905-2.rs:15:5 + | +LL | &str, + | ^ + +error[E0308]: mismatched method receiver + --> $DIR/issue-17905-2.rs:18:18 + | +LL | fn say(self: &Pair<&str, isize>) { + | ^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `Pair<&'_ str, _>` + found type `Pair<&str, _>` +note: the lifetime '_ as defined on the impl at 15:5... + --> $DIR/issue-17905-2.rs:15:5 + | +LL | &str, + | ^ +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 18:5 + --> $DIR/issue-17905-2.rs:18:5 + | +LL | / fn say(self: &Pair<&str, isize>) { +LL | | println!("{:?}", self); +LL | | } + | |_____^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-17905.rs b/src/test/ui/issues/issue-17905.rs index f11d482ea16db55a42a9ad695a80a1c01f5c192b..fc5069d9443f5aff18968c3a4a7059bac4583e73 100644 --- a/src/test/ui/issues/issue-17905.rs +++ b/src/test/ui/issues/issue-17905.rs @@ -8,15 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// run-pass + #[derive(Debug)] struct Pair (T, V); impl Pair< - &str, //~ ERROR missing lifetime specifier + &str, isize > { - fn say(self: &Pair<&str, isize>) { - println!("{}", self); + fn say(&self) { + println!("{:?}", self); } } diff --git a/src/test/ui/issues/issue-17905.stderr b/src/test/ui/issues/issue-17905.stderr deleted file mode 100644 index 1a7aba1748015062f54dc85c6b7ad82140768dcf..0000000000000000000000000000000000000000 --- a/src/test/ui/issues/issue-17905.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-17905.rs:15:5 - | -LL | &str, //~ ERROR missing lifetime specifier - | ^ expected lifetime parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/issues/issue-19982-2.rs b/src/test/ui/issues/issue-19982-2.rs deleted file mode 100644 index 8c3462dcf45d215372f57ba19ced2023edce0bfa..0000000000000000000000000000000000000000 --- a/src/test/ui/issues/issue-19982-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass -// pretty-expanded FIXME #23616 - -#![feature(fn_traits, unboxed_closures)] - -#[allow(dead_code)] -struct Foo; - -impl<'a> Fn<(&'a (),)> for Foo { - extern "rust-call" fn call(&self, (_,): (&(),)) {} -} - -impl<'a> FnMut<(&'a (),)> for Foo { - extern "rust-call" fn call_mut(&mut self, (_,): (&(),)) {} -} - -impl<'a> FnOnce<(&'a (),)> for Foo { - type Output = (); - - extern "rust-call" fn call_once(self, (_,): (&(),)) {} -} - -fn main() {} diff --git a/src/test/ui/issues/issue-19982.rs b/src/test/ui/issues/issue-19982.rs index 9dbca997341fc24168a1aa0d5ddf8f09a0740517..3de817c28a85f5bb6921b16d2214bb9b34a1690c 100644 --- a/src/test/ui/issues/issue-19982.rs +++ b/src/test/ui/issues/issue-19982.rs @@ -8,10 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(unboxed_closures)] +// compile-pass +#![feature(fn_traits, unboxed_closures)] + +#[allow(dead_code)] struct Foo; -impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier +impl Fn<(&(),)> for Foo { + extern "rust-call" fn call(&self, (_,): (&(),)) {} +} + +impl FnMut<(&(),)> for Foo { + extern "rust-call" fn call_mut(&mut self, (_,): (&(),)) {} +} + +impl FnOnce<(&(),)> for Foo { + type Output = (); + + extern "rust-call" fn call_once(self, (_,): (&(),)) {} +} fn main() {} diff --git a/src/test/ui/issues/issue-19982.stderr b/src/test/ui/issues/issue-19982.stderr deleted file mode 100644 index 9f13ba640a9507ac862153099da0f70874f29700..0000000000000000000000000000000000000000 --- a/src/test/ui/issues/issue-19982.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-19982.rs:15:10 - | -LL | impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier - | ^ expected lifetime parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/nll/issue-52742.rs b/src/test/ui/nll/issue-52742.rs index c36e4cc70fd58abcee5a4fa8c1380785ed09b26f..84d06a1d20aac76485ed819f553df31cff08644b 100644 --- a/src/test/ui/nll/issue-52742.rs +++ b/src/test/ui/nll/issue-52742.rs @@ -10,7 +10,6 @@ #![feature(nll)] #![feature(in_band_lifetimes)] -#![feature(impl_header_lifetime_elision)] struct Foo<'a, 'b> { x: &'a u32, diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr index 83a594941c0a5a08a2b6512f06f0407ae62a10b5..ccd6ec5cb77fa8f5f9d62e4c425a1fdcff92dfea 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.stderr @@ -1,5 +1,5 @@ error: unsatisfied lifetime constraints - --> $DIR/issue-52742.rs:26:9 + --> $DIR/issue-52742.rs:25:9 | LL | fn take_bar(&mut self, b: Bar<'_>) { | --------- -- let's call this `'1` diff --git a/src/test/ui/underscore-lifetime/in-binder.Rust2015.stderr b/src/test/ui/underscore-lifetime/in-binder.Rust2015.stderr deleted file mode 100644 index a851e6b2071b26be0cbe770a573c92536869210d..0000000000000000000000000000000000000000 --- a/src/test/ui/underscore-lifetime/in-binder.Rust2015.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:12:6 - | -LL | impl<'_> IceCube<'_> {} - | ^^ `'_` is a reserved lifetime name - -error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:17:15 - | -LL | struct Struct<'_> { - | ^^ `'_` is a reserved lifetime name - -error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:23:11 - | -LL | enum Enum<'_> { - | ^^ `'_` is a reserved lifetime name - -error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:29:13 - | -LL | union Union<'_> { - | ^^ `'_` is a reserved lifetime name - -error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:35:13 - | -LL | trait Trait<'_> { - | ^^ `'_` is a reserved lifetime name - -error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:40:8 - | -LL | fn foo<'_>() { - | ^^ `'_` is a reserved lifetime name - -error[E0106]: missing lifetime specifier - --> $DIR/in-binder.rs:12:18 - | -LL | impl<'_> IceCube<'_> {} - | ^^ expected lifetime parameter - -error: aborting due to 7 previous errors - -Some errors occurred: E0106, E0637. -For more information about an error, try `rustc --explain E0106`. diff --git a/src/test/ui/underscore-lifetime/in-binder.rs b/src/test/ui/underscore-lifetime/in-binder.rs index c94947d1eab1ccc5c08613518867a1077899aefd..e4ee5e8cb2741e8b5cf49a0cc4e32c17d3c43763 100644 --- a/src/test/ui/underscore-lifetime/in-binder.rs +++ b/src/test/ui/underscore-lifetime/in-binder.rs @@ -2,44 +2,34 @@ // // Regression test for #52098. -// revisions: Rust2015 Rust2018 -//[Rust2018] edition:2018 - struct IceCube<'a> { v: Vec<&'a char> } impl<'_> IceCube<'_> {} -//[Rust2015]~^ ERROR `'_` cannot be used here -//[Rust2015]~| ERROR missing lifetime specifier -//[Rust2018]~^^^ ERROR `'_` cannot be used here +//~^ ERROR `'_` cannot be used here struct Struct<'_> { -//[Rust2015]~^ ERROR `'_` cannot be used here -//[Rust2018]~^^ ERROR `'_` cannot be used here +//~^ ERROR `'_` cannot be used here v: Vec<&'static char> } enum Enum<'_> { -//[Rust2015]~^ ERROR `'_` cannot be used here -//[Rust2018]~^^ ERROR `'_` cannot be used here +//~^ ERROR `'_` cannot be used here Variant } union Union<'_> { -//[Rust2015]~^ ERROR `'_` cannot be used here -//[Rust2018]~^^ ERROR `'_` cannot be used here +//~^ ERROR `'_` cannot be used here a: u32 } trait Trait<'_> { -//[Rust2015]~^ ERROR `'_` cannot be used here -//[Rust2018]~^^ ERROR `'_` cannot be used here +//~^ ERROR `'_` cannot be used here } fn foo<'_>() { - //[Rust2015]~^ ERROR `'_` cannot be used here - //[Rust2018]~^^ ERROR `'_` cannot be used here + //~^ ERROR `'_` cannot be used here } fn main() {} diff --git a/src/test/ui/underscore-lifetime/in-binder.Rust2018.stderr b/src/test/ui/underscore-lifetime/in-binder.stderr similarity index 82% rename from src/test/ui/underscore-lifetime/in-binder.Rust2018.stderr rename to src/test/ui/underscore-lifetime/in-binder.stderr index 77da3038724b885384dcd8be0de6fac7ee47ce72..fcd7eddb57605197fd7fd9a115847d17d7499ef9 100644 --- a/src/test/ui/underscore-lifetime/in-binder.Rust2018.stderr +++ b/src/test/ui/underscore-lifetime/in-binder.stderr @@ -1,35 +1,35 @@ error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:12:6 + --> $DIR/in-binder.rs:9:6 | LL | impl<'_> IceCube<'_> {} | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:17:15 + --> $DIR/in-binder.rs:12:15 | LL | struct Struct<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:23:11 + --> $DIR/in-binder.rs:17:11 | LL | enum Enum<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:29:13 + --> $DIR/in-binder.rs:22:13 | LL | union Union<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:35:13 + --> $DIR/in-binder.rs:27:13 | LL | trait Trait<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:40:8 + --> $DIR/in-binder.rs:31:8 | LL | fn foo<'_>() { | ^^ `'_` is a reserved lifetime name diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs index 2652fc62bb6228e93f152cf8f945f45302ac8a6f..9048e65648a2bcdb7ecfeb055bbd75e11673954a 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs @@ -11,10 +11,6 @@ struct Foo<'a>(&'a u8); struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier -impl Foo<'_> { //~ ERROR missing lifetime specifier - fn x() {} -} - fn foo<'_> //~ ERROR cannot be used here (_: Foo<'_>) {} diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index fc9f3e642d4026993c11373f94b3042c432e717a..bccecd60e1c9e39f38d85466c6e408bc54a68996 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -1,11 +1,11 @@ error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:18:8 + --> $DIR/underscore-lifetime-binders.rs:14:8 | LL | fn foo<'_> //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:24:21 + --> $DIR/underscore-lifetime-binders.rs:20:21 | LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name @@ -17,13 +17,7 @@ LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:14:10 - | -LL | impl Foo<'_> { //~ ERROR missing lifetime specifier - | ^^ expected lifetime parameter - -error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:24:29 + --> $DIR/underscore-lifetime-binders.rs:20:29 | LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here | ^^ expected lifetime parameter @@ -32,14 +26,14 @@ LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here = help: consider giving it a 'static lifetime error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:30:35 + --> $DIR/underscore-lifetime-binders.rs:26:35 | LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y` -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0106, E0637. For more information about an error, try `rustc --explain E0106`.