From 5db69074988b0edf6751192336398d0673ee81a2 Mon Sep 17 00:00:00 2001 From: lcnr Date: Fri, 9 Sep 2022 14:28:57 +0200 Subject: [PATCH] review --- compiler/rustc_ast/src/ast.rs | 2 +- src/test/ui/const-generics/argument_order.stderr | 4 ++-- .../const-generics/const-param-before-other-params.rs | 2 +- .../const-param-before-other-params.stderr | 2 +- .../ui/const-generics/defaults/intermixed-lifetime.rs | 4 ++-- .../const-generics/defaults/intermixed-lifetime.stderr | 4 ++-- .../defaults/param-order-err-pretty-prints-default.rs | 2 +- .../param-order-err-pretty-prints-default.stderr | 2 +- src/test/ui/generics/issue-59508-1.rs | 2 +- src/test/ui/generics/issue-59508-1.stderr | 2 +- src/test/ui/generics/issue-59508.fixed | 2 +- src/test/ui/generics/issue-59508.rs | 2 +- src/test/ui/generics/issue-59508.stderr | 2 +- .../issue-80512-param-reordering-with-defaults.rs | 2 +- .../issue-80512-param-reordering-with-defaults.stderr | 2 +- src/test/ui/generics/lifetime-before-type-params.rs | 8 ++++---- .../ui/generics/lifetime-before-type-params.stderr | 8 ++++---- src/test/ui/parser/issues/issue-14303.rs | 10 +++++----- src/test/ui/parser/issues/issue-14303.stderr | 10 +++++----- src/test/ui/suggestions/suggest-move-lifetimes.stderr | 8 ++++---- src/test/ui/suggestions/suggest-move-types.stderr | 4 ++-- 21 files changed, 42 insertions(+), 42 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 6c7670378fd4f..75cc5b72582e1 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -333,7 +333,7 @@ impl fmt::Display for ParamKindOrd { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ParamKindOrd::Lifetime => "lifetime".fmt(f), - ParamKindOrd::TypeOrConst => "type or const".fmt(f), + ParamKindOrd::TypeOrConst => "type and const".fmt(f), } } } diff --git a/src/test/ui/const-generics/argument_order.stderr b/src/test/ui/const-generics/argument_order.stderr index a3a54b497a76e..99122c6f5e362 100644 --- a/src/test/ui/const-generics/argument_order.stderr +++ b/src/test/ui/const-generics/argument_order.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/argument_order.rs:6:32 | LL | struct AlsoBad { @@ -11,7 +11,7 @@ LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>; | ^^^^^^^ | = note: lifetime arguments must be provided before type arguments - = help: reorder the arguments: lifetimes, then type or consts: `<'a, 'b, N, T, M, U>` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, N, T, M, U>` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs index b481000bb7f57..cb1cebe1f68a1 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.rs +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -1,5 +1,5 @@ fn bar(_: &'a ()) { - //~^ ERROR lifetime parameters must be declared prior to type or const parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters } fn foo(_: &T) {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr index 049c58ba4fae8..2c7a47bbc78cd 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.stderr +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/const-param-before-other-params.rs:1:21 | LL | fn bar(_: &'a ()) { diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.rs b/src/test/ui/const-generics/defaults/intermixed-lifetime.rs index 9e4a32121bb38..beaf7fc6001a9 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.rs +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.rs @@ -1,9 +1,9 @@ // Checks that lifetimes cannot be interspersed between consts and types. struct Foo(&'a (), T); -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters struct Bar(&'a (), T); -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr b/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr index b8aa18c942bc9..5cff61dd9fb91 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr @@ -1,10 +1,10 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:3:28 | LL | struct Foo(&'a (), T); | -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:6:37 | LL | struct Bar(&'a (), T); diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs index ae897e59a9742..f928fc9e75b73 100644 --- a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs @@ -1,4 +1,4 @@ struct Foo(&'a u32); -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr index b4bfc5410390d..ba08b4646d0f4 100644 --- a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/param-order-err-pretty-prints-default.rs:1:33 | LL | struct Foo(&'a u32); diff --git a/src/test/ui/generics/issue-59508-1.rs b/src/test/ui/generics/issue-59508-1.rs index 646ece33ca341..8e27749e8fc6b 100644 --- a/src/test/ui/generics/issue-59508-1.rs +++ b/src/test/ui/generics/issue-59508-1.rs @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type or const parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508-1.stderr b/src/test/ui/generics/issue-59508-1.stderr index 1ca99c6ab76cd..1c510044f806f 100644 --- a/src/test/ui/generics/issue-59508-1.stderr +++ b/src/test/ui/generics/issue-59508-1.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508-1.rs:10:25 | LL | pub fn do_things() { diff --git a/src/test/ui/generics/issue-59508.fixed b/src/test/ui/generics/issue-59508.fixed index 557bcc1f716cd..de8f47d4cff89 100644 --- a/src/test/ui/generics/issue-59508.fixed +++ b/src/test/ui/generics/issue-59508.fixed @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things<'a, 'b: 'a, T>() { - //~^ ERROR lifetime parameters must be declared prior to type or const parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508.rs b/src/test/ui/generics/issue-59508.rs index 0b290a6085f96..a4c7d4ff26266 100644 --- a/src/test/ui/generics/issue-59508.rs +++ b/src/test/ui/generics/issue-59508.rs @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type or const parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508.stderr b/src/test/ui/generics/issue-59508.stderr index e8926c13a1132..fd23b6276f92b 100644 --- a/src/test/ui/generics/issue-59508.stderr +++ b/src/test/ui/generics/issue-59508.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508.rs:10:25 | LL | pub fn do_things() { diff --git a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs index 598f95d9a0bae..0e208818ed459 100644 --- a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs +++ b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs @@ -1,4 +1,4 @@ #![crate_type = "lib"] struct S(&'a T); -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters diff --git a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr index 69680a8010194..70793a9c92084 100644 --- a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr +++ b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-80512-param-reordering-with-defaults.rs:3:18 | LL | struct S(&'a T); diff --git a/src/test/ui/generics/lifetime-before-type-params.rs b/src/test/ui/generics/lifetime-before-type-params.rs index 4904ae61caaf1..d64b1b0b44f65 100644 --- a/src/test/ui/generics/lifetime-before-type-params.rs +++ b/src/test/ui/generics/lifetime-before-type-params.rs @@ -1,11 +1,11 @@ #![allow(unused)] fn first() {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn second<'a, T, 'b>() {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn third() {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn fourth<'a, T, 'b, U, 'c, V>() {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/generics/lifetime-before-type-params.stderr b/src/test/ui/generics/lifetime-before-type-params.stderr index 7bb4f826409bc..84825eb4ceb21 100644 --- a/src/test/ui/generics/lifetime-before-type-params.stderr +++ b/src/test/ui/generics/lifetime-before-type-params.stderr @@ -1,22 +1,22 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:2:13 | LL | fn first() {} | ----^^--^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:4:18 | LL | fn second<'a, T, 'b>() {} | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:6:16 | LL | fn third() {} | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:8:18 | LL | fn fourth<'a, T, 'b, U, 'c, V>() {} diff --git a/src/test/ui/parser/issues/issue-14303.rs b/src/test/ui/parser/issues/issue-14303.rs index e44b57746605e..82850d77aa921 100644 --- a/src/test/ui/parser/issues/issue-14303.rs +++ b/src/test/ui/parser/issues/issue-14303.rs @@ -1,22 +1,22 @@ enum Enum<'a, T, 'b> { -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters A(&'a &'b T) } struct Struct<'a, T, 'b> { -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters x: &'a &'b T } trait Trait<'a, T, 'b> {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn foo<'a, T, 'b>(x: &'a T) {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters struct Y(T); impl<'a, T, 'b> Y {} -//~^ ERROR lifetime parameters must be declared prior to type or const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters mod bar { pub struct X<'a, 'b, 'c, T> { diff --git a/src/test/ui/parser/issues/issue-14303.stderr b/src/test/ui/parser/issues/issue-14303.stderr index 3579159245ac6..f121107c0958f 100644 --- a/src/test/ui/parser/issues/issue-14303.stderr +++ b/src/test/ui/parser/issues/issue-14303.stderr @@ -1,28 +1,28 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:1:18 | LL | enum Enum<'a, T, 'b> { | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:6:22 | LL | struct Struct<'a, T, 'b> { | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:11:20 | LL | trait Trait<'a, T, 'b> {} | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:14:15 | LL | fn foo<'a, T, 'b>(x: &'a T) {} | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-14303.rs:18:13 | LL | impl<'a, T, 'b> Y {} diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index f7ff3697e1dac..b1a49447d4601 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -1,22 +1,22 @@ -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | LL | struct A { | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | LL | struct B { | ----^^---- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | LL | struct C { | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type or const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | LL | struct D { diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index 3037b7f92ed64..b222e8142bab5 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -121,7 +121,7 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, 'c, T, U, V>` error[E0747]: lifetime provided when a type was expected --> $DIR/suggest-move-types.rs:82:56 @@ -130,7 +130,7 @@ LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, 'c, T, U, V>` error: aborting due to 12 previous errors