Skip to content

Commit db9b8ce

Browse files
committed
update tests
1 parent 69d2d73 commit db9b8ce

File tree

69 files changed

+48
-215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+48
-215
lines changed

src/test/incremental/const-generics/hash-tyvid-regression-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// revisions: cfail
2-
#![feature(generic_const_exprs, adt_const_params, const_generics_defaults)]
2+
#![feature(generic_const_exprs, adt_const_params)]
33
#![allow(incomplete_features)]
44
// regression test for #77650
55
struct C<T, const N: core::num::NonZeroUsize>([T; N.get()])

src/test/rustdoc/const-generics/const-generic-defaults.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![crate_name = "foo"]
2-
#![feature(const_generics_defaults)]
32

43
// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \
54
// 'pub struct Foo<const M: usize = 10_usize, const N: usize = M, T = i32>(_);'

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

Lines changed: 0 additions & 30 deletions
This file was deleted.

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
// revisions: full min
2-
#![cfg_attr(full, feature(const_generics_defaults))]
3-
41
struct Bad<const N: usize, T> {
5-
//[min]~^ ERROR type parameters must be declared prior to const parameters
62
arr: [u8; { N }],
73
another: T,
84
}
95

106
struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
117
//~^ ERROR lifetime parameters must be declared prior
12-
//[min]~^^ ERROR type parameters must be declared prior to const parameters
138
a: &'a T,
149
b: &'b U,
1510
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: lifetime parameters must be declared prior to const parameters
2-
--> $DIR/argument_order.rs:10:32
2+
--> $DIR/argument_order.rs:6:32
33
|
44
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:18:23
8+
--> $DIR/argument_order.rs:13:23
99
|
1010
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
1111
| ^^^^^^^

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ error[E0747]: constant provided when a type was expected
33
|
44
LL | fn foo<const N: usize>() -> Array<N, ()> {
55
| ^
6-
|
7-
= note: type arguments must be provided before constant arguments
8-
= help: reorder the arguments: types, then consts: `<T, N>`
96

107
error: aborting due to previous error
118

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

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
// revisions: full min
2-
#![cfg_attr(full, feature(const_generics_defaults))]
3-
#![cfg_attr(full, allow(incomplete_features))]
4-
51
fn bar<const X: u8, 'a>(_: &'a ()) {
62
//~^ ERROR lifetime parameters must be declared prior to const parameters
73
}
84

95
fn foo<const X: u8, T>(_: &T) {}
10-
//[min]~^ ERROR type parameters must be declared prior to const parameters
116

127
fn main() {}

src/test/ui/const-generics/const-param-before-other-params.full.stderr renamed to src/test/ui/const-generics/const-param-before-other-params.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime parameters must be declared prior to const parameters
2-
--> $DIR/const-param-before-other-params.rs:5:21
2+
--> $DIR/const-param-before-other-params.rs:1:21
33
|
44
LL | fn bar<const X: u8, 'a>(_: &'a ()) {
55
| --------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const X: u8>`

src/test/ui/const-generics/defaults/auxiliary/const_defaulty.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_generics_defaults)]
2-
31
pub struct Defaulted<const N: usize=3>;
42
impl Defaulted {
53
pub fn new() -> Self {

src/test/ui/const-generics/defaults/complex-generic-default-expr.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: generic parameters may not be used in const operations
2-
--> $DIR/complex-generic-default-expr.rs:7:47
2+
--> $DIR/complex-generic-default-expr.rs:6:47
33
|
44
LL | struct Foo<const N: usize, const M: usize = { N + 1 }>;
55
| ^ cannot perform const operation using `N`
@@ -8,7 +8,7 @@ LL | struct Foo<const N: usize, const M: usize = { N + 1 }>;
88
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations
11-
--> $DIR/complex-generic-default-expr.rs:10:62
11+
--> $DIR/complex-generic-default-expr.rs:9:62
1212
|
1313
LL | struct Bar<T, const TYPE_SIZE: usize = { std::mem::size_of::<T>() }>(T);
1414
| ^ cannot perform const operation using `T`

src/test/ui/const-generics/defaults/complex-generic-default-expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// revisions: full min
22
//[full] check-pass
33
#![cfg_attr(full, feature(generic_const_exprs))]
4-
#![feature(const_generics_defaults)]
5-
#![allow(incomplete_features)]
4+
#![cfg_attr(full, allow(incomplete_features))]
65

76
struct Foo<const N: usize, const M: usize = { N + 1 }>;
87
//[min]~^ ERROR generic parameters may not be used in const operations

src/test/ui/const-generics/defaults/complex-unord-param.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
// [full] run-pass
2-
// revisions: full min
1+
// run-pass
32
// Checks a complicated usage of unordered params
4-
#![cfg_attr(full, feature(const_generics_defaults))]
5-
#![cfg_attr(full, allow(incomplete_features))]
63
#![allow(dead_code)]
74

85
struct NestedArrays<'a, const N: usize, A: 'a, const M: usize, T:'a =u32> {
9-
//[min]~^ ERROR type parameters must be declared prior to const parameters
106
args: &'a [&'a [T; M]; N],
117
specifier: A,
128
}

src/test/ui/const-generics/defaults/const-default.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// run-pass
2-
#![feature(const_generics_defaults)]
3-
42
pub struct ConstDefault<const N: usize = 3>;
53

64
impl<const N: usize> ConstDefault<N> {

src/test/ui/const-generics/defaults/const-param-as-default-value.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
#![feature(const_generics_defaults)]
32
struct Foo<const N: usize, const M: usize = N>([u8; N], [u8; M]);
43

54
fn foo<const N: usize>() -> Foo<N> {

src/test/ui/const-generics/defaults/const-param-in-ty-defaults.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
#![feature(const_generics_defaults)]
32
struct Foo<const N: usize, T = [u8; N]>(T);
43

54
impl<const N: usize> Foo<N> {

src/test/ui/const-generics/defaults/default-annotation.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![feature(staged_api)]
3-
#![feature(const_generics_defaults)]
43
#![allow(incomplete_features)]
54
// FIXME(const_generics_defaults): It seems like we aren't testing the right thing here,
65
// I would assume that we want the attributes to apply to the const parameter defaults

src/test/ui/const-generics/defaults/default-const-param-cannot-reference-self.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_generics_defaults)]
2-
31
struct Struct<const N: usize = { Self; 10 }>;
42
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
53

src/test/ui/const-generics/defaults/default-const-param-cannot-reference-self.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0735]: generic parameters cannot use `Self` in their defaults
2-
--> $DIR/default-const-param-cannot-reference-self.rs:3:34
2+
--> $DIR/default-const-param-cannot-reference-self.rs:1:34
33
|
44
LL | struct Struct<const N: usize = { Self; 10 }>;
55
| ^^^^ `Self` in generic parameter default
66

77
error[E0735]: generic parameters cannot use `Self` in their defaults
8-
--> $DIR/default-const-param-cannot-reference-self.rs:6:30
8+
--> $DIR/default-const-param-cannot-reference-self.rs:4:30
99
|
1010
LL | enum Enum<const N: usize = { Self; 10 }> { }
1111
| ^^^^ `Self` in generic parameter default
1212

1313
error[E0735]: generic parameters cannot use `Self` in their defaults
14-
--> $DIR/default-const-param-cannot-reference-self.rs:9:32
14+
--> $DIR/default-const-param-cannot-reference-self.rs:7:32
1515
|
1616
LL | union Union<const N: usize = { Self; 10 }> { not_empty: () }
1717
| ^^^^ `Self` in generic parameter default

src/test/ui/const-generics/defaults/default-on-impl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_generics_defaults)]
2-
31
struct Foo<const N: usize>;
42

53
impl<const N: usize = 1> Foo<N> {}

src/test/ui/const-generics/defaults/default-on-impl.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
2-
--> $DIR/default-on-impl.rs:5:12
2+
--> $DIR/default-on-impl.rs:3:12
33
|
44
LL | impl<const N: usize = 1> Foo<N> {}
55
| ^
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_generics_defaults)]
21
struct Foo<const N: u8 = { 255 + 1 }>;
32
//~^ ERROR evaluation of constant value failed
43
fn main() {}

src/test/ui/const-generics/defaults/default-param-wf-concrete.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/default-param-wf-concrete.rs:2:28
2+
--> $DIR/default-param-wf-concrete.rs:1:28
33
|
44
LL | struct Foo<const N: u8 = { 255 + 1 }>;
55
| ^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow

src/test/ui/const-generics/defaults/doesnt_infer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_generics_defaults)]
2-
31
// test that defaulted const params are not used to help type inference
42

53
struct Foo<const N: u32 = 2>;

src/test/ui/const-generics/defaults/doesnt_infer.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0282]: type annotations needed for `Foo<{_: u32}>`
2-
--> $DIR/doesnt_infer.rs:13:15
2+
--> $DIR/doesnt_infer.rs:11:15
33
|
44
LL | let foo = Foo::foo();
55
| --- ^^^^^^^^ cannot infer the value of const parameter `N`

src/test/ui/const-generics/defaults/external.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// aux-build:const_defaulty.rs
22
// check-pass
3-
#![feature(const_generics_defaults)]
4-
53
extern crate const_defaulty;
64
use const_defaulty::Defaulted;
75

src/test/ui/const-generics/defaults/forward-declared.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_generics_defaults)]
2-
31
struct Foo<const N: usize = M, const M: usize = 10>;
42
//~^ ERROR generic parameters with a default cannot use forward declared identifiers
53

src/test/ui/const-generics/defaults/forward-declared.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error[E0128]: generic parameters with a default cannot use forward declared identifiers
2-
--> $DIR/forward-declared.rs:3:29
2+
--> $DIR/forward-declared.rs:1:29
33
|
44
LL | struct Foo<const N: usize = M, const M: usize = 10>;
55
| ^ defaulted generic parameters cannot be forward declared
66

77
error[E0128]: generic parameters with a default cannot use forward declared identifiers
8-
--> $DIR/forward-declared.rs:6:27
8+
--> $DIR/forward-declared.rs:4:27
99
|
1010
LL | enum Bar<const N: usize = M, const M: usize = 10> {}
1111
| ^ defaulted generic parameters cannot be forward declared
1212

1313
error[E0128]: generic parameters with a default cannot use forward declared identifiers
14-
--> $DIR/forward-declared.rs:9:30
14+
--> $DIR/forward-declared.rs:7:30
1515
|
1616
LL | struct Foo2<const N: usize = N>;
1717
| ^ defaulted generic parameters cannot be forward declared
1818

1919
error[E0128]: generic parameters with a default cannot use forward declared identifiers
20-
--> $DIR/forward-declared.rs:12:28
20+
--> $DIR/forward-declared.rs:10:28
2121
|
2222
LL | enum Bar2<const N: usize = N> {}
2323
| ^ defaulted generic parameters cannot be forward declared

src/test/ui/const-generics/defaults/generic-expr-default-concrete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_const_exprs, const_generics_defaults)]
1+
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

44
struct Foo<const N: usize, const M: usize = { N + 1 }>;

src/test/ui/const-generics/defaults/generic-expr-default-mismatched-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_const_exprs, const_generics_defaults)]
1+
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

44
struct Foo<const N: usize, const M: usize = { N + 1 }>;

src/test/ui/const-generics/defaults/generic-expr-default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_const_exprs, const_generics_defaults)]
1+
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

44
pub struct Foo<const N: usize, const M: usize = { N + 1 }>;

src/test/ui/const-generics/defaults/intermixed-lifetime.min.stderr

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/test/ui/const-generics/defaults/intermixed-lifetime.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// Checks that lifetimes cannot be interspersed between consts and types.
2-
// revisions: full min
3-
#![feature(const_generics_defaults)]
42

53
struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
64
//~^ Error lifetime parameters must be declared prior to const parameters

src/test/ui/const-generics/defaults/intermixed-lifetime.full.stderr renamed to src/test/ui/const-generics/defaults/intermixed-lifetime.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: lifetime parameters must be declared prior to const parameters
2-
--> $DIR/intermixed-lifetime.rs:5:28
2+
--> $DIR/intermixed-lifetime.rs:3:28
33
|
44
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
55
| -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>`
66

77
error: lifetime parameters must be declared prior to type parameters
8-
--> $DIR/intermixed-lifetime.rs:8:37
8+
--> $DIR/intermixed-lifetime.rs:6:37
99
|
1010
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
1111
| --------------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>`

src/test/ui/const-generics/defaults/mismatch.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_generics_defaults)]
2-
31
pub struct Example<const N: usize=13>;
42
pub struct Example2<T=u32, const N: usize=13>(T);
53
pub struct Example3<const N: usize=13, T=u32>(T);

0 commit comments

Comments
 (0)