test: const-generics: Update tests removing unrequired braces

Braces were left in cases where generic args were in the generic const
paths.
This commit is contained in:
Gabriel Smith 2019-11-18 14:57:23 -05:00
parent fb6cfde5ba
commit eaf8fd0569
7 changed files with 19 additions and 19 deletions

View File

@ -3,11 +3,11 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
struct Foo<T, const N: usize>([T; {N}]);
struct Foo<T, const N: usize>([T; N]);
impl<T, const N: usize> Foo<T, {N}> {
impl<T, const N: usize> Foo<T, N> {
fn foo(&self) -> usize {
{N}
N
}
}

View File

@ -9,12 +9,12 @@ fn function() -> u32 {
struct Wrapper<const F: fn() -> u32>;
impl<const F: fn() -> u32> Wrapper<{F}> {
impl<const F: fn() -> u32> Wrapper<F> {
fn call() -> u32 {
F()
}
}
fn main() {
assert_eq!(Wrapper::<{function}>::call(), 17);
assert_eq!(Wrapper::<function>::call(), 17);
}

View File

@ -11,15 +11,15 @@ fn generic_arg<T>(val: T) -> bool { true }
fn generic<T>(val: usize) -> bool { val != 1 }
fn main() {
let _: Option<Checked<{not_one}>> = None;
let _: Checked<{not_one}> = Checked::<{not_one}>;
let _: Checked<{not_one}> = Checked::<{not_two}>; //~ mismatched types
let _: Option<Checked<not_one>> = None;
let _: Checked<not_one> = Checked::<not_one>;
let _: Checked<not_one> = Checked::<not_two>; //~ mismatched types
let _ = Checked::<{generic_arg}>;
let _ = Checked::<generic_arg>;
let _ = Checked::<{generic_arg::<usize>}>;
let _ = Checked::<{generic_arg::<u32>}>; //~ mismatched types
let _ = Checked::<{generic}>; //~ type annotations needed
let _ = Checked::<generic>; //~ type annotations needed
let _ = Checked::<{generic::<u16>}>;
let _: Checked<{generic::<u16>}> = Checked::<{generic::<u16>}>;
let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>; //~ mismatched types

View File

@ -7,10 +7,10 @@ LL | #![feature(const_generics, const_compare_raw_pointers)]
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:16:33
--> $DIR/fn-const-param-infer.rs:16:31
|
LL | let _: Checked<{not_one}> = Checked::<{not_two}>;
| ^^^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
LL | let _: Checked<not_one> = Checked::<not_two>;
| ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
|
= note: expected type `Checked<not_one>`
found type `Checked<not_two>`
@ -25,10 +25,10 @@ LL | let _ = Checked::<{generic_arg::<u32>}>;
found type `fn(u32) -> bool {generic_arg::<u32>}`
error[E0282]: type annotations needed
--> $DIR/fn-const-param-infer.rs:22:24
--> $DIR/fn-const-param-infer.rs:22:23
|
LL | let _ = Checked::<{generic}>;
| ^^^^^^^ cannot infer type for `T`
LL | let _ = Checked::<generic>;
| ^^^^^^^ cannot infer type for `T`
error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:25:40

View File

@ -5,7 +5,7 @@
struct S<const X: u32>;
impl<const X: u32> S<{X}> {
impl<const X: u32> S<X> {
fn x() -> u32 {
X
}

View File

@ -6,7 +6,7 @@
struct Const<const P: *const u32>;
impl<const P: *const u32> Const<{P}> {
impl<const P: *const u32> Const<P> {
fn get() -> u32 {
unsafe {
*P

View File

@ -7,7 +7,7 @@
struct Array<T, const N: usize>([T; N]);
impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, {N}> {
impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, N> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list().entries(self.0.iter()).finish()
}