Skip to content

Commit 1607c5f

Browse files
committed
Accept most UI test changes
Some of these are probably bad changes, but just accepting them to make it easier to see the change for now. There are also two tests that I didn't accept: one because it ICEs, and the other because the changes seem definitely wrong (passes on stable -> error).
1 parent 7c39270 commit 1607c5f

24 files changed

+64
-54
lines changed

tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ impl Wrapper<{ bar() }> {
1515

1616
fn main() {
1717
Wrapper::<function>::call;
18-
//~^ ERROR: the function or associated item `call` exists for struct `Wrapper<function>`,
1918
}

tests/ui/const-generics/bad-generic-in-copy-impl.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#[derive(Copy, Clone)]
2+
//~^ ERROR the trait `Copy` cannot be implemented for this type
23
pub struct Foo {
34
x: [u8; SIZE],
4-
//~^ ERROR mismatched types
5-
//~| ERROR mismatched types
5+
//~^ ERROR the constant `1` is not of type `usize`
6+
//~| ERROR the constant `1` is not of type `usize`
67
}
78

89
const SIZE: u32 = 1;

tests/ui/const-generics/bad-generic-in-copy-impl.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: the constant `1` is not of type `usize`
2-
--> $DIR/bad-generic-in-copy-impl.rs:3:8
2+
--> $DIR/bad-generic-in-copy-impl.rs:4:8
33
|
44
LL | x: [u8; SIZE],
55
| ^^^^^^^^^^ expected `usize`, found `u32`
@@ -9,23 +9,23 @@ error[E0204]: the trait `Copy` cannot be implemented for this type
99
|
1010
LL | #[derive(Copy, Clone)]
1111
| ^^^^
12-
LL | pub struct Foo {
12+
...
1313
LL | x: [u8; SIZE],
1414
| ------------- this field does not implement `Copy`
1515
|
1616
note: the `Copy` impl for `[u8; 1]` requires that `the constant `1` has type `usize``
17-
--> $DIR/bad-generic-in-copy-impl.rs:3:8
17+
--> $DIR/bad-generic-in-copy-impl.rs:4:8
1818
|
1919
LL | x: [u8; SIZE],
2020
| ^^^^^^^^^^
2121
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
2222

2323
error: the constant `1` is not of type `usize`
24-
--> $DIR/bad-generic-in-copy-impl.rs:3:5
24+
--> $DIR/bad-generic-in-copy-impl.rs:4:5
2525
|
2626
LL | #[derive(Copy, Clone)]
2727
| ----- in this derive macro expansion
28-
LL | pub struct Foo {
28+
...
2929
LL | x: [u8; SIZE],
3030
| ^^^^^^^^^^^^^ expected `usize`, found `u32`
3131
|

tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
77
= note: const parameters may not be used in the type of const parameters
88

99
error[E0770]: the type of const parameters must not depend on other generic parameters
10-
--> $DIR/const-param-type-depends-on-const-param.rs:15:40
10+
--> $DIR/const-param-type-depends-on-const-param.rs:14:40
1111
|
1212
LL | pub struct SelfDependent<const N: [u8; N]>;
1313
| ^ the type must not depend on the parameter `N`

tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
77
= note: const parameters may not be used in the type of const parameters
88

99
error[E0770]: the type of const parameters must not depend on other generic parameters
10-
--> $DIR/const-param-type-depends-on-const-param.rs:15:40
10+
--> $DIR/const-param-type-depends-on-const-param.rs:14:40
1111
|
1212
LL | pub struct SelfDependent<const N: [u8; N]>;
1313
| ^ the type must not depend on the parameter `N`

tests/ui/const-generics/const-param-type-depends-on-const-param.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010

1111
pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
1212
//~^ ERROR: the type of const parameters must not depend on other generic parameters
13-
//[min]~^^ ERROR `[u8; N]` is forbidden
1413

1514
pub struct SelfDependent<const N: [u8; N]>;
1615
//~^ ERROR: the type of const parameters must not depend on other generic parameters
17-
//[min]~^^ ERROR `[u8; N]` is forbidden
1816

1917
fn main() {}

tests/ui/const-generics/fn-const-param-infer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() {
3232
let _ = Checked::<{ generic_arg::<usize> }>;
3333
let _ = Checked::<{ generic_arg::<u32> }>; //~ ERROR: mismatched types
3434

35-
let _ = Checked::<generic>; //~ ERROR: type annotations needed
35+
let _ = Checked::<generic>;
3636
let _ = Checked::<{ generic::<u16> }>;
3737
let _: Checked<{ generic::<u16> }> = Checked::<{ generic::<u16> }>;
3838
let _: Checked<{ generic::<u32> }> = Checked::<{ generic::<u16> }>;

tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
struct U;
88

99
struct S<const N: U>()
10+
//~^ ERROR: `U` must implement `ConstParamTy` to be used as the type of a const generic parameter
1011
where
1112
S<{ U }>:;
12-
//~^ ERROR: overflow evaluating the requirement `S<{ U }> well-formed`
1313

1414
fn main() {}

tests/ui/const-generics/generic_const_exprs/error_in_ty.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55

66
pub struct A<const z: [usize; x]> {}
77
//~^ ERROR: cannot find value `x` in this scope
8-
//~| ERROR: `[usize; x]` is forbidden as the type of a const generic parameter
98

109
impl A<2> {
11-
//~^ ERROR: mismatched types
1210
pub const fn B() {}
1311
//~^ ERROR: duplicate definitions
1412
}
1513

1614
impl A<2> {
17-
//~^ ERROR: mismatched types
1815
pub const fn B() {}
1916
}
2017

tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | pub struct A<const z: [usize; x]> {}
77
| similarly named const parameter `z` defined here
88

99
error[E0592]: duplicate definitions with name `B`
10-
--> $DIR/error_in_ty.rs:12:5
10+
--> $DIR/error_in_ty.rs:10:5
1111
|
1212
LL | pub const fn B() {}
1313
| ^^^^^^^^^^^^^^^^ duplicate definitions for `B`

tests/ui/const-generics/generic_const_exprs/type-alias-bounds.neg.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
error[E0277]: the trait bound `String: Copy` is not satisfied
2-
--> $DIR/type-alias-bounds.rs:31:12
2+
--> $DIR/type-alias-bounds.rs:30:12
33
|
44
LL | let _: AliasConstUnused;
55
| ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
66
|
77
note: required by a bound in `ct_unused_1::AliasConstUnused`
8-
--> $DIR/type-alias-bounds.rs:29:41
8+
--> $DIR/type-alias-bounds.rs:28:41
99
|
1010
LL | type AliasConstUnused where String: Copy = I32<{ 0; 0 }>;
1111
| ^^^^ required by this bound in `AliasConstUnused`
1212

1313
error[E0277]: the trait bound `String: Copy` is not satisfied
14-
--> $DIR/type-alias-bounds.rs:39:12
14+
--> $DIR/type-alias-bounds.rs:38:12
1515
|
1616
LL | let _: AliasFnUnused<String>;
1717
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
1818
|
1919
note: required by a bound in `AliasFnUnused`
20-
--> $DIR/type-alias-bounds.rs:36:27
20+
--> $DIR/type-alias-bounds.rs:35:27
2121
|
2222
LL | type AliasFnUnused<T: Copy> = (T, I32<{ code() }>);
2323
| ^^^^ required by this bound in `AliasFnUnused`
2424

2525
error[E0277]: the trait bound `String: Copy` is not satisfied
26-
--> $DIR/type-alias-bounds.rs:57:12
26+
--> $DIR/type-alias-bounds.rs:56:12
2727
|
2828
LL | let _: AliasAssocConstUsed<String>;
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
3030
|
3131
note: required by a bound in `AliasAssocConstUsed`
32-
--> $DIR/type-alias-bounds.rs:55:41
32+
--> $DIR/type-alias-bounds.rs:54:41
3333
|
3434
LL | type AliasAssocConstUsed<T: Trait + Copy> = I32<{ T::DATA }>;
3535
| ^^^^ required by this bound in `AliasAssocConstUsed`
3636

3737
error[E0277]: the trait bound `String: Copy` is not satisfied
38-
--> $DIR/type-alias-bounds.rs:65:12
38+
--> $DIR/type-alias-bounds.rs:64:12
3939
|
4040
LL | let _: AliasFnUsed<String>;
4141
| ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
4242
|
4343
note: required by a bound in `AliasFnUsed`
44-
--> $DIR/type-alias-bounds.rs:62:33
44+
--> $DIR/type-alias-bounds.rs:61:33
4545
|
4646
LL | type AliasFnUsed<T: Trait + Copy> = I32<{ code::<T>() }>;
4747
| ^^^^ required by this bound in `AliasFnUsed`

tests/ui/const-generics/generic_const_exprs/type-alias-bounds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fn ct_unused_0() {
2121
const DATA: i32 = 0;
2222
#[cfg(neg)]
2323
let _: AliasConstUnused<String>;
24-
//[neg]~^ ERROR the trait bound `String: Copy` is not satisfied
2524
}
2625

2726
fn ct_unused_1() {

tests/ui/const-generics/issue-97007.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ check-pass
2-
31
#![feature(adt_const_params, generic_const_exprs)]
42
#![allow(incomplete_features)]
53

@@ -54,6 +52,7 @@ mod lib {
5452
pub fn proceed_to<const NEXT: usize>(
5553
self,
5654
) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
55+
//~^ ERROR cycle detected when building an abstract representation for
5756
Walk { _p: () }
5857
}
5958
}
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error[E0391]: cycle detected when building an abstract representation for `lib::<impl at $DIR/issue-97007.rs:51:5: 51:81>::proceed_to::{constant#0}`
2+
--> $DIR/issue-97007.rs:54:25
3+
|
4+
LL | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: ...which requires building THIR for `lib::<impl at $DIR/issue-97007.rs:51:5: 51:81>::proceed_to::{constant#0}`...
8+
--> $DIR/issue-97007.rs:54:25
9+
|
10+
LL | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
note: ...which requires type-checking `lib::<impl at $DIR/issue-97007.rs:51:5: 51:81>::proceed_to::{constant#0}`...
13+
--> $DIR/issue-97007.rs:54:25
14+
|
15+
LL | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
= note: ...which again requires building an abstract representation for `lib::<impl at $DIR/issue-97007.rs:51:5: 51:81>::proceed_to::{constant#0}`, completing the cycle
18+
note: cycle used when checking that `lib::<impl at $DIR/issue-97007.rs:51:5: 51:81>::proceed_to` is well-formed
19+
--> $DIR/issue-97007.rs:52:9
20+
|
21+
LL | / pub fn proceed_to<const NEXT: usize>(
22+
LL | | self,
23+
LL | | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
24+
| |___________________________________________________________^
25+
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
26+
27+
error: aborting due to 1 previous error
28+
29+
For more information about this error, try `rustc --explain E0391`.

tests/ui/const-generics/issues/issue-62878.min.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {}
77
= note: const parameters may not be used in the type of const parameters
88

99
error[E0747]: type provided when a constant was expected
10-
--> $DIR/issue-62878.rs:10:11
10+
--> $DIR/issue-62878.rs:9:11
1111
|
1212
LL | foo::<_, { [1] }>();
1313
| ^

tests/ui/const-generics/issues/issue-62878.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
fn foo<const N: usize, const A: [u8; N]>() {}
66
//~^ ERROR the type of const parameters must not
7-
//[min]~| ERROR `[u8; N]` is forbidden as the type of a const generic parameter
87

98
fn main() {
109
foo::<_, { [1] }>();

tests/ui/const-generics/issues/issue-71169.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

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

tests/ui/const-generics/not_wf_param_in_rpitit.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ trait Trait<const N: dyn Trait = bar> {
55
//~| ERROR: cycle detected when computing type of `Trait::N`
66
//~| ERROR: the trait `Trait` cannot be made into an object
77
//~| ERROR: the trait `Trait` cannot be made into an object
8-
//~| ERROR: the trait `Trait` cannot be made into an object
98
async fn a() {}
109
}
1110

tests/ui/const-generics/not_wf_param_in_rpitit.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
2626
|
2727
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
28-
--> $DIR/not_wf_param_in_rpitit.rs:9:14
28+
--> $DIR/not_wf_param_in_rpitit.rs:8:14
2929
|
3030
LL | trait Trait<const N: dyn Trait = bar> {
3131
| ----- this trait cannot be made into an object...
@@ -48,7 +48,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
4949
|
5050
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
51-
--> $DIR/not_wf_param_in_rpitit.rs:9:14
51+
--> $DIR/not_wf_param_in_rpitit.rs:8:14
5252
|
5353
LL | trait Trait<const N: dyn Trait = bar> {
5454
| ----- this trait cannot be made into an object...

tests/ui/consts/const-len-underflow-separate-spans.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ const LEN: usize = ONE - TWO;
1212

1313
fn main() {
1414
let a: [i8; LEN] = unimplemented!();
15-
//~^ constant
1615
}

tests/ui/consts/issue-39974.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const LENGTH: f64 = 2;
33

44
struct Thing {
55
f: [[f64; 2]; LENGTH],
6-
//~^ ERROR mismatched types
7-
//~| expected `usize`, found `f64`
86
}
97

108
fn main() {

tests/ui/issues/issue-27008.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ struct S;
22

33
fn main() {
44
let b = [0; S];
5-
//~^ ERROR mismatched types
5+
//~^ ERROR the constant `S` is not of type `usize`
66
//~| expected `usize`, found `S`
77
}

tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs

-6
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ trait Trait<const N: Trait = bar> {
33
//~| ERROR cycle detected when computing type of `Trait::N`
44
//~| ERROR the trait `Trait` cannot be made into an object
55
//~| ERROR the trait `Trait` cannot be made into an object
6-
//~| ERROR the trait `Trait` cannot be made into an object
7-
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
8-
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
96
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
107
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
118
fn fnc<const N: Trait = u32>(&self) -> Trait {
129
//~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
1310
//~| ERROR expected value, found builtin type `u32`
1411
//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
1512
//~| ERROR associated item referring to unboxed trait object for its own trait
16-
//~| ERROR the trait `Trait` cannot be made into an object
17-
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
18-
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
1913
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
2014
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
2115
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]

0 commit comments

Comments
 (0)