From eaf8fd056942cd8da2d5d5c844bba145b95f6d1a Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Mon, 18 Nov 2019 14:57:23 -0500 Subject: [PATCH] test: const-generics: Update tests removing unrequired braces Braces were left in cases where generic args were in the generic const paths. --- .../ui/const-generics/const-generic-array-wrapper.rs | 6 +++--- src/test/ui/const-generics/fn-const-param-call.rs | 4 ++-- src/test/ui/const-generics/fn-const-param-infer.rs | 10 +++++----- .../ui/const-generics/fn-const-param-infer.stderr | 12 ++++++------ .../ui/const-generics/impl-const-generic-struct.rs | 2 +- .../ui/const-generics/raw-ptr-const-param-deref.rs | 2 +- .../uninferred-consts-during-codegen-1.rs | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/test/ui/const-generics/const-generic-array-wrapper.rs b/src/test/ui/const-generics/const-generic-array-wrapper.rs index adffe32d67a3..56a58c582f64 100644 --- a/src/test/ui/const-generics/const-generic-array-wrapper.rs +++ b/src/test/ui/const-generics/const-generic-array-wrapper.rs @@ -3,11 +3,11 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -struct Foo([T; {N}]); +struct Foo([T; N]); -impl Foo { +impl Foo { fn foo(&self) -> usize { - {N} + N } } diff --git a/src/test/ui/const-generics/fn-const-param-call.rs b/src/test/ui/const-generics/fn-const-param-call.rs index 84615386d299..cd4b19db3533 100644 --- a/src/test/ui/const-generics/fn-const-param-call.rs +++ b/src/test/ui/const-generics/fn-const-param-call.rs @@ -9,12 +9,12 @@ fn function() -> u32 { struct Wrapper u32>; -impl u32> Wrapper<{F}> { +impl u32> Wrapper { fn call() -> u32 { F() } } fn main() { - assert_eq!(Wrapper::<{function}>::call(), 17); + assert_eq!(Wrapper::::call(), 17); } diff --git a/src/test/ui/const-generics/fn-const-param-infer.rs b/src/test/ui/const-generics/fn-const-param-infer.rs index 78fb10e8cb90..dc69fa9eea58 100644 --- a/src/test/ui/const-generics/fn-const-param-infer.rs +++ b/src/test/ui/const-generics/fn-const-param-infer.rs @@ -11,15 +11,15 @@ fn generic_arg(val: T) -> bool { true } fn generic(val: usize) -> bool { val != 1 } fn main() { - let _: Option> = None; - let _: Checked<{not_one}> = Checked::<{not_one}>; - let _: Checked<{not_one}> = Checked::<{not_two}>; //~ mismatched types + let _: Option> = None; + let _: Checked = Checked::; + let _: Checked = Checked::; //~ mismatched types - let _ = Checked::<{generic_arg}>; + let _ = Checked::; let _ = Checked::<{generic_arg::}>; let _ = Checked::<{generic_arg::}>; //~ mismatched types - let _ = Checked::<{generic}>; //~ type annotations needed + let _ = Checked::; //~ type annotations needed let _ = Checked::<{generic::}>; let _: Checked<{generic::}> = Checked::<{generic::}>; let _: Checked<{generic::}> = Checked::<{generic::}>; //~ mismatched types diff --git a/src/test/ui/const-generics/fn-const-param-infer.stderr b/src/test/ui/const-generics/fn-const-param-infer.stderr index de0916b26bfe..e36bb824151f 100644 --- a/src/test/ui/const-generics/fn-const-param-infer.stderr +++ b/src/test/ui/const-generics/fn-const-param-infer.stderr @@ -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 = Checked::; + | ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two` | = note: expected type `Checked` found type `Checked` @@ -25,10 +25,10 @@ LL | let _ = Checked::<{generic_arg::}>; found type `fn(u32) -> bool {generic_arg::}` 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::; + | ^^^^^^^ cannot infer type for `T` error[E0308]: mismatched types --> $DIR/fn-const-param-infer.rs:25:40 diff --git a/src/test/ui/const-generics/impl-const-generic-struct.rs b/src/test/ui/const-generics/impl-const-generic-struct.rs index 7a0c0f2be5d7..87572e51e814 100644 --- a/src/test/ui/const-generics/impl-const-generic-struct.rs +++ b/src/test/ui/const-generics/impl-const-generic-struct.rs @@ -5,7 +5,7 @@ struct S; -impl S<{X}> { +impl S { fn x() -> u32 { X } diff --git a/src/test/ui/const-generics/raw-ptr-const-param-deref.rs b/src/test/ui/const-generics/raw-ptr-const-param-deref.rs index d26ab8be4c3f..745dde3c2876 100644 --- a/src/test/ui/const-generics/raw-ptr-const-param-deref.rs +++ b/src/test/ui/const-generics/raw-ptr-const-param-deref.rs @@ -6,7 +6,7 @@ const A: u32 = 3; struct Const; -impl Const<{P}> { +impl Const

{ fn get() -> u32 { unsafe { *P diff --git a/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs b/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs index 1e064fbd9706..7942631bb70b 100644 --- a/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs +++ b/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs @@ -7,7 +7,7 @@ use std::fmt; struct Array([T; N]); -impl fmt::Debug for Array { +impl fmt::Debug for Array { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.0.iter()).finish() }