Fix `__internal_alias_helper` for real ^^'
@@ -459,7 +459,7 @@ where
/// # include!("../doctest_setup.rs");
/// fn main() {
/// diesel::alias!(schema::users as users_alias: UsersAlias);
-/// users_alias.inner_join(schema::posts);
+/// users_alias.inner_join(schema::posts::table);
/// }
/// ```
///
@@ -502,7 +502,7 @@ macro_rules! alias {
type Count = $crate::query_source::Once;
}
)*
- $crate::__internal_alias_helper!($($($table)::+ as $alias_ty,)*);
+ $crate::__internal_alias_helper!($(table_ty = $($table)::+::table, table_tt = ($($table)::+), alias_ty = $alias_ty;)*);
};
}
@@ -511,26 +511,28 @@ macro_rules! alias {
/// This only exists to hide internals from the doc
macro_rules! __internal_alias_helper {
(
- $($left_table: ident)::+ as $left_alias: ident,
- $($right_table: ident)::+ as $right_alias: ident,
- $($($table: ident)::+ as $alias: ident,)*
+ table_ty = $left_table_ty: ty, table_tt = $left_table_tt: tt, alias_ty = $left_alias: ident;
+ $(table_ty = $right_table_ty: ty, table_tt = $right_table_tt: tt, alias_ty = $right_alias: ident;)+
) => {
- $crate::static_cond!{if ($($left_table)::+) == ($($right_table)::+) {
- impl $crate::query_source::AliasAliasAppearsInFromClause<$($left_table)::+::table, $right_alias, $left_alias>
- for $($right_table)::+::table
+ $(
+ $crate::static_cond!{if ($left_table_tt) == ($right_table_tt) {
+ impl $crate::query_source::AliasAliasAppearsInFromClause<$left_table_ty, $right_alias, $left_alias>
+ for $right_table_ty
{
type Count = $crate::query_source::Never;
}
- impl $crate::query_source::AliasAliasAppearsInFromClause<$($right_table)::+::table, $left_alias, $right_alias>
- for $($left_table)::+::table
+ impl $crate::query_source::AliasAliasAppearsInFromClause<$right_table_ty, $left_alias, $right_alias>
+ for $left_table_ty
{
type Count = $crate::query_source::Never;
}
}}
- $crate::__internal_alias_helper!($($right_table)::+ as $right_alias, $($($table)::+ as $alias,)*);
+ )*
+ $crate::__internal_alias_helper!($(table_ty = $right_table_ty, table_tt = $right_table_tt, alias_ty = $right_alias;)+);
};
- ($($table: ident)::+ as $alias: ident,) => {}
+ (table_ty = $left_table_ty: ty, table_tt = $left_table_tt: tt, alias_ty = $left_alias: ident;) => {};
+ () => {};
}
impl<S: AliasSource> ToInnerJoin for Alias<S> {
