From 42ff718d0fbc6f3c9a3386e65a16ab6c4ae89480 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Wed, 30 Nov 2022 07:46:01 +0100 Subject: [PATCH] Add a regression test for #104322 --- src/test/ui/traits/issue-104322.rs | 80 ++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/test/ui/traits/issue-104322.rs diff --git a/src/test/ui/traits/issue-104322.rs b/src/test/ui/traits/issue-104322.rs new file mode 100644 index 00000000000..dcc27f1f03a --- /dev/null +++ b/src/test/ui/traits/issue-104322.rs @@ -0,0 +1,80 @@ +// build-pass +// +// Tests that overflows do not occur in certain situations +// related to generic diesel code + +use mini_diesel::*; + +pub trait HandleDelete {} + +pub fn handle_delete() +where + R: HasTable, + R::Table: HandleDelete + 'static, +{ +} + +impl HandleDelete for T +where + T: Table + HasTable + 'static, + K: 'static, + &'static K: Identifiable
, + T::PrimaryKey: EqAll<<&'static K as Identifiable>::Id>, + T::Query: FilterDsl<::Id>>::Output>, + Filter::Id>>::Output>: + IntoUpdateTarget
, +{ +} + +mod mini_diesel { + pub trait HasTable { + type Table: Table; + } + + pub trait Identifiable: HasTable { + type Id; + } + + pub trait EqAll { + type Output; + } + + pub trait IntoUpdateTarget: HasTable { + type WhereClause; + } + + pub trait Query { + type SqlType; + } + + pub trait AsQuery { + type Query: Query; + } + impl AsQuery for T { + type Query = Self; + } + + pub trait FilterDsl { + type Output; + } + + impl FilterDsl for T + where + T: Table, + T::Query: FilterDsl, + { + type Output = Filter; + } + + pub trait QuerySource { + type FromClause; + } + + pub trait Table: QuerySource + AsQuery + Sized { + type PrimaryKey; + } + + pub type Filter = >::Output; +} + +fn main() {}