Update juniper_codegen for syn 1.0.60 (#861)

* Update juniper_codegen for syn 1.0.60

syn 1.0.60 has updated it's `Type::__Nonexhaustive` to
`Type::TestExhaustive`, breaking juniper.  This updates juniper to use
the recommended idiom for doing exhaustive matching on `Type`, which
fixes this.

Not entirely clear if we need exhaustive matching here or if we could
just use a fallback, but this fixes the build at least.

Also updated the minimum syn so users have to pull it in

* Update example to use relative deps

As otherwise CI fails on this branch
This commit is contained in:
Graeme Coupar 2021-01-26 17:41:03 +00:00 committed by GitHub
parent 2c9c172252
commit 824cd4081b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 11 deletions

View file

@ -13,5 +13,5 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "0.2", features = ["rt-core", "macros", "stream"] }
juniper = { git = "https://github.com/graphql-rust/juniper" }
juniper_subscriptions = { git = "https://github.com/graphql-rust/juniper" }
juniper = { path = "../../juniper" }
juniper_subscriptions = { path = "../../juniper_subscriptions" }

View file

@ -6,8 +6,8 @@ publish = false
authors = ["Christoph Herzog <chris@theduke.at>"]
[dependencies]
juniper = { git = "https://github.com/graphql-rust/juniper" }
juniper_warp = { git = "https://github.com/graphql-rust/juniper" }
juniper = { path = "../../juniper" }
juniper_warp = { path = "../../juniper_warp" }
env_logger = "0.8.1"
futures = "0.3.1"

View file

@ -21,7 +21,7 @@ proc-macro = true
proc-macro-error = "1.0.2"
proc-macro2 = "1.0.1"
quote = "1.0.3"
syn = { version = "1.0.3", features = ["extra-traits", "full", "parsing"], default-features = false }
syn = { version = "1.0.60", features = ["extra-traits", "full", "parsing"], default-features = false }
[dev-dependencies]
derive_more = "0.99.7"

View file

@ -191,12 +191,15 @@ impl TypeExt for syn::Type {
}
// These types unlikely will be used as GraphQL types.
T::BareFn(_)
| T::Infer(_)
| T::Macro(_)
| T::Never(_)
| T::Verbatim(_)
| T::__Nonexhaustive => {}
T::BareFn(_) | T::Infer(_) | T::Macro(_) | T::Never(_) | T::Verbatim(_) => {}
// Following the syn idiom for exhaustive matching on Type
// https://github.com/dtolnay/syn/blob/master/src/ty.rs#L66-L88
#[cfg(test)]
T::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {}
}
}
}