Skip to content

Commit b4ee995

Browse files
committed
modify error comment and bless test, delete tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs
1 parent 8af02e2 commit b4ee995

22 files changed

Lines changed: 158 additions & 137 deletions

tests/crashes/133966.rs

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

tests/ui/const-generics/adt_const_params/byte-string-u8-validation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ struct ConstBytes<const T: &'static [*mut u8; 3]>
99
//~^ ERROR rustc_dump_predicates
1010
//~| NOTE Binder { value: ConstArgHasType(T/#0, &'static [*mut u8; 3_usize]), bound_vars: [] }
1111
//~| NOTE Binder { value: TraitPredicate(<ConstBytes<b"AAA"> as std::marker::Sized>, polarity:Positive), bound_vars: [] }
12+
1213
where
1314
ConstBytes<b"AAA">: Sized;
1415
//~^ ERROR mismatched types
1516
//~| NOTE expected `&[*mut u8; 3]`, found `&[u8; 3]`
1617
//~| NOTE expected reference `&'static [*mut u8; 3]`
18+
//~| NOTE found reference `&'static [u8; 3]`
1719

1820
fn main() {}

tests/ui/const-generics/adt_const_params/byte-string-u8-validation.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/byte-string-u8-validation.rs:13:16
2+
--> $DIR/byte-string-u8-validation.rs:14:16
33
|
44
LL | ConstBytes<b"AAA">: Sized;
55
| ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`

tests/ui/const-generics/generic_const_exprs/issue-105257.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#![expect(incomplete_features)]
33

44
trait Trait<T> {
5-
fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for generic parameters are not allowed here
6-
//~^ ERROR: mismatched types
7-
fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for generic parameters are not allowed here
5+
fn fnc<const N: usize = "">(&self) {} //~ ERROR defaults for generic parameters are not allowed here
6+
//~^ ERROR mismatched types
7+
fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ ERROR defaults for generic parameters are not allowed here
88
}
99

1010
fn main() {}

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

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

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

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Regression test for <https://github.com/rust-lang/rust/issues/150983>
22
#![expect(incomplete_features)]
33
#![feature(
4+
adt_const_params,
45
generic_const_items,
56
generic_const_parameter_types,
67
min_generic_const_args,
@@ -12,9 +13,7 @@ struct Foo<T> {
1213
field: T,
1314
}
1415

15-
#[type_const]
16-
const WRAP<T : ConstParamTy_> : T = {
17-
Foo::<T>{field : 1} //~ ERROR: type annotations needed for the literal
18-
};
16+
type const WRAP<T : ConstParamTy_> : T = Foo::<T>{field : 1};
17+
//~^ ERROR: type annotations needed for the literal
1918

2019
fn main() {}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: type annotations needed for the literal
2-
--> $DIR/generic_const_type_mismatch.rs:17:22
2+
--> $DIR/generic_const_type_mismatch.rs:16:59
33
|
4-
LL | Foo::<T>{field : 1}
5-
| ^
4+
LL | type const WRAP<T : ConstParamTy_> : T = Foo::<T>{field : 1};
5+
| ^
66

77
error: aborting due to 1 previous error
88

tests/ui/const-generics/mgca/tuple_expr_type_mismatch.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ fn qux<const Z: (char, i32)>() {}
1212
fn main() {
1313
foo::<{ (1, true) }>();
1414
//~^ ERROR: type annotations needed for the literal
15-
//~| ERROR: mismatched types: expected `i32`, found `bool`
1615
bar::<{ (1_u32, [1, 2]) }>();
1716
//~^ ERROR: expected `i32`, found const array
18-
//~| ERROR: mismatched types: expected `[u8; 2]`, found `u32`
1917
qux::<{ (1i32, 'a') }>();
20-
//~^ ERROR: mismatched types: expected `char`, found `i32`
21-
//~| ERROR: mismatched types: expected `i32`, found `char`
18+
//~^ ERROR: the constant `1` is not of type `char`
19+
//~| ERROR: the constant `'a'` is not of type `i32
2220
}

tests/ui/const-generics/mgca/tuple_expr_type_mismatch.stderr

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,23 @@ error: type annotations needed for the literal
44
LL | foo::<{ (1, true) }>();
55
| ^
66

7-
error: mismatched types: expected `i32`, found `bool`
8-
--> $DIR/tuple_expr_type_mismatch.rs:13:17
9-
|
10-
LL | foo::<{ (1, true) }>();
11-
| ^^^^
12-
13-
error: mismatched types: expected `[u8; 2]`, found `u32`
14-
--> $DIR/tuple_expr_type_mismatch.rs:16:14
15-
|
16-
LL | bar::<{ (1_u32, [1, 2]) }>();
17-
| ^^^^^
18-
197
error: expected `i32`, found const array
20-
--> $DIR/tuple_expr_type_mismatch.rs:16:21
8+
--> $DIR/tuple_expr_type_mismatch.rs:15:21
219
|
2210
LL | bar::<{ (1_u32, [1, 2]) }>();
2311
| ^^^^^^
2412

25-
error: mismatched types: expected `char`, found `i32`
26-
--> $DIR/tuple_expr_type_mismatch.rs:19:14
13+
error: the constant `1` is not of type `char`
14+
--> $DIR/tuple_expr_type_mismatch.rs:17:13
2715
|
2816
LL | qux::<{ (1i32, 'a') }>();
29-
| ^^^^
17+
| ^^^^^^^^^^^ expected `char`, found `i32`
3018

31-
error: mismatched types: expected `i32`, found `char`
32-
--> $DIR/tuple_expr_type_mismatch.rs:19:20
19+
error: the constant `'a'` is not of type `i32`
20+
--> $DIR/tuple_expr_type_mismatch.rs:17:13
3321
|
3422
LL | qux::<{ (1i32, 'a') }>();
35-
| ^^^
23+
| ^^^^^^^^^^^ expected `i32`, found `char`
3624

37-
error: aborting due to 6 previous errors
25+
error: aborting due to 4 previous errors
3826

0 commit comments

Comments
 (0)