Skip to content

Commit eaf8fd0

Browse files
author
Gabriel Smith
committed
test: const-generics: Update tests removing unrequired braces
Braces were left in cases where generic args were in the generic const paths.
1 parent fb6cfde commit eaf8fd0

7 files changed

+19
-19
lines changed

Diff for: src/test/ui/const-generics/const-generic-array-wrapper.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#![feature(const_generics)]
44
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
55

6-
struct Foo<T, const N: usize>([T; {N}]);
6+
struct Foo<T, const N: usize>([T; N]);
77

8-
impl<T, const N: usize> Foo<T, {N}> {
8+
impl<T, const N: usize> Foo<T, N> {
99
fn foo(&self) -> usize {
10-
{N}
10+
N
1111
}
1212
}
1313

Diff for: src/test/ui/const-generics/fn-const-param-call.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ fn function() -> u32 {
99

1010
struct Wrapper<const F: fn() -> u32>;
1111

12-
impl<const F: fn() -> u32> Wrapper<{F}> {
12+
impl<const F: fn() -> u32> Wrapper<F> {
1313
fn call() -> u32 {
1414
F()
1515
}
1616
}
1717

1818
fn main() {
19-
assert_eq!(Wrapper::<{function}>::call(), 17);
19+
assert_eq!(Wrapper::<function>::call(), 17);
2020
}

Diff for: src/test/ui/const-generics/fn-const-param-infer.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ fn generic_arg<T>(val: T) -> bool { true }
1111
fn generic<T>(val: usize) -> bool { val != 1 }
1212

1313
fn main() {
14-
let _: Option<Checked<{not_one}>> = None;
15-
let _: Checked<{not_one}> = Checked::<{not_one}>;
16-
let _: Checked<{not_one}> = Checked::<{not_two}>; //~ mismatched types
14+
let _: Option<Checked<not_one>> = None;
15+
let _: Checked<not_one> = Checked::<not_one>;
16+
let _: Checked<not_one> = Checked::<not_two>; //~ mismatched types
1717

18-
let _ = Checked::<{generic_arg}>;
18+
let _ = Checked::<generic_arg>;
1919
let _ = Checked::<{generic_arg::<usize>}>;
2020
let _ = Checked::<{generic_arg::<u32>}>; //~ mismatched types
2121

22-
let _ = Checked::<{generic}>; //~ type annotations needed
22+
let _ = Checked::<generic>; //~ type annotations needed
2323
let _ = Checked::<{generic::<u16>}>;
2424
let _: Checked<{generic::<u16>}> = Checked::<{generic::<u16>}>;
2525
let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>; //~ mismatched types

Diff for: src/test/ui/const-generics/fn-const-param-infer.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ LL | #![feature(const_generics, const_compare_raw_pointers)]
77
= note: `#[warn(incomplete_features)]` on by default
88

99
error[E0308]: mismatched types
10-
--> $DIR/fn-const-param-infer.rs:16:33
10+
--> $DIR/fn-const-param-infer.rs:16:31
1111
|
12-
LL | let _: Checked<{not_one}> = Checked::<{not_two}>;
13-
| ^^^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
12+
LL | let _: Checked<not_one> = Checked::<not_two>;
13+
| ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
1414
|
1515
= note: expected type `Checked<not_one>`
1616
found type `Checked<not_two>`
@@ -25,10 +25,10 @@ LL | let _ = Checked::<{generic_arg::<u32>}>;
2525
found type `fn(u32) -> bool {generic_arg::<u32>}`
2626

2727
error[E0282]: type annotations needed
28-
--> $DIR/fn-const-param-infer.rs:22:24
28+
--> $DIR/fn-const-param-infer.rs:22:23
2929
|
30-
LL | let _ = Checked::<{generic}>;
31-
| ^^^^^^^ cannot infer type for `T`
30+
LL | let _ = Checked::<generic>;
31+
| ^^^^^^^ cannot infer type for `T`
3232

3333
error[E0308]: mismatched types
3434
--> $DIR/fn-const-param-infer.rs:25:40

Diff for: src/test/ui/const-generics/impl-const-generic-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
struct S<const X: u32>;
77

8-
impl<const X: u32> S<{X}> {
8+
impl<const X: u32> S<X> {
99
fn x() -> u32 {
1010
X
1111
}

Diff for: src/test/ui/const-generics/raw-ptr-const-param-deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const A: u32 = 3;
66

77
struct Const<const P: *const u32>;
88

9-
impl<const P: *const u32> Const<{P}> {
9+
impl<const P: *const u32> Const<P> {
1010
fn get() -> u32 {
1111
unsafe {
1212
*P

Diff for: src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::fmt;
77

88
struct Array<T, const N: usize>([T; N]);
99

10-
impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, {N}> {
10+
impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, N> {
1111
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1212
f.debug_list().entries(self.0.iter()).finish()
1313
}

0 commit comments

Comments
 (0)