Skip to content

Derive macro doesn't support type aliases for the database #8

Description

@jfecher

We should support the code below:

struct MyStorage { ... foo: SingletonStorage<Foo> ... }
struct Foo;
type MyDb = inc_complete::DbHandle<MyStorage>;

#[intermediate(id = 1)]
fn foo(ctx: &incremental::Parse, db: &MyDb) -> i32 {
    0
}

But we get an error when doing so:

error: DbHandle must have a generic type parameter for the storage type
  --> src/foo/mod.rs:84:45
   |
84 | fn foo(ctx: &incremental::Parse, db: &incremental::DbHandle) -> Arc<ParseResult> {
   |                                       ^^^^^^^^^^^^^^^^^^^^^

If we name the alias something else we get an error making it look like the macro is looking for an exact name:

error: second parameter must be &DbHandle<StorageType>
  --> src/foo/mod.rs:86:45
   |
86 | fn foo(ctx: &incremental::Parse, db: &Foo) -> Arc<ParseResult> {
   |                                       ^^^

This is overly restrictive and prevents users from using the derive macros in more situations

Activity

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

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions