diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index f43fbaa3268d8..c5bf543d9ea81 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -250,9 +250,9 @@ declare_lint! { } declare_lint! { - pub ELIDED_LIFETIMES_IN_PATHS, + pub HIDDEN_LIFETIMES_IN_TYPES, Allow, - "implicit lifetime parameters are deprecated" + "hidden lifetime parameters in types are deprecated" } declare_lint! { @@ -376,7 +376,7 @@ impl LintPass for HardwiredLints { UNUSED_LIFETIMES, UNUSED_LABELS, TYVAR_BEHIND_RAW_POINTER, - ELIDED_LIFETIMES_IN_PATHS, + HIDDEN_LIFETIMES_IN_TYPES, BARE_TRAIT_OBJECTS, ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE, UNSTABLE_NAME_COLLISIONS, diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 16d5e0112a1f5..39ca5669a28bb 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -2102,10 +2102,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } let mut err = self.tcx.struct_span_lint_node( - lint::builtin::ELIDED_LIFETIMES_IN_PATHS, + lint::builtin::HIDDEN_LIFETIMES_IN_TYPES, implicit_lifetimes[0].id, // FIXME: HirIdify #50928 path.span, - &format!("implicit lifetime parameters in types are deprecated"), + &format!("hidden lifetime parameters in types are deprecated"), ); if implicit_lifetimes.len() == 1 { diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 90e8c3ecad942..e9598c050ec74 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -45,7 +45,7 @@ extern crate syntax_pos; use rustc::lint; use rustc::lint::{LateContext, LateLintPass, LintPass, LintArray}; use rustc::lint::builtin::{BARE_TRAIT_OBJECTS, ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE, - ELIDED_LIFETIMES_IN_PATHS, MACRO_USE_EXTERN_CRATE}; + HIDDEN_LIFETIMES_IN_TYPES, MACRO_USE_EXTERN_CRATE}; use rustc::session; use rustc::util; @@ -184,7 +184,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { UNREACHABLE_PUB, UNUSED_EXTERN_CRATES, MACRO_USE_EXTERN_CRATE, - ELIDED_LIFETIMES_IN_PATHS, + HIDDEN_LIFETIMES_IN_TYPES, ELLIPSIS_INCLUSIVE_RANGE_PATTERNS); // Guidelines for creating a future incompatibility lint: @@ -308,11 +308,14 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { // Register renamed and removed lints store.register_renamed("single_use_lifetime", "single_use_lifetimes"); - store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths"); store.register_renamed("bare_trait_object", "bare_trait_objects"); store.register_renamed("unstable_name_collision", "unstable_name_collisions"); store.register_renamed("unused_doc_comment", "unused_doc_comments"); store.register_renamed("unknown_features", "unused_features"); + // Yes, it got renamed twice :'( + store.register_renamed("elided_lifetime_in_path", "hidden_lifetimes_in_types"); + store.register_renamed("elided_lifetimes_in_paths", "hidden_lifetimes_in_types"); + store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate"); store.register_removed("negate_unsigned", "cast a signed value instead"); store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok"); diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed b/src/test/ui/lint/hidden-lifetimes-in-types.fixed similarity index 82% rename from src/test/ui/in-band-lifetimes/elided-lifetimes.fixed rename to src/test/ui/lint/hidden-lifetimes-in-types.fixed index c4d5d95036880..a31c7bb514062 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed +++ b/src/test/ui/lint/hidden-lifetimes-in-types.fixed @@ -12,7 +12,7 @@ // compile-flags: --edition 2018 #![allow(unused)] -#![deny(elided_lifetimes_in_paths)] +#![deny(hidden_lifetimes_in_types)] //~^ NOTE lint level defined here use std::cell::{RefCell, Ref}; @@ -21,7 +21,7 @@ use std::cell::{RefCell, Ref}; struct Foo<'a> { x: &'a u32 } fn foo(x: &Foo<'_>) { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime } @@ -35,13 +35,13 @@ struct WrappedWithBow<'a> { } fn wrap_gift(gift: &str) -> Wrapped<'_> { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime Wrapped(gift) } fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow<'_> { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime WrappedWithBow { gift } } @@ -53,7 +53,7 @@ macro_rules! autowrapper { } fn $fn_name(gift: &str) -> $type_name<'_> { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime $type_name { gift } } @@ -67,7 +67,7 @@ autowrapper!(Autowrapped, autowrap_gift, 'a); macro_rules! anytuple_ref_ty { ($($types:ty),*) => { Ref<'_, ($($types),*)> - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime } } @@ -75,7 +75,7 @@ macro_rules! anytuple_ref_ty { fn main() { let honesty = RefCell::new((4, 'e')); let loyalty: Ref<'_, (u32, char)> = honesty.borrow(); - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime let generosity = Ref::map(loyalty, |t| &t.0); diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs b/src/test/ui/lint/hidden-lifetimes-in-types.rs similarity index 81% rename from src/test/ui/in-band-lifetimes/elided-lifetimes.rs rename to src/test/ui/lint/hidden-lifetimes-in-types.rs index 92676777b3824..f1f5c96264bd7 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs +++ b/src/test/ui/lint/hidden-lifetimes-in-types.rs @@ -12,7 +12,7 @@ // compile-flags: --edition 2018 #![allow(unused)] -#![deny(elided_lifetimes_in_paths)] +#![deny(hidden_lifetimes_in_types)] //~^ NOTE lint level defined here use std::cell::{RefCell, Ref}; @@ -21,7 +21,7 @@ use std::cell::{RefCell, Ref}; struct Foo<'a> { x: &'a u32 } fn foo(x: &Foo) { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime } @@ -35,13 +35,13 @@ struct WrappedWithBow<'a> { } fn wrap_gift(gift: &str) -> Wrapped { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime Wrapped(gift) } fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime WrappedWithBow { gift } } @@ -53,7 +53,7 @@ macro_rules! autowrapper { } fn $fn_name(gift: &str) -> $type_name { - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime $type_name { gift } } @@ -67,7 +67,7 @@ autowrapper!(Autowrapped, autowrap_gift, 'a); macro_rules! anytuple_ref_ty { ($($types:ty),*) => { Ref<($($types),*)> - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime } } @@ -75,7 +75,7 @@ macro_rules! anytuple_ref_ty { fn main() { let honesty = RefCell::new((4, 'e')); let loyalty: Ref<(u32, char)> = honesty.borrow(); - //~^ ERROR implicit lifetime parameters in types are deprecated + //~^ ERROR hidden lifetime parameters in types are deprecated //~| HELP indicate the anonymous lifetime let generosity = Ref::map(loyalty, |t| &t.0); diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr b/src/test/ui/lint/hidden-lifetimes-in-types.stderr similarity index 64% rename from src/test/ui/in-band-lifetimes/elided-lifetimes.stderr rename to src/test/ui/lint/hidden-lifetimes-in-types.stderr index b3da5279a17fc..c34033fa06dd6 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr +++ b/src/test/ui/lint/hidden-lifetimes-in-types.stderr @@ -1,35 +1,35 @@ -error: implicit lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:23:12 +error: hidden lifetime parameters in types are deprecated + --> $DIR/hidden-lifetimes-in-types.rs:23:12 | LL | fn foo(x: &Foo) { | ^^^- help: indicate the anonymous lifetime: `<'_>` | note: lint level defined here - --> $DIR/elided-lifetimes.rs:15:9 + --> $DIR/hidden-lifetimes-in-types.rs:15:9 | -LL | #![deny(elided_lifetimes_in_paths)] +LL | #![deny(hidden_lifetimes_in_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: implicit lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:37:29 +error: hidden lifetime parameters in types are deprecated + --> $DIR/hidden-lifetimes-in-types.rs:37:29 | LL | fn wrap_gift(gift: &str) -> Wrapped { | ^^^^^^^- help: indicate the anonymous lifetime: `<'_>` -error: implicit lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:43:38 +error: hidden lifetime parameters in types are deprecated + --> $DIR/hidden-lifetimes-in-types.rs:43:38 | LL | fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { | ^^^^^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` -error: implicit lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:77:18 +error: hidden lifetime parameters in types are deprecated + --> $DIR/hidden-lifetimes-in-types.rs:77:18 | LL | let loyalty: Ref<(u32, char)> = honesty.borrow(); | ^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Ref<'_, (u32, char)>` -error: implicit lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:69:9 +error: hidden lifetime parameters in types are deprecated + --> $DIR/hidden-lifetimes-in-types.rs:69:9 | LL | Ref<($($types),*)> | ^^^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Ref<'_, ($($types),*)>` @@ -37,8 +37,8 @@ LL | Ref<($($types),*)> LL | let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow(); | ---------------------------- in this macro invocation -error: implicit lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:55:36 +error: hidden lifetime parameters in types are deprecated + --> $DIR/hidden-lifetimes-in-types.rs:55:36 | LL | fn $fn_name(gift: &str) -> $type_name { | ^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>`