Skip to content

Commit 668f63d

Browse files
committed
Fix duplicate error messages in const_generics tests
1 parent 7a7a28d commit 668f63d

23 files changed

+42
-64
lines changed

src/test/ui/const-generics/argument_order.full.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
55
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`
66

77
error[E0747]: lifetime provided when a type was expected
8-
--> $DIR/argument_order.rs:21:23
8+
--> $DIR/argument_order.rs:20:23
99
|
1010
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
1111
| ^^^^^^^

src/test/ui/const-generics/argument_order.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
1717
| ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
1818

1919
error[E0747]: lifetime provided when a type was expected
20-
--> $DIR/argument_order.rs:21:23
20+
--> $DIR/argument_order.rs:20:23
2121
|
2222
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
2323
| ^^^^^^^

src/test/ui/const-generics/argument_order.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ struct Bad<const N: usize, T> {
1010
}
1111

1212
struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
13-
//[full]~^ ERROR lifetime parameters must be declared prior
14-
//[min]~^^ ERROR lifetime parameters must be declared prior to const parameters
15-
//[min]~^^^ ERROR type parameters must be declared prior to const parameters
13+
//~^ ERROR lifetime parameters must be declared prior
14+
//[min]~^^ ERROR type parameters must be declared prior to const parameters
1615
a: &'a T,
1716
b: &'b U,
1817
}
1918

2019
fn main() {
2120
let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
22-
//[full]~^ ERROR lifetime provided when a type was expected
23-
//[min]~^^ ERROR lifetime provided when a type was expected
21+
//~^ ERROR lifetime provided when a type was expected
2422
}

src/test/ui/const-generics/const-arg-type-arg-misordered.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
type Array<T, const N: usize> = [T; N];
77

88
fn foo<const N: usize>() -> Array<N, ()> {
9-
//[full]~^ ERROR constant provided when a type was expected
10-
//[min]~^^ ERROR constant provided when a type was expected
9+
//~^ ERROR constant provided when a type was expected
1110
unimplemented!()
1211
}
1312

src/test/ui/const-generics/const-param-before-other-params.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn bar<const X: (), 'a>(_: &'a ()) {
55
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`
66

77
error: type parameters must be declared prior to const parameters
8-
--> $DIR/const-param-before-other-params.rs:12:21
8+
--> $DIR/const-param-before-other-params.rs:11:21
99
|
1010
LL | fn foo<const X: (), T>(_: &T) {}
1111
| --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>`
@@ -20,7 +20,7 @@ LL | fn bar<const X: (), 'a>(_: &'a ()) {
2020
= note: more complex types are supported with `#[feature(const_generics)]`
2121

2222
error: `()` is forbidden as the type of a const generic parameter
23-
--> $DIR/const-param-before-other-params.rs:12:17
23+
--> $DIR/const-param-before-other-params.rs:11:17
2424
|
2525
LL | fn foo<const X: (), T>(_: &T) {}
2626
| ^^

src/test/ui/const-generics/const-param-before-other-params.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
#![cfg_attr(min, feature(min_const_generics))]
55

66
fn bar<const X: (), 'a>(_: &'a ()) {
7-
//[full]~^ ERROR lifetime parameters must be declared prior to const parameters
8-
//[min]~^^ ERROR lifetime parameters must be declared prior to const parameters
9-
//[min]~^^^ ERROR `()` is forbidden as the type of a const generic parameter
7+
//~^ ERROR lifetime parameters must be declared prior to const parameters
8+
//[min]~^^ ERROR `()` is forbidden as the type of a const generic parameter
109
}
1110

1211
fn foo<const X: (), T>(_: &T) {}

src/test/ui/const-generics/issues/issue-63322-forbid-dyn.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ struct B;
88
impl A for B {}
99

1010
fn test<const T: &'static dyn A>() {
11-
//[full]~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
12-
//[min]~^^ ERROR `&'static (dyn A + 'static)` is forbidden as the type of
13-
// a const generic parameter
14-
//[min]~| ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
11+
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
12+
//[min]~^^ ERROR `&'static (dyn A + 'static)` is forbidden
1513
unimplemented!()
1614
}
1715

src/test/ui/const-generics/issues/issue-71169.full.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
55
| ^^^ the type must not depend on the parameter `LEN`
66

77
error: constant expression depends on a generic parameter
8-
--> $DIR/issue-71169.rs:12:14
8+
--> $DIR/issue-71169.rs:11:14
99
|
1010
LL | foo::<4, DATA>();
1111
| ^^^^

src/test/ui/const-generics/issues/issue-71169.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
#![cfg_attr(min, feature(min_const_generics))]
55

66
fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
7-
//[full]~^ ERROR the type of const parameters must not
8-
//[min]~^^ ERROR the type of const parameters must not
9-
//[min]~| ERROR `[u8; _]` is forbidden as the type of a const generic parameter
7+
//~^ ERROR the type of const parameters must not
8+
//[min]~^^ ERROR `[u8; _]` is forbidden as the type of a const generic parameter
109
fn main() {
1110
const DATA: [u8; 4] = *b"ABCD";
1211
foo::<4, DATA>();

src/test/ui/const-generics/issues/issue-71381.full.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
55
| ^^^^ the type must not depend on the parameter `Args`
66

77
error[E0770]: the type of const parameters must not depend on other generic parameters
8-
--> $DIR/issue-71381.rs:26:40
8+
--> $DIR/issue-71381.rs:24:40
99
|
1010
LL | const FN: unsafe extern "C" fn(Args),
1111
| ^^^^ the type must not depend on the parameter `Args`
@@ -17,7 +17,7 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: using function pointers as const generic parameters is forbidden
20-
--> $DIR/issue-71381.rs:26:19
20+
--> $DIR/issue-71381.rs:24:19
2121
|
2222
LL | const FN: unsafe extern "C" fn(Args),
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)