Skip to content

New overflow error while compiling wundergraph #104322

Closed

Description

@weiznich

Code

I tried this code:

git clone https://github.com/weiznich/wundergraph 
cd wundergraph
git checkout 5752de6   
cd wundergraph # That one is important as well
cargo +stable check

I expected to see this happen: Code compiles, is it does with rust 1.64
Instead, this happened: Compiler emits new overflow error

error[E0275]: overflow evaluating the requirement `<R as HasTable>::Table`
  --> wundergraph/src/query_builder/mutations/delete.rs:35:15
   |
35 |     R::Table: HandleDelete<R, D, DB, Ctx> + 'static,
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`wundergraph`)
   = note: required for `<<R as HasTable>::Table as AsQuery>::Query` to implement `FilterDsl<_>`
note: required for `<R as HasTable>::Table` to implement `HandleDelete<R, D, DB, Ctx>`
  --> wundergraph/src/query_builder/mutations/delete.rs:69:24
   |
69 | impl<L, K, DB, Ctx, T> HandleDelete<L, K, DB, Ctx> for T
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^     ^

error[E0275]: overflow evaluating the requirement `<Self as AsQuery>::Query`
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`wundergraph`)
   = note: required for `Self` to implement `FilterDsl<_>`
note: required for `Self` to implement `HandleDelete<L, K, DB, Ctx>`
  --> wundergraph/src/query_builder/mutations/delete.rs:69:24
   |
69 | impl<L, K, DB, Ctx, T> HandleDelete<L, K, DB, Ctx> for T
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^     ^

error[E0275]: overflow evaluating the requirement `<R as HasTable>::Table`
  --> wundergraph/src/query_builder/mutations/update.rs:30:15
   |
30 |     R::Table: HandleUpdate<R, U, DB, Ctx> + 'static,
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`wundergraph`)
   = note: required for `<<R as HasTable>::Table as AsQuery>::Query` to implement `FilterDsl<_>`
note: required for `<R as HasTable>::Table` to implement `HandleUpdate<R, U, DB, Ctx>`
  --> wundergraph/src/query_builder/mutations/update.rs:68:24
   |
68 | impl<L, U, DB, Ctx, T> HandleUpdate<L, U, DB, Ctx> for T
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^     ^

error[E0275]: overflow evaluating the requirement `<Self as AsQuery>::Query`
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`wundergraph`)
   = note: required for `Self` to implement `FilterDsl<_>`
note: required for `Self` to implement `HandleUpdate<L, U, DB, Ctx>`
  --> wundergraph/src/query_builder/mutations/update.rs:68:24
   |
68 | impl<L, U, DB, Ctx, T> HandleUpdate<L, U, DB, Ctx> for T
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^     ^

For more information about this error, try `rustc --explain E0275`.
error: could not compile `wundergraph` due to 4 previous errors

Version it worked on

It most recently worked on: 1.64

Version with regression

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-unknown-linux-gnu
release: 1.65.0
LLVM version: 15.0.0

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

Activity

  1. added
    C-bugCategory: This is a bug.
    regression-untriagedUntriaged performance or correctness regression.
    on Nov 12, 2022
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.
    and removed
    regression-untriagedUntriaged performance or correctness regression.
    on Nov 12, 2022
  3. weiznich commented on Nov 12, 2022

    @weiznich
    ContributorAuthor

    cargo bisect-rust points to the following says that the regression was introduced in nightly-2022-08-23
    It points to the following commit range: c0941df to 015a824

    Github compare view

  4. compiler-errors commented on Nov 12, 2022

    @compiler-errors
    Contributor

    Very likely to have regressed in #100757, thus related to #103274 probably.

  5. weiznich commented on Nov 14, 2022

    @weiznich
    ContributorAuthor

    As #103274 was reported before the release of 1.65 as regression: Are there any plans to fix this or is this expected breakage due to a "bug-fix"?

  6. apiraino commented on Nov 23, 2022

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-high

  7. added
    P-highHigh priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Nov 23, 2022
  8. added a commit that references this issue on Nov 24, 2022
  9. weiznich commented on Nov 29, 2022

    @weiznich
    ContributorAuthor

    @compiler-errors This code reproduces the issue. I'm not sure if that's the most minimal version you can get, but at least it's nothing that depends on external crates:

    use mini_diesel::*;
    
    pub trait HandleDelete<K> {}
    
    pub fn handle_delete<D, R>()
    where
        R: HasTable,
        R::Table: HandleDelete<D> + 'static,
    {
    }
    
    impl<K, T> HandleDelete<K> for T
    where
        T: Table + HasTable<Table = T> + 'static,
        K: 'static,
        &'static K: Identifiable<Table = T>,
        T::PrimaryKey: EqAll<<&'static K as Identifiable>::Id>,
        T::Query: FilterDsl<<T::PrimaryKey as EqAll<<&'static K as Identifiable>::Id>>::Output>,
        Filter<T::Query, <T::PrimaryKey as EqAll<<&'static K as Identifiable>::Id>>::Output>:
            IntoUpdateTarget<Table = T>,
    {
    }
    
    mod mini_diesel {
        pub trait HasTable {
            type Table: Table;
        }
    
        pub trait Identifiable: HasTable {
            type Id;
        }
    
        pub trait EqAll<Rhs> {
            type Output;
        }
    
        pub trait IntoUpdateTarget: HasTable {
            type WhereClause;
        }
    
        pub trait Query {
            type SqlType;
        }
    
        pub trait AsQuery {
            type Query: Query;
        }
        impl<T: Query> AsQuery for T {
            type Query = Self;
        }
    
        pub trait FilterDsl<Predicate> {
            type Output;
        }
    
        impl<T, Predicate> FilterDsl<Predicate> for T
        where
            T: Table,
            T::Query: FilterDsl<Predicate>,
        {
            type Output = Filter<T::Query, Predicate>;
        }
    
        pub trait QuerySource {
            type FromClause;
        }
    
        pub trait Table: QuerySource + AsQuery + Sized {
            type PrimaryKey;
        }
    
        pub type Filter<Source, Predicate> = <Source as FilterDsl<Predicate>>::Output;
    }
    

    Can you give some pointer where that should be added as regression test?

  10. compiler-errors commented on Nov 29, 2022

    @compiler-errors
    Contributor

    Thanks @weiznich, please add it as a UI test: https://rustc-dev-guide.rust-lang.org/tests/ui.html

    Somewhere in like src/test/ui/traits or src/test/ui/associated-types or something like that.

  11. added 2 commits that reference this issue on Nov 30, 2022
  12. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Dec 9, 2022
  13. pnkfelix commented on Dec 9, 2022

    @pnkfelix
    Contributor

    resolved by PR #104610 and regression test added in PR #105081 (part of rollup PR #105095)

  14. added a commit that references this issue on Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions