From 09aeb8db7c06e6aead48904e57fabfb0c7c18f8b Mon Sep 17 00:00:00 2001 From: keijun-kumagai Date: Mon, 10 Jan 2022 19:46:03 +0900 Subject: [PATCH 1/4] docs(macros): remove sentents banning `as _` --- src/macros.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index a35a119a03..650de91322 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -149,8 +149,7 @@ /// /// In Rust 1.45 we can eliminate this redundancy by allowing casts using `as _` or type ascription /// syntax, i.e. `my_int: _` (which is unstable but can be stripped), but this requires modifying -/// the expression which is not possible as the macros are currently implemented. Casts to `_` are -/// forbidden for now as they produce rather nasty type errors. +/// the expression which is not possible as the macros are currently implemented. /// /// ## Type Overrides: Output Columns /// Type overrides are also available for output columns, utilizing the SQL standard's support From 1bb3ea78e68f908f84d9162a10f5ac5f467e512d Mon Sep 17 00:00:00 2001 From: keijun-kumagai Date: Thu, 13 Jan 2022 03:34:31 +0900 Subject: [PATCH 2/4] fix(macros): comment --- src/macros.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index 650de91322..eeaa0fe555 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -147,9 +147,9 @@ /// sqlx::query!("select $1::int4 as id", my_int as MyInt4) /// ``` /// -/// In Rust 1.45 we can eliminate this redundancy by allowing casts using `as _` or type ascription -/// syntax, i.e. `my_int: _` (which is unstable but can be stripped), but this requires modifying -/// the expression which is not possible as the macros are currently implemented. +/// Using as _ or : _ simply signals to the macro to not type-check that bind expression, +/// and then that syntax is stripped from the expression so as to not trigger type errors +/// (or an unstable syntax feature in the case of the latter, which is called type ascription). /// /// ## Type Overrides: Output Columns /// Type overrides are also available for output columns, utilizing the SQL standard's support From d11f01d91a4c78068255b8ccde817aa74097b018 Mon Sep 17 00:00:00 2001 From: Austin Bonander Date: Tue, 15 Feb 2022 20:20:37 -0800 Subject: [PATCH 3/4] Update src/macros.rs --- src/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macros.rs b/src/macros.rs index eeaa0fe555..728359ff9a 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -147,7 +147,7 @@ /// sqlx::query!("select $1::int4 as id", my_int as MyInt4) /// ``` /// -/// Using as _ or : _ simply signals to the macro to not type-check that bind expression, +/// Using `expr as _` or `expr : _` simply signals to the macro to not type-check that bind expression, /// and then that syntax is stripped from the expression so as to not trigger type errors /// (or an unstable syntax feature in the case of the latter, which is called type ascription). /// From a33b8f362810514616ccc09748a3fcff38b1d973 Mon Sep 17 00:00:00 2001 From: Austin Bonander Date: Tue, 15 Feb 2022 20:21:31 -0800 Subject: [PATCH 4/4] Update src/macros.rs --- src/macros.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index 728359ff9a..6276950ba2 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -147,8 +147,8 @@ /// sqlx::query!("select $1::int4 as id", my_int as MyInt4) /// ``` /// -/// Using `expr as _` or `expr : _` simply signals to the macro to not type-check that bind expression, -/// and then that syntax is stripped from the expression so as to not trigger type errors +/// Using `expr as _` or `expr : _` simply signals to the macro to not type-check that bind expression, +/// and then that syntax is stripped from the expression so as to not trigger type errors /// (or an unstable syntax feature in the case of the latter, which is called type ascription). /// /// ## Type Overrides: Output Columns