From ca608a964ec547cb9137e26a29c048f839aa0391 Mon Sep 17 00:00:00 2001 From: kryptan Date: Fri, 22 Sep 2023 06:49:51 +0600 Subject: [PATCH] Clarify where optional features should be enabled (#2706) --- sqlx-macros-core/src/query/args.rs | 2 +- sqlx-macros-core/src/query/output.rs | 2 +- tests/ui/mysql/gated/chrono.stderr | 6 +++--- tests/ui/postgres/gated/chrono.stderr | 16 ++++++++-------- tests/ui/postgres/gated/ipnetwork.stderr | 8 ++++---- tests/ui/postgres/gated/uuid.stderr | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sqlx-macros-core/src/query/args.rs b/sqlx-macros-core/src/query/args.rs index ce5a55f16c..3a07b1b303 100644 --- a/sqlx-macros-core/src/query/args.rs +++ b/sqlx-macros-core/src/query/args.rs @@ -60,7 +60,7 @@ pub fn quote_args( .ok_or_else(|| { if let Some(feature_gate) = ::get_feature_gate(¶m_ty) { format!( - "optional feature `{}` required for type {} of param #{}", + "optional sqlx feature `{}` required for type {} of param #{}", feature_gate, param_ty, i + 1, diff --git a/sqlx-macros-core/src/query/output.rs b/sqlx-macros-core/src/query/output.rs index d0d837c9ee..65f44216ad 100644 --- a/sqlx-macros-core/src/query/output.rs +++ b/sqlx-macros-core/src/query/output.rs @@ -227,7 +227,7 @@ fn get_column_type(i: usize, column: &DB::Column) -> TokenStrea let message = if let Some(feature_gate) = ::get_feature_gate(&type_info) { format!( - "optional feature `{feat}` required for type {ty} of {col}", + "optional sqlx feature `{feat}` required for type {ty} of {col}", ty = &type_info, feat = feature_gate, col = DisplayColumn { diff --git a/tests/ui/mysql/gated/chrono.stderr b/tests/ui/mysql/gated/chrono.stderr index 7f4e463611..c340ab2c55 100644 --- a/tests/ui/mysql/gated/chrono.stderr +++ b/tests/ui/mysql/gated/chrono.stderr @@ -1,4 +1,4 @@ -error: optional feature `chrono` required for type DATE of column #1 ("date") +error: optional sqlx feature `chrono` required for type DATE of column #1 ("date") --> $DIR/chrono.rs:2:13 | 2 | let _ = sqlx::query!("select CONVERT(now(), DATE) date"); @@ -6,7 +6,7 @@ error: optional feature `chrono` required for type DATE of column #1 ("date") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `chrono` required for type TIME of column #1 ("time") +error: optional sqlx feature `chrono` required for type TIME of column #1 ("time") --> $DIR/chrono.rs:4:13 | 4 | let _ = sqlx::query!("select CONVERT(now(), TIME) time"); @@ -14,7 +14,7 @@ error: optional feature `chrono` required for type TIME of column #1 ("time") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `chrono` required for type DATETIME of column #1 ("datetime") +error: optional sqlx feature `chrono` required for type DATETIME of column #1 ("datetime") --> $DIR/chrono.rs:6:13 | 6 | let _ = sqlx::query!("select CONVERT(now(), DATETIME) datetime"); diff --git a/tests/ui/postgres/gated/chrono.stderr b/tests/ui/postgres/gated/chrono.stderr index 51c0d30156..f4f2abfbe5 100644 --- a/tests/ui/postgres/gated/chrono.stderr +++ b/tests/ui/postgres/gated/chrono.stderr @@ -1,4 +1,4 @@ -error: optional feature `time` required for type DATE of column #1 ("now") +error: optional sqlx feature `time` required for type DATE of column #1 ("now") --> $DIR/chrono.rs:2:13 | 2 | let _ = sqlx::query!("select now()::date"); @@ -6,7 +6,7 @@ error: optional feature `time` required for type DATE of column #1 ("now") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type TIME of column #1 ("now") +error: optional sqlx feature `time` required for type TIME of column #1 ("now") --> $DIR/chrono.rs:4:13 | 4 | let _ = sqlx::query!("select now()::time"); @@ -14,7 +14,7 @@ error: optional feature `time` required for type TIME of column #1 ("now") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type TIMESTAMP of column #1 ("now") +error: optional sqlx feature `time` required for type TIMESTAMP of column #1 ("now") --> $DIR/chrono.rs:6:13 | 6 | let _ = sqlx::query!("select now()::timestamp"); @@ -22,7 +22,7 @@ error: optional feature `time` required for type TIMESTAMP of column #1 ("now") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type TIMESTAMPTZ of column #1 ("now") +error: optional sqlx feature `time` required for type TIMESTAMPTZ of column #1 ("now") --> $DIR/chrono.rs:8:13 | 8 | let _ = sqlx::query!("select now()::timestamptz"); @@ -30,7 +30,7 @@ error: optional feature `time` required for type TIMESTAMPTZ of column #1 ("now" | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type DATE of param #1 +error: optional sqlx feature `time` required for type DATE of param #1 --> $DIR/chrono.rs:10:13 | 10 | let _ = sqlx::query!("select $1::date", ()); @@ -38,7 +38,7 @@ error: optional feature `time` required for type DATE of param #1 | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type TIME of param #1 +error: optional sqlx feature `time` required for type TIME of param #1 --> $DIR/chrono.rs:12:13 | 12 | let _ = sqlx::query!("select $1::time", ()); @@ -46,7 +46,7 @@ error: optional feature `time` required for type TIME of param #1 | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type TIMESTAMP of param #1 +error: optional sqlx feature `time` required for type TIMESTAMP of param #1 --> $DIR/chrono.rs:14:13 | 14 | let _ = sqlx::query!("select $1::timestamp", ()); @@ -54,7 +54,7 @@ error: optional feature `time` required for type TIMESTAMP of param #1 | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `time` required for type TIMESTAMPTZ of param #1 +error: optional sqlx feature `time` required for type TIMESTAMPTZ of param #1 --> $DIR/chrono.rs:16:13 | 16 | let _ = sqlx::query!("select $1::timestamptz", ()); diff --git a/tests/ui/postgres/gated/ipnetwork.stderr b/tests/ui/postgres/gated/ipnetwork.stderr index 5ffe12d4ed..2044d04e8c 100644 --- a/tests/ui/postgres/gated/ipnetwork.stderr +++ b/tests/ui/postgres/gated/ipnetwork.stderr @@ -1,4 +1,4 @@ -error: optional feature `ipnetwork` required for type INET of column #1 ("inet") +error: optional sqlx feature `ipnetwork` required for type INET of column #1 ("inet") --> $DIR/ipnetwork.rs:2:13 | 2 | let _ = sqlx::query!("select '127.0.0.1'::inet"); @@ -6,7 +6,7 @@ error: optional feature `ipnetwork` required for type INET of column #1 ("inet") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `ipnetwork` required for type CIDR of column #1 ("cidr") +error: optional sqlx feature `ipnetwork` required for type CIDR of column #1 ("cidr") --> $DIR/ipnetwork.rs:4:13 | 4 | let _ = sqlx::query!("select '2001:4f8:3:ba::/64'::cidr"); @@ -14,7 +14,7 @@ error: optional feature `ipnetwork` required for type CIDR of column #1 ("cidr") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `ipnetwork` required for type INET of param #1 +error: optional sqlx feature `ipnetwork` required for type INET of param #1 --> $DIR/ipnetwork.rs:6:13 | 6 | let _ = sqlx::query!("select $1::inet", ()); @@ -22,7 +22,7 @@ error: optional feature `ipnetwork` required for type INET of param #1 | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `ipnetwork` required for type CIDR of param #1 +error: optional sqlx feature `ipnetwork` required for type CIDR of param #1 --> $DIR/ipnetwork.rs:8:13 | 8 | let _ = sqlx::query!("select $1::cidr", ()); diff --git a/tests/ui/postgres/gated/uuid.stderr b/tests/ui/postgres/gated/uuid.stderr index 4ba22c05f7..e90aaffae4 100644 --- a/tests/ui/postgres/gated/uuid.stderr +++ b/tests/ui/postgres/gated/uuid.stderr @@ -1,4 +1,4 @@ -error: optional feature `uuid` required for type UUID of column #1 ("uuid") +error: optional sqlx feature `uuid` required for type UUID of column #1 ("uuid") --> $DIR/uuid.rs:2:13 | 2 | let _ = sqlx::query!("select 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid"); @@ -6,7 +6,7 @@ error: optional feature `uuid` required for type UUID of column #1 ("uuid") | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: optional feature `uuid` required for type UUID of param #1 +error: optional sqlx feature `uuid` required for type UUID of param #1 --> $DIR/uuid.rs:3:13 | 3 | let _ = sqlx::query!("select $1::uuid", ());