diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 29a0a3c48e53f9e0683fb9b49688468e93f00e60..a53bdd3e534ac97975f6dfb0afdd8d6845ed58c2 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -828,10 +828,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, id: hir::HirId) { if let Some(def_id) = path.res.opt_def_id() { - let method_span = match path.segments { - [.., _, last] => Some(last.ident.span), - _ => None, - }; + let method_span = path.segments.last().map(|s| s.ident.span); self.tcx.check_stability(def_id, Some(id), path.span, method_span) } intravisit::walk_path(self, path) diff --git a/src/test/ui/deprecation/deprecation-lint-3.stderr b/src/test/ui/deprecation/deprecation-lint-3.stderr index c33ad1519bcc5ca4f6465682b9e7f9eb693574da..f499ff85e5da8dad7fb48d72df07d4b93b00e3d0 100644 --- a/src/test/ui/deprecation/deprecation-lint-3.stderr +++ b/src/test/ui/deprecation/deprecation-lint-3.stderr @@ -1,15 +1,14 @@ error: use of deprecated function `deprecation_lint::deprecated_text`: text - --> $DIR/deprecation-lint-3.rs:13:5 + --> $DIR/deprecation-lint-3.rs:13:28 | LL | macro_test_arg_nested!(deprecated_text); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/deprecation-lint-3.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ - = note: this error originates in the macro `macro_test_arg_nested` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/lint/lint-stability3.stderr b/src/test/ui/lint/lint-stability3.stderr index 56d4ffc4727b2e2e627f76e5d9b4bdaf4d633bea..3bbb60dd35927f38833215860d5f543762c37263 100644 --- a/src/test/ui/lint/lint-stability3.stderr +++ b/src/test/ui/lint/lint-stability3.stderr @@ -1,15 +1,14 @@ error: use of deprecated function `lint_stability::deprecated_text`: text - --> $DIR/lint-stability3.rs:13:5 + --> $DIR/lint-stability3.rs:13:28 | LL | macro_test_arg_nested!(deprecated_text); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-stability3.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ - = note: this error originates in the macro `macro_test_arg_nested` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/stability-attribute/generics-default-stability.stderr b/src/test/ui/stability-attribute/generics-default-stability.stderr index c3e3f543d7998b2f688fc298b253245a554af366..bc59844f77c8b80fee37bd70e692cdab785d7295 100644 --- a/src/test/ui/stability-attribute/generics-default-stability.stderr +++ b/src/test/ui/stability-attribute/generics-default-stability.stderr @@ -34,7 +34,7 @@ warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:83:12 | LL | let _: Struct4 = Struct4 { field: 1 }; - | ^^^^^^^^^^^^^^ + | ^^^^^^^ warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:88:12 @@ -46,7 +46,7 @@ warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:89:12 | LL | let _: Struct4 = STRUCT4; - | ^^^^^^^^^^^^^^ + | ^^^^^^^ warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:90:29 @@ -58,7 +58,7 @@ warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:90:12 | LL | let _: Struct4 = Struct4 { field: 0 }; - | ^^^^^^^^^^^^^^ + | ^^^^^^^ warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:96:29 @@ -70,7 +70,7 @@ warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:96:12 | LL | let _: Struct5 = Struct5 { field: 1 }; - | ^^^^^^^^^^^^^^ + | ^^^^^^^ warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:101:12 @@ -82,7 +82,7 @@ warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:102:12 | LL | let _: Struct5 = STRUCT5; - | ^^^^^^^^^^^^^^ + | ^^^^^^^ warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:104:29 @@ -94,7 +94,7 @@ warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:104:12 | LL | let _: Struct5 = Struct5 { field: 0 }; - | ^^^^^^^^^^^^^^ + | ^^^^^^^ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test --> $DIR/generics-default-stability.rs:159:28 @@ -106,7 +106,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test --> $DIR/generics-default-stability.rs:159:12 | LL | let _: Alias4 = Alias4::Some(1); - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test --> $DIR/generics-default-stability.rs:163:12 @@ -118,7 +118,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test --> $DIR/generics-default-stability.rs:164:12 | LL | let _: Alias4 = ALIAS4; - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test --> $DIR/generics-default-stability.rs:165:28 @@ -130,7 +130,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test --> $DIR/generics-default-stability.rs:165:12 | LL | let _: Alias4 = Alias4::Some(0); - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test --> $DIR/generics-default-stability.rs:170:28 @@ -142,7 +142,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test --> $DIR/generics-default-stability.rs:170:12 | LL | let _: Alias5 = Alias5::Some(1); - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test --> $DIR/generics-default-stability.rs:174:12 @@ -154,7 +154,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test --> $DIR/generics-default-stability.rs:175:12 | LL | let _: Alias5 = ALIAS5; - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test --> $DIR/generics-default-stability.rs:177:28 @@ -166,7 +166,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test --> $DIR/generics-default-stability.rs:177:12 | LL | let _: Alias5 = Alias5::Some(0); - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: use of deprecated variant `unstable_generic_param::Enum4::Some`: test --> $DIR/generics-default-stability.rs:231:34 @@ -178,7 +178,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum4`: test --> $DIR/generics-default-stability.rs:231:12 | LL | let _: Enum4 = Enum4::Some(1); - | ^^^^^^^^^^^^ + | ^^^^^ warning: use of deprecated enum `unstable_generic_param::Enum4`: test --> $DIR/generics-default-stability.rs:235:12 @@ -190,7 +190,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum4`: test --> $DIR/generics-default-stability.rs:236:12 | LL | let _: Enum4 = ENUM4; - | ^^^^^^^^^^^^ + | ^^^^^ warning: use of deprecated variant `unstable_generic_param::Enum4::Some`: test --> $DIR/generics-default-stability.rs:237:34 @@ -202,7 +202,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum4`: test --> $DIR/generics-default-stability.rs:237:12 | LL | let _: Enum4 = Enum4::Some(0); - | ^^^^^^^^^^^^ + | ^^^^^ warning: use of deprecated variant `unstable_generic_param::Enum5::Some`: test --> $DIR/generics-default-stability.rs:242:34 @@ -214,7 +214,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum5`: test --> $DIR/generics-default-stability.rs:242:12 | LL | let _: Enum5 = Enum5::Some(1); - | ^^^^^^^^^^^^ + | ^^^^^ warning: use of deprecated enum `unstable_generic_param::Enum5`: test --> $DIR/generics-default-stability.rs:246:12 @@ -226,7 +226,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum5`: test --> $DIR/generics-default-stability.rs:247:12 | LL | let _: Enum5 = ENUM5; - | ^^^^^^^^^^^^ + | ^^^^^ warning: use of deprecated variant `unstable_generic_param::Enum5::Some`: test --> $DIR/generics-default-stability.rs:249:34 @@ -238,7 +238,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum5`: test --> $DIR/generics-default-stability.rs:249:12 | LL | let _: Enum5 = Enum5::Some(0); - | ^^^^^^^^^^^^ + | ^^^^^ error[E0658]: use of unstable library feature 'unstable_default' --> $DIR/generics-default-stability.rs:35:20