Skip to content

Need to manually depend on futures #663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmaargh opened this issue May 15, 2020 · 0 comments · Fixed by #666
Closed

Need to manually depend on futures #663

jmaargh opened this issue May 15, 2020 · 0 comments · Fixed by #666
Labels
bug Something isn't working

Comments

@jmaargh
Copy link

jmaargh commented May 15, 2020

Describe the bug
I was starting to play with subscriptions, for which I needed to depend on the master branch

Incidentally, a new release which includes subscriptions would be swell :)

My Cargo.toml therefore looks something like this:

[dependencies]
rocket = "0.4.4"

[dependencies.juniper]
# 2020-05-15 newer than 0.14.2
git = "https://github.com/graphql-rust/juniper.git"
rev = "91a335398313356fcd6627c00f4b9fc504714f48"

[dependencies.juniper_rocket]
# 2020-05-15 newer than 0.5.2
git = "https://github.com/graphql-rust/juniper.git"
rev = "91a335398313356fcd6627c00f4b9fc504714f48"

Suppose I then try to compile the following main.rs

#![feature(decl_macro, proc_macro_hygiene)]

#[derive(juniper::GraphQLEnum, Clone, Copy)]
enum Episode {
  NewHope,
  Empire,
  Jedi,
}

fn main() {}

I get

error[E0432]: unresolved import `futures`
 --> src/main.rs:3:10
  |
3 | #[derive(juniper::GraphQLEnum, Clone, Copy)]
  |          ^^^^^^^^^^^^^^^^^^^^ use of undeclared type or module `futures`
  |
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

I can work around this by adding futures = "0.3.5" to my Cargo.toml and everything compiles fine. Clearly somewhere a dependency on futures isn't being properly expressed.

c.f. also #534

Additional context

Rust toolchain nightly-2020-05-07

@jmaargh jmaargh added bug Something isn't working needs-triage labels May 15, 2020
tyranron added a commit that referenced this issue Jun 4, 2020
- reimplement #[derive(GraphQLUnion)] macro to support:
    - both structs and enums
    - generics in type definition
    - multiple #[graphql] attributes
    - external resolver functions
- remove From trait impls generation for enum variants

- reimplement #[graphql_union] macro to support:
    - traits
    - generics in trait definition
    - multiple attributes
    - external resolver functions
    - GraphQLType implemetation for a raw trait object
    - GraphQLTypeAsync implemetation (#549)

- add marker::GraphQLUnion trait

- rewrite "2.5 Unions" section in Book (Juniper user documentation)

- rewrite `codegen` and `codegen_fail` integration tests for GraphQL unions

Additionally:
- re-export `futures` crate in `juniper` for convenient reuse in the generated code without requiring library user to provide `futures` crate by himself (#663)
- use unit type () as default context for EmptyMutation and EmptySubscriptions
- relax Sized trait bound on some GraphQLType and GraphQLTypeAsync definitions, implementations and usages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants