Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,29 @@ jobs:
- name: Install mysql (MacOS)
if: matrix.os == 'macos-13' && matrix.backend == 'mysql'
run: |
brew install mysql@9.0
/usr/local/opt/mysql@9.0/bin/mysql.server start
brew install mysql@8.4
/usr/local/opt/mysql@8.4/bin/mysql.server start
sleep 3
/usr/local/opt/mysql@9.0/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
echo "MYSQL_DATABASE_URL=mysql://root@localhost/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@localhost/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@localhost/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/mysql@9.0/lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=9.0" >> $GITHUB_ENV
/usr/local/opt/mysql@8.4/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
echo "MYSQL_DATABASE_URL=mysql://root@127.0.0.1/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@127.0.0.1/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/mysql@8.4/lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=8.4" >> $GITHUB_ENV

- name: Install mysql (MacOS M1)
if: matrix.os == 'macos-15' && matrix.backend == 'mysql'
run: |
brew install mysql@9.0
ls /opt/homebrew/opt/mysql@9.0
/opt/homebrew/opt/mysql@9.0/bin/mysql.server start
brew install mysql@8.4
ls /opt/homebrew/opt/mysql@8.4
/opt/homebrew/opt/mysql@8.4/bin/mysql.server start
sleep 3
/opt/homebrew/opt/mysql@9.0/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
echo "MYSQL_DATABASE_URL=mysql://root@localhost/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@localhost/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@localhost/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=/opt/homebrew/opt/mysql@9.0/lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=9.0" >> $GITHUB_ENV
/opt/homebrew/opt/mysql@8.4/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
echo "MYSQL_DATABASE_URL=mysql://root@127.0.0.1/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@l127.0.0.1/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=/opt/homebrew/opt/mysql@8.4/lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=8.4" >> $GITHUB_ENV

- name: Install sqlite (Windows)
if: runner.os == 'Windows' && matrix.backend == 'sqlite'
Expand Down
5 changes: 5 additions & 0 deletions diesel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@
//! - `32-column-tables`

#![cfg_attr(feature = "unstable", feature(trait_alias))]
#![cfg_attr(feature = "unstable", feature(strict_provenance_lints))]
#![cfg_attr(
feature = "unstable",
warn(fuzzy_provenance_casts, lossy_provenance_casts)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(feature = "128-column-tables", recursion_limit = "256")]
// Built-in Lints
Expand Down
8 changes: 4 additions & 4 deletions diesel/src/sqlite/types/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,18 @@ mod jsonb {

let header = if payload_size <= 0x0B {
// Small payloads, 0 additional byte for size
vec![(u8::try_from(payload_size).map_err(|e| e.to_string())?) << 4 | element_type]
vec![((u8::try_from(payload_size).map_err(|e| e.to_string())?) << 4) | element_type]
} else if payload_size <= 0xFF {
// Medium payloads, 1 additional byte for size
vec![
0x0C << 4 | element_type,
(0x0C << 4) | element_type,
u8::try_from(payload_size).map_err(|e| e.to_string())?,
]
} else if payload_size <= 0xFFFF {
let mut header = Vec::with_capacity(3);

// Larger payloads, 2 additional bytes for size
header.push(0x0D << 4 | element_type);
header.push((0x0D << 4) | element_type);
header.extend_from_slice(
&(u16::try_from(payload_size).map_err(|e| e.to_string())?).to_be_bytes(),
);
Expand All @@ -340,7 +340,7 @@ mod jsonb {
let mut header = Vec::with_capacity(5);

// Very large payloads, 4 additional bytes for size (up to 2 GiB)
header.push(0x0E << 4 | element_type);
header.push((0x0E << 4) | element_type);
header.extend_from_slice(
&(u32::try_from(payload_size).map_err(|e| e.to_string())?).to_be_bytes(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: Cannot select `posts::columns::id` from `users::table`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:21:31
|
21 | let source = users::table.select(sum(posts::id));
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`, which is required by `SelectStatement<FromClause<users::table>>: SelectDsl<_>`
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`
|
= note: `posts::columns::id` is no valid selection for `users::table`
= help: the following other types implement trait `SelectableExpression<QS>`:
Expand All @@ -20,7 +20,7 @@ error[E0271]: type mismatch resolving `<table as AppearsInFromClause<table>>::Co
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:21:31
|
21 | let source = users::table.select(sum(posts::id));
| ^^^^^^ expected `Never`, found `Once`
| ^^^^^^ expected `Once`, found `Never`
|
note: required for `posts::columns::id` to implement `AppearsOnTable<users::table>`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:13:9
Expand All @@ -37,7 +37,7 @@ error[E0277]: Cannot select `posts::columns::id` from `users::table`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:22:31
|
22 | let source = users::table.select(avg(posts::id));
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`, which is required by `SelectStatement<FromClause<users::table>>: SelectDsl<_>`
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`
|
= note: `posts::columns::id` is no valid selection for `users::table`
= help: the following other types implement trait `SelectableExpression<QS>`:
Expand All @@ -55,7 +55,7 @@ error[E0271]: type mismatch resolving `<table as AppearsInFromClause<table>>::Co
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:22:31
|
22 | let source = users::table.select(avg(posts::id));
| ^^^^^^ expected `Never`, found `Once`
| ^^^^^^ expected `Once`, found `Never`
|
note: required for `posts::columns::id` to implement `AppearsOnTable<users::table>`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:13:9
Expand All @@ -72,7 +72,7 @@ error[E0277]: Cannot select `posts::columns::id` from `users::table`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:23:31
|
23 | let source = users::table.select(max(posts::id));
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`, which is required by `SelectStatement<FromClause<users::table>>: SelectDsl<_>`
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`
|
= note: `posts::columns::id` is no valid selection for `users::table`
= help: the following other types implement trait `SelectableExpression<QS>`:
Expand All @@ -90,7 +90,7 @@ error[E0271]: type mismatch resolving `<table as AppearsInFromClause<table>>::Co
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:23:31
|
23 | let source = users::table.select(max(posts::id));
| ^^^^^^ expected `Never`, found `Once`
| ^^^^^^ expected `Once`, found `Never`
|
note: required for `posts::columns::id` to implement `AppearsOnTable<users::table>`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:13:9
Expand All @@ -107,7 +107,7 @@ error[E0277]: Cannot select `posts::columns::id` from `users::table`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:24:31
|
24 | let source = users::table.select(min(posts::id));
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`, which is required by `SelectStatement<FromClause<users::table>>: SelectDsl<_>`
| ^^^^^^ the trait `SelectableExpression<users::table>` is not implemented for `posts::columns::id`
|
= note: `posts::columns::id` is no valid selection for `users::table`
= help: the following other types implement trait `SelectableExpression<QS>`:
Expand All @@ -125,7 +125,7 @@ error[E0271]: type mismatch resolving `<table as AppearsInFromClause<table>>::Co
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:24:31
|
24 | let source = users::table.select(min(posts::id));
| ^^^^^^ expected `Never`, found `Once`
| ^^^^^^ expected `Once`, found `Never`
|
note: required for `posts::columns::id` to implement `AppearsOnTable<users::table>`
--> tests/fail/aggregate_expression_requires_column_from_same_table.rs:13:9
Expand Down
2 changes: 1 addition & 1 deletion diesel_compile_tests/tests/fail/alias_and_group_by.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0271]: type mismatch resolving `<name as IsContainedInGroupBy<id>>::Outpu
34 | .select(user_alias.field(users::id))
| ^^^^^^ type mismatch resolving `<name as IsContainedInGroupBy<id>>::Output == Yes`
|
note: expected this to be `diesel::expression::is_contained_in_group_by::No`
note: expected this to be `diesel::expression::is_contained_in_group_by::Yes`
--> tests/fail/alias_and_group_by.rs:9:9
|
9 | name -> VarChar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: Cannot select `f64` from `NoFromClause`
--> tests/fail/array_expressions_must_be_correct_type.rs:9:12
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ------ ^^^^^^^^^^^^^^^^^^^ the trait `SelectableExpression<NoFromClause>` is not implemented for `f64`, which is required by `SelectStatement<NoFromClause, diesel::query_builder::select_clause::SelectClause<_>>: AsQuery`
| ------ ^^^^^^^^^^^^^^^^^^^ the trait `SelectableExpression<NoFromClause>` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down Expand Up @@ -36,7 +36,7 @@ error[E0277]: the trait bound `f64: ValidGrouping<()>` is not satisfied
--> tests/fail/array_expressions_must_be_correct_type.rs:9:12
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ------ ^^^^^^^^^^^^^^^^^^^ the trait `ValidGrouping<()>` is not implemented for `f64`, which is required by `SelectStatement<NoFromClause, diesel::query_builder::select_clause::SelectClause<_>>: AsQuery`
| ------ ^^^^^^^^^^^^^^^^^^^ the trait `ValidGrouping<()>` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down Expand Up @@ -68,7 +68,7 @@ error[E0277]: Cannot select `f64` from `NoFromClause`
--> tests/fail/array_expressions_must_be_correct_type.rs:9:56
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ---------- ^^^^^^^^^^^^^^^ the trait `SelectableExpression<NoFromClause>` is not implemented for `f64`, which is required by `SelectStatement<NoFromClause, diesel::query_builder::select_clause::SelectClause<diesel::pg::expression::array::ArrayLiteral<(_, _), _>>>: LoadQuery<'_, _, Vec<i32>>`
| ---------- ^^^^^^^^^^^^^^^ the trait `SelectableExpression<NoFromClause>` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down Expand Up @@ -102,7 +102,7 @@ error[E0277]: the trait bound `f64: ValidGrouping<()>` is not satisfied
--> tests/fail/array_expressions_must_be_correct_type.rs:9:56
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ---------- ^^^^^^^^^^^^^^^ the trait `ValidGrouping<()>` is not implemented for `f64`, which is required by `SelectStatement<NoFromClause, diesel::query_builder::select_clause::SelectClause<diesel::pg::expression::array::ArrayLiteral<(_, _), _>>>: LoadQuery<'_, _, Vec<i32>>`
| ---------- ^^^^^^^^^^^^^^^ the trait `ValidGrouping<()>` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down Expand Up @@ -134,7 +134,7 @@ error[E0277]: the trait bound `f64: QueryId` is not satisfied
--> tests/fail/array_expressions_must_be_correct_type.rs:9:56
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ---------- ^^^^^^^^^^^^^^^ the trait `QueryId` is not implemented for `f64`, which is required by `SelectStatement<NoFromClause, diesel::query_builder::select_clause::SelectClause<diesel::pg::expression::array::ArrayLiteral<(_, _), _>>>: LoadQuery<'_, _, Vec<i32>>`
| ---------- ^^^^^^^^^^^^^^^ the trait `QueryId` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down Expand Up @@ -165,7 +165,7 @@ error[E0277]: `f64` is no valid SQL fragment for the `Pg` backend
--> tests/fail/array_expressions_must_be_correct_type.rs:9:56
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ---------- ^^^^^^^^^^^^^^^ the trait `QueryFragment<Pg>` is not implemented for `f64`, which is required by `SelectStatement<NoFromClause, diesel::query_builder::select_clause::SelectClause<diesel::pg::expression::array::ArrayLiteral<(_, _), _>>>: LoadQuery<'_, _, Vec<i32>>`
| ---------- ^^^^^^^^^^^^^^^ the trait `QueryFragment<Pg>` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down Expand Up @@ -198,7 +198,7 @@ error[E0277]: the trait bound `f64: diesel::Expression` is not satisfied
--> tests/fail/array_expressions_must_be_correct_type.rs:9:19
|
9 | select(array((1f64, 3f64))).get_result::<Vec<i32>>(&mut connection);
| ----- ^^^^ the trait `diesel::Expression` is not implemented for `f64`, which is required by `(f64, f64): AsExpressionList<_>`
| ----- ^^^^ the trait `diesel::Expression` is not implemented for `f64`
| |
| required by a bound introduced by this call
|
Expand Down
Loading