Skip to content

Commit 632dbb0

Browse files
committed
Replace the macro_rules based __diesel_for_each_tuple macro with an
proc macro This allows to generate a single macro call per call of `__diesel_for_each_tuple`, which helps to implement the column count checking in a simpler way. Compile time wise this seems to be the same as before. I've measured the following times: with proc macro with macro_rules 16 22.88 s 28.18 s 32 36.03 s 36.08 s 64 1 min 47s 1min 74s
1 parent 42a4c22 commit 632dbb0

File tree

12 files changed

+73
-8552
lines changed

12 files changed

+73
-8552
lines changed

diesel/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ extras = ["chrono", "serde_json", "uuid", "network-address", "numeric", "r2d2"]
4949
unstable = ["diesel_derives/nightly"]
5050
large-tables = ["32-column-tables"]
5151
huge-tables = ["64-column-tables"]
52-
32-column-tables = []
53-
64-column-tables = ["32-column-tables"]
54-
128-column-tables = ["64-column-tables"]
52+
32-column-tables = ["diesel_derives/32-column-tables"]
53+
64-column-tables = ["32-column-tables", "diesel_derives/64-column-tables"]
54+
128-column-tables = ["64-column-tables", "diesel_derives/128-column-tables"]
5555
postgres = ["pq-sys", "postgres_backend"]
5656
sqlite = ["libsqlite3-sys", "diesel_derives/sqlite"]
5757
mysql = ["mysqlclient-sys", "url", "percent-encoding", "bitflags", "mysql_backend"]

diesel/src/expression_methods/eq_all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ macro_rules! impl_eq_all_for_all_tuples {
6969
};
7070
}
7171

72-
__diesel_for_each_tuple!(impl_eq_all_for_all_tuples);
72+
diesel_derives::__diesel_for_each_tuple!(impl_eq_all_for_all_tuples);

diesel/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ mod util;
171171
#[doc(hidden)]
172172
#[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
173173
#[deprecated(since = "2.0.0", note = "Use explicit macro imports instead")]
174-
pub use diesel_derives::*;
174+
pub use diesel_derives::{
175+
AsChangeset, AsExpression, Associations, DieselNumericOps, FromSqlRow, Identifiable,
176+
Insertable, QueryId, Queryable, QueryableByName, SqlType,
177+
};
175178

176179
pub mod dsl {
177180
//! Includes various helper types and bare functions which are named too

diesel/src/macros/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,16 +1370,12 @@ macro_rules! impl_column_check {
13701370
$crate::__diesel_error_table_size!();
13711371
}
13721372
}
1373-
1374-
// workaround https://github.com/rust-lang/rust/pull/52234
1375-
#[doc(hidden)]
1376-
pub use __diesel_check_column_count_internal as __diesel_check_column_count;
13771373
}
13781374
}
13791375
}
13801376
}
13811377

1382-
crate::__diesel_for_each_tuple!(impl_column_check);
1378+
diesel_derives::__diesel_for_each_tuple!(impl_column_check);
13831379

13841380
#[cfg(not(any(
13851381
feature = "32-column-tables",
@@ -1458,8 +1454,7 @@ mod internal;
14581454
mod static_cond;
14591455
#[macro_use]
14601456
mod ops;
1461-
#[macro_use]
1462-
mod tuples;
1457+
14631458

14641459
#[cfg(test)]
14651460
mod tests {

0 commit comments

Comments
 (0)