]> git.lizzy.rs Git - rust.git/commitdiff
test: const-generics: Update tests removing unrequired braces
authorGabriel Smith <gsmith@d3engineering.com>
Mon, 18 Nov 2019 19:57:23 +0000 (14:57 -0500)
committerGabriel Smith <gsmith@d3engineering.com>
Mon, 18 Nov 2019 22:23:22 +0000 (17:23 -0500)
Braces were left in cases where generic args were in the generic const
paths.

src/test/ui/const-generics/const-generic-array-wrapper.rs
src/test/ui/const-generics/fn-const-param-call.rs
src/test/ui/const-generics/fn-const-param-infer.rs
src/test/ui/const-generics/fn-const-param-infer.stderr
src/test/ui/const-generics/impl-const-generic-struct.rs
src/test/ui/const-generics/raw-ptr-const-param-deref.rs
src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs

index adffe32d67a30036488aea0de16bb0d874186d45..56a58c582f6457af5dd15a39e1502b3fc65725d5 100644 (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
     }
 }
 
index 84615386d29959a07024cd5fd0e7610edeb9af17..cd4b19db3533117f6d6bff106ec48ed3911d4112 100644 (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);
 }
index 78fb10e8cb9043296f86848767796cdf3261e227..dc69fa9eea58556eed6d94264fcd2554ebc20b14 100644 (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
index de0916b26bfef307d665e63b8480c6d7e109a7b3..e36bb824151f710e5e6dd43c14e801a72927284d 100644 (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
index 7a0c0f2be5d7ac6cc1a54715d21d3e77fe9db9b3..87572e51e8142df6b04535d82dadc2cf3d051323 100644 (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
     }
index d26ab8be4c3fe67ab26e50a080847b3072b1c0eb..745dde3c2876661236df9fb48392f1be6d58071a 100644 (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
index 1e064fbd970640044e53cd22a2d2d9a0fa6b6d50..7942631bb70b9f632583db09285b74b9f18e4941 100644 (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()
     }