Upgrade syn crate to 2.0 version (#1157)

- replace `proc-macro-error` crate with simplified `common::diagnostic::pollyfill`
- migrate `juniper_codegen_tests` to stable Rust

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kai Ren <tyranron@gmail.com>
This commit is contained in:
dependabot[bot] 2023-11-01 19:00:05 +01:00 committed by GitHub
parent 2598045e89
commit 782eccba47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
123 changed files with 810 additions and 665 deletions

View file

@ -141,13 +141,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
msrv: ["1.65.0"] msrv: ["1.73.0"]
crate: crate:
- juniper_codegen - juniper_codegen
- juniper - juniper
- juniper_subscriptions - juniper_subscriptions
- juniper_graphql_ws - juniper_graphql_ws
#- juniper_actix - juniper_actix
- juniper_hyper - juniper_hyper
#- juniper_iron #- juniper_iron
- juniper_rocket - juniper_rocket
@ -156,10 +156,6 @@ jobs:
- ubuntu - ubuntu
- macOS - macOS
- windows - windows
include:
- { msrv: "1.68.0", crate: "juniper_actix", os: "ubuntu" }
- { msrv: "1.68.0", crate: "juniper_actix", os: "macOS" }
- { msrv: "1.68.0", crate: "juniper_actix", os: "windows" }
runs-on: ${{ matrix.os }}-latest runs-on: ${{ matrix.os }}-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -217,10 +213,10 @@ jobs:
- beta - beta
- nightly - nightly
exclude: exclude:
- crate: juniper_codegen_tests
toolchain: stable
- crate: juniper_codegen_tests - crate: juniper_codegen_tests
toolchain: beta toolchain: beta
- crate: juniper_codegen_tests
toolchain: nightly
- crate: juniper_codegen_tests - crate: juniper_codegen_tests
os: macOS os: macOS
- crate: juniper_codegen_tests - crate: juniper_codegen_tests

View file

@ -120,8 +120,7 @@ ifeq ($(shell rustup component list --toolchain=nightly \
rustup component add --toolchain=nightly rust-src rustup component add --toolchain=nightly rust-src
endif endif
endif endif
cargo $(if $(call eq,$(careful),yes),+nightly careful,\ cargo $(if $(call eq,$(careful),yes),+nightly careful,) \
$(if $(call eq,$(crate),juniper_codegen_tests),+nightly,)) \
test $(if $(call eq,$(crate),),--workspace,-p $(crate)) --all-features test $(if $(call eq,$(crate),),--workspace,-p $(crate)) --all-features

View file

@ -2,7 +2,7 @@
name = "juniper" name = "juniper"
version = "0.16.0-dev" version = "0.16.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "GraphQL server library." description = "GraphQL server library."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = [ authors = [
@ -68,7 +68,7 @@ time = { version = "0.3", features = ["formatting", "macros", "parsing"], option
url = { version = "2.0", optional = true } url = { version = "2.0", optional = true }
uuid = { version = "1.3", default-features = false, optional = true } uuid = { version = "1.3", default-features = false, optional = true }
# Fixes for MSRV check. # Fixes for `minimal-versions` check.
# TODO: Try remove on upgrade of `bigdecimal` crate. # TODO: Try remove on upgrade of `bigdecimal` crate.
num-bigint = { version = "0.4.2", optional = true } num-bigint = { version = "0.4.2", optional = true }
# TODO: Try remove on upgrade of `chrono-tz` crate. # TODO: Try remove on upgrade of `chrono-tz` crate.

View file

@ -4,7 +4,7 @@ Juniper (GraphQL server library for Rust)
[![Crates.io](https://img.shields.io/crates/v/juniper.svg?maxAge=2592000)](https://crates.io/crates/juniper) [![Crates.io](https://img.shields.io/crates/v/juniper.svg?maxAge=2592000)](https://crates.io/crates/juniper)
[![Documentation](https://docs.rs/juniper/badge.svg)](https://docs.rs/juniper) [![Documentation](https://docs.rs/juniper/badge.svg)](https://docs.rs/juniper)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Juniper Book] ([current][Juniper Book] | [edge][Juniper Book edge]) - [Juniper Book] ([current][Juniper Book] | [edge][Juniper Book edge])
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper/CHANGELOG.md)

View file

@ -38,6 +38,10 @@ All user visible changes to `juniper_codegen` crate will be documented in this f
- `#[derive(GraphQLInterface)]` macro allowing using structs as GraphQL interfaces. ([#1026]) - `#[derive(GraphQLInterface)]` macro allowing using structs as GraphQL interfaces. ([#1026])
### Changed
- Migrated to 2 version of `syn` crate. ([#1157])
### Fixed ### Fixed
- All procedural macros expansion inside `macro_rules!`. ([#1054], [#1051]) - All procedural macros expansion inside `macro_rules!`. ([#1054], [#1051])
@ -56,6 +60,7 @@ All user visible changes to `juniper_codegen` crate will be documented in this f
[#1028]: /../../pull/1028 [#1028]: /../../pull/1028
[#1051]: /../../issues/1051 [#1051]: /../../issues/1051
[#1054]: /../../pull/1054 [#1054]: /../../pull/1054
[#1157]: /../../pull/1157

View file

@ -2,7 +2,7 @@
name = "juniper_codegen" name = "juniper_codegen"
version = "0.16.0-dev" version = "0.16.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "Code generation for `juniper` crate." description = "Code generation for `juniper` crate."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = [ authors = [
@ -22,10 +22,9 @@ exclude = ["/release.toml"]
proc-macro = true proc-macro = true
[dependencies] [dependencies]
proc-macro-error = "1.0.2"
proc-macro2 = "1.0.4" proc-macro2 = "1.0.4"
quote = "1.0.9" quote = "1.0.9"
syn = { version = "1.0.90", features = ["extra-traits", "full", "parsing", "visit", "visit-mut"], default-features = false } syn = { version = "2.0", features = ["extra-traits", "full", "visit", "visit-mut"] }
url = "2.0" url = "2.0"
[dev-dependencies] [dev-dependencies]

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_codegen.svg?maxAge=2592000)](https://crates.io/crates/juniper_codegen) [![Crates.io](https://img.shields.io/crates/v/juniper_codegen.svg?maxAge=2592000)](https://crates.io/crates/juniper_codegen)
[![Documentation](https://docs.rs/juniper_codegen/badge.svg)](https://docs.rs/juniper_codegen) [![Documentation](https://docs.rs/juniper_codegen/badge.svg)](https://docs.rs/juniper_codegen)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_codegen/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_codegen/CHANGELOG.md)

View file

@ -7,6 +7,7 @@ use proc_macro2::TokenStream;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};
use syn::{ use syn::{
parse::{Parse, ParseStream}, parse::{Parse, ParseStream},
punctuated::Punctuated,
spanned::Spanned as _, spanned::Spanned as _,
token, token,
}; };
@ -20,7 +21,7 @@ use crate::common::{parse::ParseBufferExt as _, SpanContainer};
/// [0]: https://spec.graphql.org/October2021#sec--deprecated /// [0]: https://spec.graphql.org/October2021#sec--deprecated
/// [1]: https://spec.graphql.org/October2021#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
/// [2]: https://spec.graphql.org/October2021#sec-Enum-Value /// [2]: https://spec.graphql.org/October2021#sec-Enum-Value
#[derive(Debug, Default)] #[derive(Debug, Default, Eq, PartialEq)]
pub(crate) struct Directive { pub(crate) struct Directive {
/// Optional [reason][1] attached to this [deprecation][0]. /// Optional [reason][1] attached to this [deprecation][0].
/// ///
@ -52,8 +53,8 @@ impl Directive {
attrs: &[syn::Attribute], attrs: &[syn::Attribute],
) -> syn::Result<Option<SpanContainer<Self>>> { ) -> syn::Result<Option<SpanContainer<Self>>> {
for attr in attrs { for attr in attrs {
return Ok(match attr.parse_meta() { return Ok(match &attr.meta {
Ok(syn::Meta::List(ref list)) if list.path.is_ident("deprecated") => { syn::Meta::List(list) if list.path.is_ident("deprecated") => {
let directive = Self::parse_from_deprecated_meta_list(list)?; let directive = Self::parse_from_deprecated_meta_list(list)?;
Some(SpanContainer::new( Some(SpanContainer::new(
list.path.span(), list.path.span(),
@ -61,7 +62,7 @@ impl Directive {
directive, directive,
)) ))
} }
Ok(syn::Meta::Path(ref path)) if path.is_ident("deprecated") => { syn::Meta::Path(path) if path.is_ident("deprecated") => {
Some(SpanContainer::new(path.span(), None, Self::default())) Some(SpanContainer::new(path.span(), None, Self::default()))
} }
_ => continue, _ => continue,
@ -77,20 +78,24 @@ impl Directive {
/// ///
/// If the `#[deprecated(note = ...)]` attribute has incorrect format. /// If the `#[deprecated(note = ...)]` attribute has incorrect format.
fn parse_from_deprecated_meta_list(list: &syn::MetaList) -> syn::Result<Self> { fn parse_from_deprecated_meta_list(list: &syn::MetaList) -> syn::Result<Self> {
for meta in &list.nested { for meta in list.parse_args_with(Punctuated::<syn::Meta, token::Comma>::parse_terminated)? {
if let syn::NestedMeta::Meta(syn::Meta::NameValue(nv)) = meta { if let syn::Meta::NameValue(nv) = meta {
return if !nv.path.is_ident("note") { return if !nv.path.is_ident("note") {
Err(syn::Error::new( Err(syn::Error::new(
nv.path.span(), nv.path.span(),
"unrecognized setting on #[deprecated(..)] attribute", "unrecognized setting on #[deprecated(..)] attribute",
)) ))
} else if let syn::Lit::Str(strlit) = &nv.lit { } else if let syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Str(strlit),
..
}) = &nv.value
{
Ok(Self { Ok(Self {
reason: Some(strlit.clone()), reason: Some(strlit.clone()),
}) })
} else { } else {
Err(syn::Error::new( Err(syn::Error::new(
nv.lit.span(), nv.value.span(),
"only strings are allowed for deprecation", "only strings are allowed for deprecation",
)) ))
}; };
@ -112,3 +117,43 @@ impl ToTokens for Directive {
.to_tokens(into); .to_tokens(into);
} }
} }
#[cfg(test)]
mod parse_from_deprecated_attr_test {
use quote::quote;
use syn::parse_quote;
use super::Directive;
#[test]
fn single() {
let desc =
Directive::parse_from_deprecated_attr(&[parse_quote! { #[deprecated(note = "foo")] }])
.unwrap()
.unwrap()
.into_inner();
assert_eq!(
quote! { #desc }.to_string(),
quote! { .deprecated(::core::option::Option::Some("foo")) }.to_string(),
);
}
#[test]
fn no_reason() {
let desc = Directive::parse_from_deprecated_attr(&[parse_quote! { #[deprecated] }])
.unwrap()
.unwrap()
.into_inner();
assert_eq!(
quote! { #desc }.to_string(),
quote! { .deprecated(::core::option::Option::None) }.to_string(),
);
}
#[test]
fn not_deprecation() {
let desc =
Directive::parse_from_deprecated_attr(&[parse_quote! { #[blah = "foo"] }]).unwrap();
assert_eq!(desc, None);
}
}

View file

@ -5,7 +5,10 @@
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream}; use syn::{
parse::{Parse, ParseStream},
spanned::Spanned as _,
};
use crate::common::SpanContainer; use crate::common::SpanContainer;
@ -36,16 +39,20 @@ impl Description {
) -> syn::Result<Option<SpanContainer<Self>>> { ) -> syn::Result<Option<SpanContainer<Self>>> {
let (mut first_span, mut descriptions) = (None, Vec::new()); let (mut first_span, mut descriptions) = (None, Vec::new());
for attr in attrs { for attr in attrs {
match attr.parse_meta() { match attr.meta {
Ok(syn::Meta::NameValue(ref nv)) if nv.path.is_ident("doc") => { syn::Meta::NameValue(ref nv) if nv.path.is_ident("doc") => {
if let syn::Lit::Str(strlit) = &nv.lit { if let syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Str(strlit),
..
}) = &nv.value
{
if first_span.is_none() { if first_span.is_none() {
first_span = Some(strlit.span()); first_span = Some(strlit.span());
} }
descriptions.push(strlit.value()); descriptions.push(strlit.value());
} else { } else {
return Err(syn::Error::new( return Err(syn::Error::new(
nv.lit.span(), nv.value.span(),
"#[doc] attributes may only have a string literal", "#[doc] attributes may only have a string literal",
)); ));
} }

View file

@ -1,7 +1,8 @@
use std::fmt; use std::fmt;
use proc_macro2::Span; use proc_macro2::Span;
use proc_macro_error::{Diagnostic, Level};
pub(crate) use self::polyfill::{abort_if_dirty, emit_error, entry_point, Diagnostic, ResultExt};
/// URL of the GraphQL specification (October 2021 Edition). /// URL of the GraphQL specification (October 2021 Edition).
pub(crate) const SPEC_URL: &str = "https://spec.graphql.org/October2021"; pub(crate) const SPEC_URL: &str = "https://spec.graphql.org/October2021";
@ -55,13 +56,11 @@ impl Scope {
} }
pub(crate) fn custom<S: AsRef<str>>(&self, span: Span, msg: S) -> Diagnostic { pub(crate) fn custom<S: AsRef<str>>(&self, span: Span, msg: S) -> Diagnostic {
Diagnostic::spanned(span, Level::Error, format!("{self} {}", msg.as_ref())) Diagnostic::spanned(span, format!("{self} {}", msg.as_ref())).note(self.spec_link())
.note(self.spec_link())
} }
pub(crate) fn error(&self, err: syn::Error) -> Diagnostic { pub(crate) fn error(&self, err: &syn::Error) -> Diagnostic {
Diagnostic::spanned(err.span(), Level::Error, format!("{self} {err}")) Diagnostic::spanned(err.span(), format!("{self} {err}")).note(self.spec_link())
.note(self.spec_link())
} }
pub(crate) fn emit_custom<S: AsRef<str>>(&self, span: Span, msg: S) { pub(crate) fn emit_custom<S: AsRef<str>>(&self, span: Span, msg: S) {
@ -75,13 +74,279 @@ impl Scope {
pub(crate) fn no_double_underscore(&self, field: Span) { pub(crate) fn no_double_underscore(&self, field: Span) {
Diagnostic::spanned( Diagnostic::spanned(
field, field,
Level::Error,
"All types and directives defined within a schema must not have a name which begins \ "All types and directives defined within a schema must not have a name which begins \
with `__` (two underscores), as this is used exclusively by GraphQLs introspection \ with `__` (two underscores), as this is used exclusively by GraphQLs introspection \
system." system.",
.into(),
) )
.note(format!("{SPEC_URL}#sec-Schema")) .note(format!("{SPEC_URL}#sec-Schema"))
.emit(); .emit();
} }
} }
mod polyfill {
//! Simplified version of [`proc_macro_error`] machinery for this crate purposes.
//!
//! [`proc_macro_error`]: https://docs.rs/proc-macro-error/1
use std::{
cell::{Cell, RefCell},
panic::{catch_unwind, resume_unwind, UnwindSafe},
};
use proc_macro2::{Span, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
/// Representation of a single diagnostic message.
#[derive(Debug)]
pub(crate) struct Diagnostic {
span_range: SpanRange,
msg: String,
suggestions: Vec<String>,
}
impl Diagnostic {
/// Create a new [`Diagnostic`] message that points to the provided [`Span`].
pub(crate) fn spanned(span: Span, message: impl Into<String>) -> Self {
Self {
span_range: SpanRange {
first: span,
last: span,
},
msg: message.into(),
suggestions: vec![],
}
}
/// Attaches a note to the main message of this [`Diagnostic`].
pub(crate) fn note(mut self, msg: impl Into<String>) -> Self {
self.suggestions.push(msg.into());
self
}
/// Aborts macro execution and display this [`Diagnostic`].
pub(crate) fn abort(self) -> ! {
self.emit();
abort_now()
}
/// Display this [`Diagnostic`] while not aborting macro execution.
pub(crate) fn emit(self) {
check_correctness();
emit_diagnostic(self);
}
}
impl ToTokens for Diagnostic {
fn to_tokens(&self, ts: &mut TokenStream) {
use std::borrow::Cow;
fn ensure_lf(buf: &mut String, s: &str) {
if s.ends_with('\n') {
buf.push_str(s);
} else {
buf.push_str(s);
buf.push('\n');
}
}
fn diag_to_tokens(
span_range: SpanRange,
msg: &str,
suggestions: &[String],
) -> TokenStream {
let message = if suggestions.is_empty() {
Cow::Borrowed(msg)
} else {
let mut message = String::new();
ensure_lf(&mut message, msg);
for note in suggestions {
message.push_str("· note: ");
ensure_lf(&mut message, note);
}
Cow::Owned(message)
};
let mut msg = proc_macro2::Literal::string(&message);
msg.set_span(span_range.last);
let group = quote_spanned!(span_range.last=> { #msg } );
quote_spanned!(span_range.first=> compile_error!#group)
}
ts.extend(diag_to_tokens(
self.span_range,
&self.msg,
self.suggestions.as_ref(),
));
}
}
impl From<syn::Error> for Diagnostic {
fn from(err: syn::Error) -> Self {
use proc_macro2::{Delimiter, TokenTree};
fn gut_error(ts: &mut impl Iterator<Item = TokenTree>) -> Option<(SpanRange, String)> {
let first = ts.next()?.span(); // :
assert_eq!(ts.next().unwrap().to_string(), ":");
assert_eq!(ts.next().unwrap().to_string(), "core");
assert_eq!(ts.next().unwrap().to_string(), ":");
assert_eq!(ts.next().unwrap().to_string(), ":");
assert_eq!(ts.next().unwrap().to_string(), "compile_error");
assert_eq!(ts.next().unwrap().to_string(), "!");
let lit = match ts.next().unwrap() {
TokenTree::Group(group) => {
// Currently `syn` builds `compile_error!` invocations
// exclusively in `ident{"..."}` (braced) form which is not
// followed by `;` (semicolon).
//
// But if it changes to `ident("...");` (parenthesized)
// or `ident["..."];` (bracketed) form,
// we will need to skip the `;` as well.
// Highly unlikely, but better safe than sorry.
if group.delimiter() == Delimiter::Parenthesis
|| group.delimiter() == Delimiter::Bracket
{
ts.next().unwrap(); // ;
}
match group.stream().into_iter().next().unwrap() {
TokenTree::Literal(lit) => lit,
tt => unreachable!("Diagnostic::gut_error(): TokenTree::Group: {tt}"),
}
}
tt => unreachable!("Diagnostic::gut_error(): {tt}"),
};
let last = lit.span();
let mut msg = lit.to_string();
// "abc" => abc
msg.pop();
msg.remove(0);
Some((SpanRange { first, last }, msg))
}
let mut ts = err.to_compile_error().into_iter();
let (span_range, msg) = gut_error(&mut ts).unwrap();
Self {
span_range,
msg,
suggestions: vec![],
}
}
}
/// Emits a [`syn::Error`] while not aborting macro execution.
pub(crate) fn emit_error(e: syn::Error) {
Diagnostic::from(e).emit()
}
/// Range of [`Span`]s.
#[derive(Clone, Copy, Debug)]
struct SpanRange {
first: Span,
last: Span,
}
thread_local! {
static ENTERED_ENTRY_POINT: Cell<usize> = Cell::new(0);
}
/// This is the entry point for a macro to support [`Diagnostic`]s.
pub(crate) fn entry_point<F>(f: F) -> proc_macro::TokenStream
where
F: FnOnce() -> proc_macro::TokenStream + UnwindSafe,
{
ENTERED_ENTRY_POINT.with(|flag| flag.set(flag.get() + 1));
let caught = catch_unwind(f);
let err_storage = ERR_STORAGE.with(|s| s.replace(Vec::new()));
ENTERED_ENTRY_POINT.with(|flag| flag.set(flag.get() - 1));
let gen_error = || {
quote! { #( #err_storage )* }
};
match caught {
Ok(ts) => {
if err_storage.is_empty() {
ts
} else {
gen_error().into()
}
}
Err(boxed) => match boxed.downcast_ref::<&str>() {
Some(p) if *p == "diagnostic::polyfill::abort_now" => gen_error().into(),
_ => resume_unwind(boxed),
},
}
}
fn check_correctness() {
if ENTERED_ENTRY_POINT.get() == 0 {
panic!(
"`common::diagnostic` API cannot be used outside of `entry_point()` invocation, \
perhaps you forgot to invoke it your #[proc_macro] function",
);
}
}
thread_local! {
static ERR_STORAGE: RefCell<Vec<Diagnostic>> = RefCell::new(Vec::new());
}
/// Emits the provided [`Diagnostic`], while not aborting macro execution.
fn emit_diagnostic(diag: Diagnostic) {
ERR_STORAGE.with(|s| s.borrow_mut().push(diag));
}
/// Aborts macro execution. if any [`Diagnostic`]s were emitted before.
pub(crate) fn abort_if_dirty() {
check_correctness();
ERR_STORAGE.with(|s| {
if !s.borrow().is_empty() {
abort_now()
}
});
}
fn abort_now() -> ! {
check_correctness();
panic!("diagnostic::polyfill::abort_now")
}
/// Extension of `Result<T, Into<Diagnostic>>` with some handy shortcuts.
pub(crate) trait ResultExt {
type Ok;
/// Behaves like [`Result::unwrap()`]: if `self` is [`Ok`] yield the contained value,
/// otherwise abort macro execution.
fn unwrap_or_abort(self) -> Self::Ok;
/// Behaves like [`Result::expect()`]: if `self` is [`Ok`] yield the contained value,
/// otherwise abort macro execution.
///
/// If it aborts then resulting error message will be preceded with the provided `message`.
fn expect_or_abort(self, message: &str) -> Self::Ok;
}
impl<T, E: Into<Diagnostic>> ResultExt for Result<T, E> {
type Ok = T;
fn unwrap_or_abort(self) -> T {
self.unwrap_or_else(|e| e.into().abort())
}
fn expect_or_abort(self, message: &str) -> T {
self.unwrap_or_else(|e| {
let mut d = e.into();
d.msg = format!("{message}: {}", d.msg);
d.abort()
})
}
}
}

View file

@ -374,11 +374,11 @@ impl OnMethod {
// Remove repeated attributes from the method, to omit incorrect expansion. // Remove repeated attributes from the method, to omit incorrect expansion.
argument.attrs = mem::take(&mut argument.attrs) argument.attrs = mem::take(&mut argument.attrs)
.into_iter() .into_iter()
.filter(|attr| !path_eq_single(&attr.path, "graphql")) .filter(|attr| !path_eq_single(attr.path(), "graphql"))
.collect(); .collect();
let attr = Attr::from_attrs("graphql", &orig_attrs) let attr = Attr::from_attrs("graphql", &orig_attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.context.is_some() { if attr.context.is_some() {
@ -397,7 +397,7 @@ impl OnMethod {
}; };
if arg.is_some() { if arg.is_some() {
attr.ensure_no_regular_arguments() attr.ensure_no_regular_arguments()
.map_err(|e| scope.error(e).emit()) .map_err(|e| scope.error(&e).emit())
.ok()?; .ok()?;
return arg; return arg;
} }

View file

@ -27,5 +27,5 @@ pub(crate) fn filter_attrs<'a>(
) -> impl Iterator<Item = &'a syn::Attribute> + 'a { ) -> impl Iterator<Item = &'a syn::Attribute> + 'a {
attrs attrs
.iter() .iter()
.filter(move |attr| path_eq_single(&attr.path, name)) .filter(move |attr| path_eq_single(attr.path(), name))
} }

View file

@ -28,7 +28,7 @@ pub(crate) fn unite(
pub(crate) fn strip(attr_path: &str, attrs: Vec<syn::Attribute>) -> Vec<syn::Attribute> { pub(crate) fn strip(attr_path: &str, attrs: Vec<syn::Attribute>) -> Vec<syn::Attribute> {
attrs attrs
.into_iter() .into_iter()
.filter(|attr| !path_eq_single(&attr.path, attr_path)) .filter(|attr| !path_eq_single(attr.path(), attr_path))
.collect() .collect()
} }

View file

@ -65,7 +65,7 @@ pub(crate) fn output_type(ret_ty: &syn::ReturnType) -> Result<syn::Type, Span> {
/// If input arguments are invalid, then returns the [`Span`] to display the corresponding error at. /// If input arguments are invalid, then returns the [`Span`] to display the corresponding error at.
pub(crate) fn context_ty(sig: &syn::Signature) -> Result<Option<syn::Type>, Span> { pub(crate) fn context_ty(sig: &syn::Signature) -> Result<Option<syn::Type>, Span> {
match sig.receiver() { match sig.receiver() {
Some(syn::FnArg::Receiver(rcv)) => { Some(rcv) => {
if rcv.reference.is_none() || rcv.mutability.is_some() { if rcv.reference.is_none() || rcv.mutability.is_some() {
return Err(rcv.span()); return Err(rcv.span());
} }

View file

@ -146,8 +146,13 @@ impl TypeExt for syn::Type {
match arg { match arg {
GA::Lifetime(lt) => func(lt), GA::Lifetime(lt) => func(lt),
GA::Type(ty) => ty.lifetimes_iter_mut(func), GA::Type(ty) => ty.lifetimes_iter_mut(func),
GA::Binding(b) => b.ty.lifetimes_iter_mut(func), GA::AssocType(a) => a.ty.lifetimes_iter_mut(func),
GA::Constraint(_) | GA::Const(_) => {} GA::Constraint(_) | GA::AssocConst(_) | GA::Const(_) => {}
// Following the `syn` idiom for exhaustive matching on `Type`:
// https://docs.rs/syn/2.0.38/src/syn/ty.rs.html#64-79
// TODO: #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))]
// https://github.com/rust-lang/rust/issues/89554
_ => unimplemented!(),
} }
} }
} }
@ -188,6 +193,12 @@ impl TypeExt for syn::Type {
} }
iter_path(&mut bound.path, func) iter_path(&mut bound.path, func)
} }
syn::TypeParamBound::Verbatim(_) => {}
// Following the `syn` idiom for exhaustive matching on `Type`:
// https://docs.rs/syn/2.0.38/src/syn/ty.rs.html#64-79
// TODO: #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))]
// https://github.com/rust-lang/rust/issues/89554
_ => unimplemented!(),
} }
} }
} }
@ -204,8 +215,8 @@ impl TypeExt for syn::Type {
// These types unlikely will be used as GraphQL types. // These types unlikely will be used as GraphQL types.
T::BareFn(_) | T::Infer(_) | T::Macro(_) | T::Never(_) | T::Verbatim(_) => {} T::BareFn(_) | T::Infer(_) | T::Macro(_) | T::Never(_) | T::Verbatim(_) => {}
// Following the syn idiom for exhaustive matching on Type: // Following the `syn` idiom for exhaustive matching on `Type`:
// https://github.com/dtolnay/syn/blob/1.0.90/src/ty.rs#L67-L87 // https://docs.rs/syn/2.0.38/src/syn/ty.rs.html#64-79
// TODO: #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))] // TODO: #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))]
// https://github.com/rust-lang/rust/issues/89554 // https://github.com/rust-lang/rust/issues/89554
_ => unimplemented!(), _ => unimplemented!(),

View file

@ -3,7 +3,7 @@
//! //!
//! [`ScalarValue`]: juniper::ScalarValue //! [`ScalarValue`]: juniper::ScalarValue
use proc_macro2::{Span, TokenStream}; use proc_macro2::TokenStream;
use quote::ToTokens; use quote::ToTokens;
use syn::{ use syn::{
parse::{Parse, ParseStream}, parse::{Parse, ParseStream},
@ -44,11 +44,11 @@ impl Parse for AttrValue {
} }
} }
impl Spanned for AttrValue { impl ToTokens for AttrValue {
fn span(&self) -> Span { fn to_tokens(&self, into: &mut TokenStream) {
match self { match self {
Self::Concrete(ty) => ty.span(), Self::Concrete(ty) => ty.to_tokens(into),
Self::Generic(pred) => pred.span(), Self::Generic(pred) => pred.to_tokens(into),
} }
} }
} }

View file

@ -40,7 +40,7 @@ pub(crate) fn expand(input: TokenStream) -> syn::Result<TokenStream> {
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if values.is_empty() { if values.is_empty() {
return Err(ERR.custom_error( return Err(ERR.custom_error(
@ -78,7 +78,7 @@ pub(crate) fn expand(input: TokenStream) -> syn::Result<TokenStream> {
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let definition = Definition { let definition = Definition {
ident: ast.ident, ident: ast.ident,
@ -99,7 +99,7 @@ pub(crate) fn expand(input: TokenStream) -> syn::Result<TokenStream> {
/// Returns [`None`] if the parsing fails, or the enum variant is ignored. /// Returns [`None`] if the parsing fails, or the enum variant is ignored.
fn parse_value(v: &syn::Variant, renaming: rename::Policy) -> Option<ValueDefinition> { fn parse_value(v: &syn::Variant, renaming: rename::Policy) -> Option<ValueDefinition> {
let attr = VariantAttr::from_attrs("graphql", &v.attrs) let attr = VariantAttr::from_attrs("graphql", &v.attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {

View file

@ -36,7 +36,7 @@ pub fn expand(input: TokenStream) -> syn::Result<TokenStream> {
.filter_map(|f| parse_field(f, renaming, is_internal)) .filter_map(|f| parse_field(f, renaming, is_internal))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if !fields.iter().any(|f| !f.ignored) { if !fields.iter().any(|f| !f.ignored) {
return Err(ERR.custom_error(data.fields.span(), "expected at least 1 non-ignored field")); return Err(ERR.custom_error(data.fields.span(), "expected at least 1 non-ignored field"));
@ -71,7 +71,7 @@ pub fn expand(input: TokenStream) -> syn::Result<TokenStream> {
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let definition = Definition { let definition = Definition {
ident: ast.ident, ident: ast.ident,
@ -95,7 +95,7 @@ fn parse_field(
is_internal: bool, is_internal: bool,
) -> Option<FieldDefinition> { ) -> Option<FieldDefinition> {
let field_attr = FieldAttr::from_attrs("graphql", &f.attrs) let field_attr = FieldAttr::from_attrs("graphql", &f.attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
let ident = f.ident.as_ref().or_else(|| err_unnamed_field(f))?; let ident = f.ident.as_ref().or_else(|| err_unnamed_field(f))?;

View file

@ -64,7 +64,7 @@ fn expand_on_trait(
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let renaming = attr let renaming = attr
.rename_fields .rename_fields
@ -76,14 +76,14 @@ fn expand_on_trait(
.items .items
.iter_mut() .iter_mut()
.filter_map(|item| { .filter_map(|item| {
if let syn::TraitItem::Method(m) = item { if let syn::TraitItem::Fn(m) = item {
return parse_trait_method(m, &renaming); return parse_trait_method(m, &renaming);
} }
None None
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if fields.is_empty() { if fields.is_empty() {
ERR.emit_custom(trait_span, "must have at least one field"); ERR.emit_custom(trait_span, "must have at least one field");
@ -92,7 +92,7 @@ fn expand_on_trait(
ERR.emit_custom(trait_span, "must have a different name for each field"); ERR.emit_custom(trait_span, "must have a different name for each field");
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let context = attr let context = attr
.context .context
@ -146,7 +146,7 @@ fn expand_on_trait(
/// Returns [`None`] if the parsing fails, or the method field is ignored. /// Returns [`None`] if the parsing fails, or the method field is ignored.
#[must_use] #[must_use]
fn parse_trait_method( fn parse_trait_method(
method: &mut syn::TraitItemMethod, method: &mut syn::TraitItemFn,
renaming: &rename::Policy, renaming: &rename::Policy,
) -> Option<field::Definition> { ) -> Option<field::Definition> {
let method_ident = &method.sig.ident; let method_ident = &method.sig.ident;
@ -155,11 +155,11 @@ fn parse_trait_method(
// Remove repeated attributes from the method, to omit incorrect expansion. // Remove repeated attributes from the method, to omit incorrect expansion.
method.attrs = mem::take(&mut method.attrs) method.attrs = mem::take(&mut method.attrs)
.into_iter() .into_iter()
.filter(|attr| !path_eq_single(&attr.path, "graphql")) .filter(|attr| !path_eq_single(attr.path(), "graphql"))
.collect(); .collect();
let attr = field::Attr::from_attrs("graphql", &method_attrs) let attr = field::Attr::from_attrs("graphql", &method_attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {
@ -251,7 +251,7 @@ fn expand_on_derive_input(
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let renaming = attr let renaming = attr
.rename_fields .rename_fields
@ -265,7 +265,7 @@ fn expand_on_derive_input(
.filter_map(|f| parse_struct_field(f, &renaming)) .filter_map(|f| parse_struct_field(f, &renaming))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if fields.is_empty() { if fields.is_empty() {
ERR.emit_custom(struct_span, "must have at least one field"); ERR.emit_custom(struct_span, "must have at least one field");
@ -274,7 +274,7 @@ fn expand_on_derive_input(
ERR.emit_custom(struct_span, "must have a different name for each field"); ERR.emit_custom(struct_span, "must have a different name for each field");
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let context = attr let context = attr
.context .context
@ -337,11 +337,11 @@ fn parse_struct_field(
// Remove repeated attributes from the method, to omit incorrect expansion. // Remove repeated attributes from the method, to omit incorrect expansion.
field.attrs = mem::take(&mut field.attrs) field.attrs = mem::take(&mut field.attrs)
.into_iter() .into_iter()
.filter(|attr| !path_eq_single(&attr.path, "graphql")) .filter(|attr| !path_eq_single(attr.path(), "graphql"))
.collect(); .collect();
let attr = field::Attr::from_attrs("graphql", &field_attrs) let attr = field::Attr::from_attrs("graphql", &field_attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {

View file

@ -42,7 +42,7 @@ pub fn expand(input: TokenStream) -> syn::Result<TokenStream> {
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let renaming = attr let renaming = attr
.rename_fields .rename_fields
@ -56,7 +56,7 @@ pub fn expand(input: TokenStream) -> syn::Result<TokenStream> {
.filter_map(|f| parse_field(f, &renaming)) .filter_map(|f| parse_field(f, &renaming))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if fields.is_empty() { if fields.is_empty() {
ERR.emit_custom(struct_span, "must have at least one field"); ERR.emit_custom(struct_span, "must have at least one field");
@ -65,7 +65,7 @@ pub fn expand(input: TokenStream) -> syn::Result<TokenStream> {
ERR.emit_custom(struct_span, "must have a different name for each field"); ERR.emit_custom(struct_span, "must have a different name for each field");
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let context = attr let context = attr
.context .context
@ -118,7 +118,7 @@ fn parse_field(field: &syn::Field, renaming: &rename::Policy) -> Option<field::D
let field_ident = field.ident.as_ref().or_else(|| err_unnamed_field(&field))?; let field_ident = field.ident.as_ref().or_else(|| err_unnamed_field(&field))?;
let attr = field::Attr::from_attrs("graphql", &field.attrs) let attr = field::Attr::from_attrs("graphql", &field.attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {

View file

@ -63,7 +63,7 @@ where
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let renaming = attr let renaming = attr
.rename_fields .rename_fields
@ -76,7 +76,7 @@ where
.items .items
.iter_mut() .iter_mut()
.filter_map(|item| { .filter_map(|item| {
if let syn::ImplItem::Method(m) = item { if let syn::ImplItem::Fn(m) = item {
parse_field(m, async_only, &renaming) parse_field(m, async_only, &renaming)
} else { } else {
None None
@ -84,7 +84,7 @@ where
}) })
.collect(); .collect();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if fields.is_empty() { if fields.is_empty() {
ERR.emit_custom(type_span, "must have at least one field"); ERR.emit_custom(type_span, "must have at least one field");
@ -93,7 +93,7 @@ where
ERR.emit_custom(type_span, "must have a different name for each field"); ERR.emit_custom(type_span, "must have a different name for each field");
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let context = attr let context = attr
.context .context
@ -132,12 +132,12 @@ where
}) })
} }
/// Parses a [`field::Definition`] from the given Rust [`syn::ImplItemMethod`]. /// Parses a [`field::Definition`] from the given Rust [`syn::ImplItemFn`].
/// ///
/// Returns [`None`] if parsing fails, or the method field is ignored. /// Returns [`None`] if parsing fails, or the method field is ignored.
#[must_use] #[must_use]
fn parse_field( fn parse_field(
method: &mut syn::ImplItemMethod, method: &mut syn::ImplItemFn,
async_only: bool, async_only: bool,
renaming: &rename::Policy, renaming: &rename::Policy,
) -> Option<field::Definition> { ) -> Option<field::Definition> {
@ -146,11 +146,11 @@ fn parse_field(
// Remove repeated attributes from the method, to omit incorrect expansion. // Remove repeated attributes from the method, to omit incorrect expansion.
method.attrs = mem::take(&mut method.attrs) method.attrs = mem::take(&mut method.attrs)
.into_iter() .into_iter()
.filter(|attr| !path_eq_single(&attr.path, "graphql")) .filter(|attr| !path_eq_single(attr.path(), "graphql"))
.collect(); .collect();
let attr = field::Attr::from_attrs("graphql", &method_attrs) let attr = field::Attr::from_attrs("graphql", &method_attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {
@ -239,7 +239,7 @@ fn err_invalid_method_receiver<T, S: Spanned>(span: &S) -> Option<T> {
#[must_use] #[must_use]
fn err_no_sync_resolvers<T, S: Spanned>(span: &S) -> Option<T> { fn err_no_sync_resolvers<T, S: Spanned>(span: &S) -> Option<T> {
ERR.custom(span.span(), "synchronous resolvers are not supported") ERR.custom(span.span(), "synchronous resolvers are not supported")
.note("Specify that this function is async: `async fn foo()`".into()) .note("Specify that this function is async: `async fn foo()`")
.emit(); .emit();
None None
} }

View file

@ -3,11 +3,15 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use proc_macro_error::ResultExt as _;
use quote::ToTokens; use quote::ToTokens;
use syn::{ext::IdentExt as _, parse_quote, spanned::Spanned as _}; use syn::{ext::IdentExt as _, parse_quote, spanned::Spanned as _};
use crate::common::{diagnostic, field, parse::TypeExt as _, rename, scalar, SpanContainer}; use crate::common::{
diagnostic::{self, ResultExt as _},
field,
parse::TypeExt as _,
rename, scalar, SpanContainer,
};
use super::{Attr, Definition, Query}; use super::{Attr, Definition, Query};
@ -52,7 +56,7 @@ fn expand_struct(ast: syn::DeriveInput) -> syn::Result<Definition<Query>> {
let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics);
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let renaming = attr let renaming = attr
.rename_fields .rename_fields
@ -73,7 +77,7 @@ fn expand_struct(ast: syn::DeriveInput) -> syn::Result<Definition<Query>> {
} }
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
if fields.is_empty() { if fields.is_empty() {
ERR.emit_custom(struct_span, "must have at least one field"); ERR.emit_custom(struct_span, "must have at least one field");
@ -82,7 +86,7 @@ fn expand_struct(ast: syn::DeriveInput) -> syn::Result<Definition<Query>> {
ERR.emit_custom(struct_span, "must have a different name for each field"); ERR.emit_custom(struct_span, "must have a different name for each field");
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
Ok(Definition { Ok(Definition {
name, name,
@ -110,7 +114,7 @@ fn expand_struct(ast: syn::DeriveInput) -> syn::Result<Definition<Query>> {
#[must_use] #[must_use]
fn parse_field(field: &syn::Field, renaming: &rename::Policy) -> Option<field::Definition> { fn parse_field(field: &syn::Field, renaming: &rename::Policy) -> Option<field::Definition> {
let attr = field::Attr::from_attrs("graphql", &field.attrs) let attr = field::Attr::from_attrs("graphql", &field.attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {

View file

@ -160,8 +160,7 @@ impl Parse for Attr {
"parse_token" => { "parse_token" => {
let types; let types;
let _ = syn::parenthesized!(types in input); let _ = syn::parenthesized!(types in input);
let parsed_types = let parsed_types = types.parse_terminated(syn::Type::parse, token::Comma)?;
types.parse_terminated::<_, token::Comma>(syn::Type::parse)?;
if parsed_types.is_empty() { if parsed_types.is_empty() {
return Err(syn::Error::new(ident.span(), "expected at least 1 type.")); return Err(syn::Error::new(ident.span(), "expected at least 1 type."));
@ -187,7 +186,7 @@ impl Parse for Attr {
let predicates; let predicates;
let _ = syn::parenthesized!(predicates in input); let _ = syn::parenthesized!(predicates in input);
let parsed_predicates = predicates let parsed_predicates = predicates
.parse_terminated::<_, token::Comma>(syn::WherePredicate::parse)?; .parse_terminated(syn::WherePredicate::parse, token::Comma)?;
if parsed_predicates.is_empty() { if parsed_predicates.is_empty() {
return Err(syn::Error::new( return Err(syn::Error::new(

View file

@ -58,12 +58,12 @@ fn expand_on_trait(
.items .items
.iter_mut() .iter_mut()
.filter_map(|i| match i { .filter_map(|i| match i {
syn::TraitItem::Method(m) => parse_variant_from_trait_method(m, trait_ident, &attr), syn::TraitItem::Fn(m) => parse_variant_from_trait_method(m, trait_ident, &attr),
_ => None, _ => None,
}) })
.collect(); .collect();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
emerge_union_variants_from_attr(&mut variants, attr.external_resolvers); emerge_union_variants_from_attr(&mut variants, attr.external_resolvers);
@ -78,7 +78,7 @@ fn expand_on_trait(
); );
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
let context = attr let context = attr
.context .context
@ -105,12 +105,12 @@ fn expand_on_trait(
/// Parses given Rust trait `method` as [GraphQL union][1] variant. /// Parses given Rust trait `method` as [GraphQL union][1] variant.
/// ///
/// On failure returns [`None`] and internally fills up [`proc_macro_error`] /// On failure returns [`None`] and internally fills up [`diagnostic`]
/// with the corresponding errors. /// with the corresponding errors.
/// ///
/// [1]: https://spec.graphql.org/October2021#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
fn parse_variant_from_trait_method( fn parse_variant_from_trait_method(
method: &mut syn::TraitItemMethod, method: &mut syn::TraitItemFn,
trait_ident: &syn::Ident, trait_ident: &syn::Ident,
trait_attr: &Attr, trait_attr: &Attr,
) -> Option<VariantDefinition> { ) -> Option<VariantDefinition> {
@ -119,11 +119,11 @@ fn parse_variant_from_trait_method(
// Remove repeated attributes from the method, to omit incorrect expansion. // Remove repeated attributes from the method, to omit incorrect expansion.
method.attrs = mem::take(&mut method.attrs) method.attrs = mem::take(&mut method.attrs)
.into_iter() .into_iter()
.filter(|attr| !path_eq_single(&attr.path, "graphql")) .filter(|attr| !path_eq_single(attr.path(), "graphql"))
.collect(); .collect();
let attr = VariantAttr::from_attrs("graphql", &method_attrs) let attr = VariantAttr::from_attrs("graphql", &method_attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if let Some(rslvr) = attr.external_resolver { if let Some(rslvr) = attr.external_resolver {

View file

@ -1,11 +1,14 @@
//! Code generation for `#[derive(GraphQLUnion)]` macro. //! Code generation for `#[derive(GraphQLUnion)]` macro.
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use proc_macro_error::ResultExt as _;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};
use syn::{ext::IdentExt as _, parse_quote, spanned::Spanned as _, Data, Fields}; use syn::{ext::IdentExt as _, parse_quote, spanned::Spanned as _, Data, Fields};
use crate::common::{diagnostic, parse::TypeExt as _, scalar, SpanContainer}; use crate::common::{
diagnostic::{self, ResultExt as _},
parse::TypeExt as _,
scalar, SpanContainer,
};
use super::{ use super::{
all_variants_different, emerge_union_variants_from_attr, Attr, Definition, VariantAttr, all_variants_different, emerge_union_variants_from_attr, Attr, Definition, VariantAttr,
@ -51,13 +54,13 @@ fn expand_enum(ast: syn::DeriveInput) -> syn::Result<Definition> {
let mut variants: Vec<_> = match ast.data { let mut variants: Vec<_> = match ast.data {
Data::Enum(data) => data.variants, Data::Enum(data) => data.variants,
_ => unreachable!(), data => unreachable!("graphql_union::derive::expand_enum({data:?})"),
} }
.into_iter() .into_iter()
.filter_map(|var| parse_variant_from_enum_variant(var, &enum_ident, &attr)) .filter_map(|var| parse_variant_from_enum_variant(var, &enum_ident, &attr))
.collect(); .collect();
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
emerge_union_variants_from_attr(&mut variants, attr.external_resolvers); emerge_union_variants_from_attr(&mut variants, attr.external_resolvers);
@ -72,7 +75,7 @@ fn expand_enum(ast: syn::DeriveInput) -> syn::Result<Definition> {
); );
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
Ok(Definition { Ok(Definition {
name, name,
@ -91,7 +94,7 @@ fn expand_enum(ast: syn::DeriveInput) -> syn::Result<Definition> {
/// Parses given Rust enum `var`iant as [GraphQL union][1] variant. /// Parses given Rust enum `var`iant as [GraphQL union][1] variant.
/// ///
/// On failure returns [`None`] and internally fills up [`proc_macro_error`] /// On failure returns [`None`] and internally fills up [`diagnostic`]
/// with the corresponding errors. /// with the corresponding errors.
/// ///
/// [1]: https://spec.graphql.org/October2021#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
@ -101,7 +104,7 @@ fn parse_variant_from_enum_variant(
enum_attr: &Attr, enum_attr: &Attr,
) -> Option<VariantDefinition> { ) -> Option<VariantDefinition> {
let attr = VariantAttr::from_attrs("graphql", &var.attrs) let attr = VariantAttr::from_attrs("graphql", &var.attrs)
.map_err(|e| proc_macro_error::emit_error!(e)) .map_err(diagnostic::emit_error)
.ok()?; .ok()?;
if attr.ignore.is_some() { if attr.ignore.is_some() {
return None; return None;
@ -205,7 +208,7 @@ fn expand_struct(ast: syn::DeriveInput) -> syn::Result<Definition> {
); );
} }
proc_macro_error::abort_if_dirty(); diagnostic::abort_if_dirty();
Ok(Definition { Ok(Definition {
name, name,

View file

@ -108,7 +108,8 @@ mod graphql_union;
mod scalar_value; mod scalar_value;
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro_error::{proc_macro_error, ResultExt as _};
use self::common::diagnostic::{self, ResultExt as _};
/// `#[derive(GraphQLInputObject)]` macro for deriving a /// `#[derive(GraphQLInputObject)]` macro for deriving a
/// [GraphQL input object][0] implementation for a Rust struct. Each /// [GraphQL input object][0] implementation for a Rust struct. Each
@ -213,12 +214,13 @@ use proc_macro_error::{proc_macro_error, ResultExt as _};
/// [0]: https://spec.graphql.org/October2021#sec-Input-Objects /// [0]: https://spec.graphql.org/October2021#sec-Input-Objects
/// [1]: https://spec.graphql.org/October2021#InputFieldsDefinition /// [1]: https://spec.graphql.org/October2021#InputFieldsDefinition
/// [2]: https://spec.graphql.org/October2021#sec-Scalars /// [2]: https://spec.graphql.org/October2021#sec-Scalars
#[proc_macro_error]
#[proc_macro_derive(GraphQLInputObject, attributes(graphql))] #[proc_macro_derive(GraphQLInputObject, attributes(graphql))]
pub fn derive_input_object(input: TokenStream) -> TokenStream { pub fn derive_input_object(input: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
graphql_input_object::derive::expand(input.into()) graphql_input_object::derive::expand(input.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[derive(GraphQLEnum)]` macro for deriving a [GraphQL enum][0] /// `#[derive(GraphQLEnum)]` macro for deriving a [GraphQL enum][0]
@ -342,12 +344,13 @@ pub fn derive_input_object(input: TokenStream) -> TokenStream {
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [0]: https://spec.graphql.org/October2021#sec-Enums /// [0]: https://spec.graphql.org/October2021#sec-Enums
/// [1]: https://spec.graphql.org/October2021#sec-Enum-Value /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value
#[proc_macro_error]
#[proc_macro_derive(GraphQLEnum, attributes(graphql))] #[proc_macro_derive(GraphQLEnum, attributes(graphql))]
pub fn derive_enum(input: TokenStream) -> TokenStream { pub fn derive_enum(input: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
graphql_enum::derive::expand(input.into()) graphql_enum::derive::expand(input.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[derive(GraphQLScalar)]` macro for deriving a [GraphQL scalar][0] /// `#[derive(GraphQLScalar)]` macro for deriving a [GraphQL scalar][0]
@ -654,12 +657,13 @@ pub fn derive_enum(input: TokenStream) -> TokenStream {
/// [0]: https://spec.graphql.org/October2021#sec-Scalars /// [0]: https://spec.graphql.org/October2021#sec-Scalars
/// [1]: https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html /// [1]: https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
#[proc_macro_error]
#[proc_macro_derive(GraphQLScalar, attributes(graphql))] #[proc_macro_derive(GraphQLScalar, attributes(graphql))]
pub fn derive_scalar(input: TokenStream) -> TokenStream { pub fn derive_scalar(input: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
graphql_scalar::derive::expand(input.into()) graphql_scalar::derive::expand(input.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[graphql_scalar]` macro.is interchangeable with /// `#[graphql_scalar]` macro.is interchangeable with
@ -748,12 +752,13 @@ pub fn derive_scalar(input: TokenStream) -> TokenStream {
/// [orphan rules]: https://bit.ly/3glAGC2 /// [orphan rules]: https://bit.ly/3glAGC2
/// [`GraphQLScalar`]: juniper::GraphQLScalar /// [`GraphQLScalar`]: juniper::GraphQLScalar
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
#[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_scalar(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_scalar(attr: TokenStream, body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
graphql_scalar::attr::expand(attr.into(), body.into()) graphql_scalar::attr::expand(attr.into(), body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[derive(ScalarValue)]` macro for deriving a [`ScalarValue`] /// `#[derive(ScalarValue)]` macro for deriving a [`ScalarValue`]
@ -856,12 +861,13 @@ pub fn graphql_scalar(attr: TokenStream, body: TokenStream) -> TokenStream {
/// ``` /// ```
/// ///
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
#[proc_macro_error]
#[proc_macro_derive(ScalarValue, attributes(value))] #[proc_macro_derive(ScalarValue, attributes(value))]
pub fn derive_scalar_value(input: TokenStream) -> TokenStream { pub fn derive_scalar_value(input: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
scalar_value::expand_derive(input.into()) scalar_value::expand_derive(input.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[graphql_interface]` macro for generating a [GraphQL interface][1] /// `#[graphql_interface]` macro for generating a [GraphQL interface][1]
@ -1289,12 +1295,13 @@ pub fn derive_scalar_value(input: TokenStream) -> TokenStream {
/// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety /// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety
/// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html /// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html
/// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html /// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html
#[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_interface(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_interface(attr: TokenStream, body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_interface::attr::expand(attr.into(), body.into()) self::graphql_interface::attr::expand(attr.into(), body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[derive(GraphQLInterface)]` macro for generating a [GraphQL interface][1] /// `#[derive(GraphQLInterface)]` macro for generating a [GraphQL interface][1]
@ -1326,12 +1333,13 @@ pub fn graphql_interface(attr: TokenStream, body: TokenStream) -> TokenStream {
/// ///
/// [`#[graphql_interface]`]: crate::graphql_interface /// [`#[graphql_interface]`]: crate::graphql_interface
/// [1]: https://spec.graphql.org/October2021#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[proc_macro_error]
#[proc_macro_derive(GraphQLInterface, attributes(graphql))] #[proc_macro_derive(GraphQLInterface, attributes(graphql))]
pub fn derive_interface(body: TokenStream) -> TokenStream { pub fn derive_interface(body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_interface::derive::expand(body.into()) self::graphql_interface::derive::expand(body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[derive(GraphQLObject)]` macro for deriving a [GraphQL object][1] /// `#[derive(GraphQLObject)]` macro for deriving a [GraphQL object][1]
@ -1463,12 +1471,13 @@ pub fn derive_interface(body: TokenStream) -> TokenStream {
/// ///
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/October2021#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[proc_macro_error]
#[proc_macro_derive(GraphQLObject, attributes(graphql))] #[proc_macro_derive(GraphQLObject, attributes(graphql))]
pub fn derive_object(body: TokenStream) -> TokenStream { pub fn derive_object(body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_object::derive::expand(body.into()) self::graphql_object::derive::expand(body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[graphql_object]` macro for generating a [GraphQL object][1] /// `#[graphql_object]` macro for generating a [GraphQL object][1]
@ -1788,12 +1797,13 @@ pub fn derive_object(body: TokenStream) -> TokenStream {
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [0]: https://spec.graphql.org/October2021 /// [0]: https://spec.graphql.org/October2021
/// [1]: https://spec.graphql.org/October2021#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_object(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_object(attr: TokenStream, body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_object::attr::expand(attr.into(), body.into()) self::graphql_object::attr::expand(attr.into(), body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[graphql_subscription]` macro for generating a [GraphQL subscription][1] /// `#[graphql_subscription]` macro for generating a [GraphQL subscription][1]
@ -1841,12 +1851,13 @@ pub fn graphql_object(attr: TokenStream, body: TokenStream) -> TokenStream {
/// [`GraphQLSubscriptionValue`]: juniper::GraphQLSubscriptionValue /// [`GraphQLSubscriptionValue`]: juniper::GraphQLSubscriptionValue
/// [`Stream`]: futures::Stream /// [`Stream`]: futures::Stream
/// [1]: https://spec.graphql.org/October2021#sec-Subscription /// [1]: https://spec.graphql.org/October2021#sec-Subscription
#[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_subscription(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_subscription(attr: TokenStream, body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_subscription::attr::expand(attr.into(), body.into()) self::graphql_subscription::attr::expand(attr.into(), body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[derive(GraphQLUnion)]` macro for deriving a [GraphQL union][1] implementation for enums and /// `#[derive(GraphQLUnion)]` macro for deriving a [GraphQL union][1] implementation for enums and
@ -2149,12 +2160,13 @@ pub fn graphql_subscription(attr: TokenStream, body: TokenStream) -> TokenStream
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/October2021#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
/// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html /// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html
#[proc_macro_error]
#[proc_macro_derive(GraphQLUnion, attributes(graphql))] #[proc_macro_derive(GraphQLUnion, attributes(graphql))]
pub fn derive_union(body: TokenStream) -> TokenStream { pub fn derive_union(body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_union::derive::expand(body.into()) self::graphql_union::derive::expand(body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }
/// `#[graphql_union]` macro for deriving a [GraphQL union][1] implementation for traits. /// `#[graphql_union]` macro for deriving a [GraphQL union][1] implementation for traits.
@ -2441,10 +2453,11 @@ pub fn derive_union(body: TokenStream) -> TokenStream {
/// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety /// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety
/// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html /// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html
/// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html /// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html
#[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_union(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_union(attr: TokenStream, body: TokenStream) -> TokenStream {
diagnostic::entry_point(|| {
self::graphql_union::attr::expand(attr.into(), body.into()) self::graphql_union::attr::expand(attr.into(), body.into())
.unwrap_or_abort() .unwrap_or_abort()
.into() .into()
})
} }

View file

@ -2,7 +2,7 @@
name = "juniper_graphql_ws" name = "juniper_graphql_ws"
version = "0.4.0-dev" version = "0.4.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "GraphQL over WebSocket Protocol implementations for `juniper` crate." description = "GraphQL over WebSocket Protocol implementations for `juniper` crate."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = [ authors = [

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_graphql_ws.svg?maxAge=2592000)](https://crates.io/crates/juniper_graphql_ws) [![Crates.io](https://img.shields.io/crates/v/juniper_graphql_ws.svg?maxAge=2592000)](https://crates.io/crates/juniper_graphql_ws)
[![Documentation](https://docs.rs/juniper_graphql_ws/badge.svg)](https://docs.rs/juniper_graphql_ws) [![Documentation](https://docs.rs/juniper_graphql_ws/badge.svg)](https://docs.rs/juniper_graphql_ws)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_graphql_ws/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_graphql_ws/CHANGELOG.md)

View file

@ -2,7 +2,7 @@
name = "juniper_hyper" name = "juniper_hyper"
version = "0.9.0-dev" version = "0.9.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "`juniper` GraphQL integration with `hyper`." description = "`juniper` GraphQL integration with `hyper`."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = ["Damir Vandic <info@dvic.io>"] authors = ["Damir Vandic <info@dvic.io>"]
@ -22,7 +22,7 @@ serde_json = "1.0.18"
tokio = "1.0" tokio = "1.0"
url = "2.0" url = "2.0"
# Fixes for MSRV check. # Fixes for `minimal-versions` check.
# TODO: Try remove on upgrade of `hyper` crate. # TODO: Try remove on upgrade of `hyper` crate.
http-body = "0.4.5" http-body = "0.4.5"

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_hyper.svg?maxAge=2592000)](https://crates.io/crates/juniper_hyper) [![Crates.io](https://img.shields.io/crates/v/juniper_hyper.svg?maxAge=2592000)](https://crates.io/crates/juniper_hyper)
[![Documentation](https://docs.rs/juniper_hyper/badge.svg)](https://docs.rs/juniper_hyper) [![Documentation](https://docs.rs/juniper_hyper/badge.svg)](https://docs.rs/juniper_hyper)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_hyper/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_hyper/CHANGELOG.md)

View file

@ -2,7 +2,7 @@
name = "juniper_iron" name = "juniper_iron"
version = "0.8.0-dev" version = "0.8.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "`juniper` GraphQL integration with `iron`." description = "`juniper` GraphQL integration with `iron`."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = [ authors = [

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_iron.svg?maxAge=2592000)](https://crates.io/crates/juniper_iron) [![Crates.io](https://img.shields.io/crates/v/juniper_iron.svg?maxAge=2592000)](https://crates.io/crates/juniper_iron)
[![Documentation](https://docs.rs/juniper_iron/badge.svg)](https://docs.rs/juniper_iron) [![Documentation](https://docs.rs/juniper_iron/badge.svg)](https://docs.rs/juniper_iron)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_iron/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_iron/CHANGELOG.md)

View file

@ -2,7 +2,7 @@
name = "juniper_rocket" name = "juniper_rocket"
version = "0.9.0-dev" version = "0.9.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "`juniper` GraphQL integration with `rocket`." description = "`juniper` GraphQL integration with `rocket`."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = [ authors = [
@ -23,7 +23,7 @@ juniper = { version = "0.16.0-dev", path = "../juniper", default-features = fals
rocket = { version = "=0.5.0-rc.3", default-features = false } rocket = { version = "=0.5.0-rc.3", default-features = false }
serde_json = "1.0.18" serde_json = "1.0.18"
# Fixes for MSRV check. # Fixes for `minimal-versions` check.
# TODO: Try remove on upgrade of `rocket` crate. # TODO: Try remove on upgrade of `rocket` crate.
either = "1.8" either = "1.8"
inlinable_string = "0.1.15" inlinable_string = "0.1.15"

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_rocket.svg?maxAge=2592000)](https://crates.io/crates/juniper_rocket) [![Crates.io](https://img.shields.io/crates/v/juniper_rocket.svg?maxAge=2592000)](https://crates.io/crates/juniper_rocket)
[![Documentation](https://docs.rs/juniper_rocket/badge.svg)](https://docs.rs/juniper_rocket) [![Documentation](https://docs.rs/juniper_rocket/badge.svg)](https://docs.rs/juniper_rocket)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_rocket/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_rocket/CHANGELOG.md)

View file

@ -2,7 +2,7 @@
name = "juniper_subscriptions" name = "juniper_subscriptions"
version = "0.17.0-dev" version = "0.17.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "Juniper `SubscriptionCoordinator` and `SubscriptionConnection` implementations." description = "Juniper `SubscriptionCoordinator` and `SubscriptionConnection` implementations."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = ["nWacky <gosha.evtushenko@gmail.com>"] authors = ["nWacky <gosha.evtushenko@gmail.com>"]

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_subscriptions.svg?maxAge=2592000)](https://crates.io/crates/juniper_subscriptions) [![Crates.io](https://img.shields.io/crates/v/juniper_subscriptions.svg?maxAge=2592000)](https://crates.io/crates/juniper_subscriptions)
[![Documentation](https://docs.rs/juniper_subscriptions/badge.svg)](https://docs.rs/juniper_subscriptions) [![Documentation](https://docs.rs/juniper_subscriptions/badge.svg)](https://docs.rs/juniper_subscriptions)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_subscriptions/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_subscriptions/CHANGELOG.md)

View file

@ -2,7 +2,7 @@
name = "juniper_warp" name = "juniper_warp"
version = "0.8.0-dev" version = "0.8.0-dev"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.73"
description = "`juniper` GraphQL integration with `warp`." description = "`juniper` GraphQL integration with `warp`."
license = "BSD-2-Clause" license = "BSD-2-Clause"
authors = ["Tom Houlé <tom@tomhoule.com>"] authors = ["Tom Houlé <tom@tomhoule.com>"]
@ -37,7 +37,7 @@ thiserror = "1.0"
tokio = { version = "1.0", features = ["rt-multi-thread"] } tokio = { version = "1.0", features = ["rt-multi-thread"] }
warp = { version = "0.3.2", default-features = false } warp = { version = "0.3.2", default-features = false }
# Fixes for MSRV check. # Fixes for `minimal-versions` check.
# TODO: Try remove on upgrade of `warp` crate. # TODO: Try remove on upgrade of `warp` crate.
headers = "0.3.8" headers = "0.3.8"

View file

@ -4,7 +4,7 @@
[![Crates.io](https://img.shields.io/crates/v/juniper_warp.svg?maxAge=2592000)](https://crates.io/crates/juniper_warp) [![Crates.io](https://img.shields.io/crates/v/juniper_warp.svg?maxAge=2592000)](https://crates.io/crates/juniper_warp)
[![Documentation](https://docs.rs/juniper_warp/badge.svg)](https://docs.rs/juniper_warp) [![Documentation](https://docs.rs/juniper_warp/badge.svg)](https://docs.rs/juniper_warp)
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster) [![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html) [![Rust 1.73+](https://img.shields.io/badge/rustc-1.73+-lightgray.svg "Rust 1.73+")](https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html)
- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_warp/CHANGELOG.md) - [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_warp/CHANGELOG.md)

View file

@ -1,7 +1,5 @@
error: GraphQL enum expected all GraphQL enum values to have unique names error: GraphQL enum expected all GraphQL enum values to have unique names
--> fail/enum/derive_duplicated_value_names.rs:5:5 --> fail/enum/derive_duplicated_value_names.rs:5:5
| |
5 | / Test, 5 | Test,
6 | | #[graphql(name = "TEST")] | ^^^^
7 | | Test1,
| |__________^

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/enum/derive_name_double_underscored.rs:4:6 --> fail/enum/derive_name_double_underscored.rs:4:6
| |
4 | enum __Test { 4 | enum __Test {
| ^^^^^^ | ^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,7 +1,6 @@
error: GraphQL enum no fields allowed for non-ignored variants error: GraphQL enum no fields allowed for non-ignored variants
· note: https://spec.graphql.org/October2021#sec-Enums
--> fail/enum/derive_variant_with_field.rs:5:12 --> fail/enum/derive_variant_with_field.rs:5:12
| |
5 | Variant(i32), 5 | Variant(i32),
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Enums

View file

@ -2,4 +2,4 @@ error: GraphQL enum can only be derived on enums
--> fail/enum/derive_wrong_item.rs:4:1 --> fail/enum/derive_wrong_item.rs:4:1
| |
4 | struct Test {} 4 | struct Test {}
| ^^^^^^^^^^^^^^ | ^^^^^^

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
--> fail/input-object/derive_incompatible_field_type.rs:10:12 --> fail/input-object/derive_incompatible_field_type.rs:8:10
| |
10 | field: ObjectA, 8 | #[derive(GraphQLInputObject)]
| ^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA` | ^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
| |
= help: the following other types implement trait `IsInputType<S>`: = help: the following other types implement trait `IsInputType<S>`:
<bool as IsInputType<__S>> <bool as IsInputType<__S>>
@ -14,15 +14,13 @@ error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
<url::Url as IsInputType<__S>> <url::Url as IsInputType<__S>>
<bson::datetime::DateTime as IsInputType<__S>> <bson::datetime::DateTime as IsInputType<__S>>
and $N others and $N others
= note: this error originates in the derive macro `GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
--> fail/input-object/derive_incompatible_field_type.rs:10:12 --> fail/input-object/derive_incompatible_field_type.rs:8:10
| |
8 | #[derive(GraphQLInputObject)] 8 | #[derive(GraphQLInputObject)]
| ------------------ required by a bound introduced by this call | ^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
9 | struct Object {
10 | field: ObjectA,
| ^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
| |
= help: the following other types implement trait `FromInputValue<S>`: = help: the following other types implement trait `FromInputValue<S>`:
<bool as FromInputValue<__S>> <bool as FromInputValue<__S>>
@ -42,6 +40,7 @@ note: required by a bound in `Registry::<'r, S>::arg`
| where | where
| T: GraphQLType<S> + FromInputValue<S>, | T: GraphQLType<S> + FromInputValue<S>,
| ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg` | ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg`
= note: this error originates in the derive macro `GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
--> fail/input-object/derive_incompatible_field_type.rs:8:10 --> fail/input-object/derive_incompatible_field_type.rs:8:10

View file

@ -1,8 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/input-object/derive_no_underscore.rs:5:5 --> fail/input-object/derive_no_underscore.rs:5:5
| |
5 | / #[graphql(name = "__test")] 5 | #[graphql(name = "__test")]
6 | | test: String, | ^
| |________________^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -2,4 +2,4 @@ error: GraphQL interface #[graphql_interface] attribute is applicable to trait a
--> fail/interface/attr_wrong_item.rs:9:1 --> fail/interface/attr_wrong_item.rs:9:1
| |
9 | enum Character {} 9 | enum Character {}
| ^^^^^^^^^^^^^^^^^ | ^^^^

View file

@ -1,6 +1,5 @@
error: GraphQL interface can only be derived on structs error: GraphQL interface can only be derived on structs
--> fail/interface/derive_wrong_item.rs:9:1 --> fail/interface/derive_wrong_item.rs:9:1
| |
9 | / #[graphql(for = ObjA)] 9 | #[graphql(for = ObjA)]
10 | | enum Character {} | ^
| |_________________^

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/struct/attr_field_double_underscored.rs:5:5 --> fail/interface/struct/attr_field_double_underscored.rs:5:5
| |
5 | __id: String, 5 | __id: String,
| ^^^^ | ^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/struct/attr_field_non_output_return_type.rs:8:1 --> fail/interface/struct/attr_field_non_output_return_type.rs:10:9
| |
8 | #[graphql_interface] 10 | id: ObjB,
| ^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB` | ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
| |
= help: the following other types implement trait `IsOutputType<S>`: = help: the following other types implement trait `IsOutputType<S>`:
<bool as IsOutputType<__S>> <bool as IsOutputType<__S>>

View file

@ -1,12 +1,6 @@
error: GraphQL interface must have a different name for each field error: GraphQL interface must have a different name for each field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/struct/attr_fields_duplicate.rs:4:1 --> fail/interface/struct/attr_fields_duplicate.rs:4:1
| |
4 | / struct Character { 4 | struct Character {
5 | | id: String, | ^^^^^^
6 | |
7 | | #[graphql(name = "id")]
8 | | id2: String,
9 | | }
| |_^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -13,27 +13,3 @@ error[E0080]: evaluation of constant value failed
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5 | ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5
| |
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/attr_missing_field.rs:11:5
|
11 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: reflect::Field<__S, 11301463986558097276003903130001171064>` is not satisfied
--> fail/interface/struct/attr_missing_field.rs:11:5
|
11 | id: String,
| ^^ the trait `reflect::Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
|
= help: the trait `reflect::Field<__S, 140650918148392961738240285796466530725>` is implemented for `ObjA`
error[E0277]: the trait bound `ObjA: AsyncField<__S, 11301463986558097276003903130001171064>` is not satisfied
--> fail/interface/struct/attr_missing_field.rs:11:5
|
11 | id: String,
| ^^ the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
|
= help: the trait `AsyncField<__S, 140650918148392961738240285796466530725>` is implemented for `ObjA`

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/struct/attr_name_double_underscored.rs:4:8 --> fail/interface/struct/attr_name_double_underscored.rs:4:8
| |
4 | struct __Character { 4 | struct __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,7 +1,6 @@
error: GraphQL interface must have at least one field error: GraphQL interface must have at least one field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/struct/attr_no_fields.rs:4:1 --> fail/interface/struct/attr_no_fields.rs:4:1
| |
4 | struct Character {} 4 | struct Character {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -1,7 +1,6 @@
error: GraphQL interface expected named struct field error: GraphQL interface expected named struct field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/struct/attr_unnamed_field.rs:4:18 --> fail/interface/struct/attr_unnamed_field.rs:4:18
| |
4 | struct Character(i32); 4 | struct Character(i32);
| ^^^ | ^^^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/struct/derive_field_double_underscored.rs:5:5 --> fail/interface/struct/derive_field_double_underscored.rs:5:5
| |
5 | __id: String, 5 | __id: String,
| ^^^^ | ^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/struct/derive_field_non_output_return_type.rs:8:10 --> fail/interface/struct/derive_field_non_output_return_type.rs:10:9
| |
8 | #[derive(GraphQLInterface)] 10 | id: ObjB,
| ^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB` | ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
| |
= help: the following other types implement trait `IsOutputType<S>`: = help: the following other types implement trait `IsOutputType<S>`:
<bool as IsOutputType<__S>> <bool as IsOutputType<__S>>

View file

@ -1,12 +1,6 @@
error: GraphQL interface must have a different name for each field error: GraphQL interface must have a different name for each field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/struct/derive_fields_duplicate.rs:4:1 --> fail/interface/struct/derive_fields_duplicate.rs:4:1
| |
4 | / struct Character { 4 | struct Character {
5 | | id: String, | ^^^^^^
6 | |
7 | | #[graphql(name = "id")]
8 | | id2: String,
9 | | }
| |_^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -13,27 +13,3 @@ error[E0080]: evaluation of constant value failed
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5 | ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5
| |
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/derive_missing_field.rs:12:5
|
12 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: reflect::Field<__S, 11301463986558097276003903130001171064>` is not satisfied
--> fail/interface/struct/derive_missing_field.rs:12:5
|
12 | id: String,
| ^^ the trait `reflect::Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
|
= help: the trait `reflect::Field<__S, 140650918148392961738240285796466530725>` is implemented for `ObjA`
error[E0277]: the trait bound `ObjA: AsyncField<__S, 11301463986558097276003903130001171064>` is not satisfied
--> fail/interface/struct/derive_missing_field.rs:12:5
|
12 | id: String,
| ^^ the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
|
= help: the trait `AsyncField<__S, 140650918148392961738240285796466530725>` is implemented for `ObjA`

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/struct/derive_name_double_underscored.rs:4:8 --> fail/interface/struct/derive_name_double_underscored.rs:4:8
| |
4 | struct __Character { 4 | struct __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,7 +1,6 @@
error: GraphQL interface must have at least one field error: GraphQL interface must have at least one field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/struct/derive_no_fields.rs:4:1 --> fail/interface/struct/derive_no_fields.rs:4:1
| |
4 | struct Character {} 4 | struct Character {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -1,7 +1,6 @@
error: GraphQL interface expected named struct field error: GraphQL interface expected named struct field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/struct/derive_unnamed_field.rs:4:18 --> fail/interface/struct/derive_unnamed_field.rs:4:18
| |
4 | struct Character(i32); 4 | struct Character(i32);
| ^^^ | ^^^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/trait/argument_double_underscored.rs:5:18 --> fail/interface/trait/argument_double_underscored.rs:5:18
| |
5 | fn id(&self, __num: i32) -> &str; 5 | fn id(&self, __num: i32) -> &str;
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -16,13 +16,10 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
and $N others and $N others
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/interface/trait/argument_non_input_type.rs:10:23 --> fail/interface/trait/argument_non_input_type.rs:8:1
| |
8 | #[graphql_interface] 8 | #[graphql_interface]
| -------------------- required by a bound introduced by this call | ^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
9 | trait Character {
10 | fn id(&self, obj: ObjA) -> &str;
| ^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
| |
= help: the following other types implement trait `FromInputValue<S>`: = help: the following other types implement trait `FromInputValue<S>`:
<bool as FromInputValue<__S>> <bool as FromInputValue<__S>>
@ -42,3 +39,4 @@ note: required by a bound in `Registry::<'r, S>::arg`
| where | where
| T: GraphQLType<S> + FromInputValue<S>, | T: GraphQLType<S> + FromInputValue<S>,
| ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg` | ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg`
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/trait/field_double_underscored.rs:5:8 --> fail/interface/trait/field_double_underscored.rs:5:8
| |
5 | fn __id(&self) -> &str; 5 | fn __id(&self) -> &str;
| ^^^^ | ^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/trait/field_non_output_return_type.rs:8:1 --> fail/interface/trait/field_non_output_return_type.rs:10:21
| |
8 | #[graphql_interface] 10 | fn id(&self) -> ObjB;
| ^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB` | ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
| |
= help: the following other types implement trait `IsOutputType<S>`: = help: the following other types implement trait `IsOutputType<S>`:
<bool as IsOutputType<__S>> <bool as IsOutputType<__S>>

View file

@ -1,12 +1,6 @@
error: GraphQL interface must have a different name for each field error: GraphQL interface must have a different name for each field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/trait/fields_duplicate.rs:4:1 --> fail/interface/trait/fields_duplicate.rs:4:1
| |
4 | / trait Character { 4 | trait Character {
5 | | fn id(&self) -> &str; | ^^^^^
6 | |
7 | | #[graphql(name = "id")]
8 | | fn id2(&self) -> &str;
9 | | }
| |_^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -1,4 +1,5 @@
error: GraphQL interface trait method can't have default implementation error: GraphQL interface trait method can't have default implementation
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/trait/method_default_impl.rs:5:26 --> fail/interface/trait/method_default_impl.rs:5:26
| |
5 | fn id(&self) -> &str { 5 | fn id(&self) -> &str {
@ -6,5 +7,3 @@ error: GraphQL interface trait method can't have default implementation
6 | | "default" 6 | | "default"
7 | | } 7 | | }
| |_____^ | |_____^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -13,27 +13,3 @@ error[E0080]: evaluation of constant value failed
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8 | ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8
| |
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: evaluation of constant value failed
--> fail/interface/trait/missing_field.rs:11:8
|
11 | fn id(&self) -> &str;
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: reflect::Field<__S, 11301463986558097276003903130001171064>` is not satisfied
--> fail/interface/trait/missing_field.rs:11:8
|
11 | fn id(&self) -> &str;
| ^^ the trait `reflect::Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
|
= help: the trait `reflect::Field<__S, 140650918148392961738240285796466530725>` is implemented for `ObjA`
error[E0277]: the trait bound `ObjA: AsyncField<__S, 11301463986558097276003903130001171064>` is not satisfied
--> fail/interface/trait/missing_field.rs:11:8
|
11 | fn id(&self) -> &str;
| ^^ the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
|
= help: the trait `AsyncField<__S, 140650918148392961738240285796466530725>` is implemented for `ObjA`

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/interface/trait/name_double_underscored.rs:4:7 --> fail/interface/trait/name_double_underscored.rs:4:7
| |
4 | trait __Character { 4 | trait __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,7 +1,6 @@
error: GraphQL interface must have at least one field error: GraphQL interface must have at least one field
· note: https://spec.graphql.org/October2021#sec-Interfaces
--> fail/interface/trait/no_fields.rs:4:1 --> fail/interface/trait/no_fields.rs:4:1
| |
4 | trait Character {} 4 | trait Character {}
| ^^^^^^^^^^^^^^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/object/argument_double_underscored.rs:7:18 --> fail/object/argument_double_underscored.rs:7:18
| |
7 | fn id(&self, __num: i32) -> &str { 7 | fn id(&self, __num: i32) -> &str {
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -16,13 +16,10 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
and $N others and $N others
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/object/argument_non_input_type.rs:12:23 --> fail/object/argument_non_input_type.rs:10:1
| |
10 | #[graphql_object] 10 | #[graphql_object]
| ----------------- required by a bound introduced by this call | ^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
11 | impl ObjB {
12 | fn id(&self, obj: ObjA) -> &str {
| ^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
| |
= help: the following other types implement trait `FromInputValue<S>`: = help: the following other types implement trait `FromInputValue<S>`:
<bool as FromInputValue<__S>> <bool as FromInputValue<__S>>
@ -42,6 +39,7 @@ note: required by a bound in `Registry::<'r, S>::arg`
| where | where
| T: GraphQLType<S> + FromInputValue<S>, | T: GraphQLType<S> + FromInputValue<S>,
| ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg` | ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg`
= note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/object/argument_non_input_type.rs:10:1 --> fail/object/argument_non_input_type.rs:10:1
@ -60,20 +58,3 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>> <juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
and $N others and $N others
= note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/object/argument_non_input_type.rs:12:23
|
12 | fn id(&self, obj: ObjA) -> &str {
| ^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
|
= help: the following other types implement trait `FromInputValue<S>`:
<bool as FromInputValue<__S>>
<i32 as FromInputValue<__S>>
<f64 as FromInputValue<__S>>
<Box<T> as FromInputValue<S>>
<uuid::Uuid as FromInputValue<__S>>
<url::Url as FromInputValue<__S>>
<bson::datetime::DateTime as FromInputValue<__S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
and $N others

View file

@ -1,5 +1,5 @@
error: #[graphql_object] attribute is applicable to non-trait `impl` blocks only error: #[graphql_object] attribute is applicable to non-trait `impl` blocks only
--> $DIR/attr_field_double_underscored.rs:5:1 --> fail/object/attr_field_double_underscored.rs:5:1
| |
5 | #[graphql_object] 5 | #[graphql_object]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/object/attr_field_non_output_return_type.rs:10:1 --> fail/object/attr_field_non_output_return_type.rs:12:21
| |
10 | #[graphql_object] 12 | fn id(&self) -> ObjB {
| ^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB` | ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
| |
= help: the following other types implement trait `IsOutputType<S>`: = help: the following other types implement trait `IsOutputType<S>`:
<bool as IsOutputType<__S>> <bool as IsOutputType<__S>>

View file

@ -1,7 +1,6 @@
error: GraphQL object must have a different name for each field error: GraphQL object must have a different name for each field
· note: https://spec.graphql.org/October2021#sec-Objects
--> fail/object/attr_fields_duplicate.rs:6:6 --> fail/object/attr_fields_duplicate.rs:6:6
| |
6 | impl ObjA { 6 | impl ObjA {
| ^^^^ | ^^^^
|
= note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/object/attr_name_double_underscored.rs:6:6 --> fail/object/attr_name_double_underscored.rs:6:6
| |
6 | impl __Obj { 6 | impl __Obj {
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,7 +1,6 @@
error: GraphQL object must have at least one field error: GraphQL object must have at least one field
· note: https://spec.graphql.org/October2021#sec-Objects
--> fail/object/attr_no_fields.rs:6:6 --> fail/object/attr_no_fields.rs:6:6
| |
6 | impl Obj {} 6 | impl Obj {}
| ^^^ | ^^^
|
= note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -1,5 +1,5 @@
error: #[graphql_object] attribute is applicable to non-trait `impl` blocks only error: #[graphql_object] attribute is applicable to non-trait `impl` blocks only
--> $DIR/attr_wrong_item.rs:3:1 --> fail/object/attr_wrong_item.rs:3:1
| |
3 | #[graphql_object] 3 | #[graphql_object]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/object/derive_field_double_underscored.rs:5:5 --> fail/object/derive_field_double_underscored.rs:5:5
| |
5 | __test: String, 5 | __test: String,
| ^^^^^^ | ^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/object/derive_field_non_output_return_type.rs:8:10 --> fail/object/derive_field_non_output_return_type.rs:10:9
| |
8 | #[derive(GraphQLObject)] 10 | id: ObjB,
| ^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB` | ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
| |
= help: the following other types implement trait `IsOutputType<S>`: = help: the following other types implement trait `IsOutputType<S>`:
<bool as IsOutputType<__S>> <bool as IsOutputType<__S>>

View file

@ -1,11 +1,6 @@
error: GraphQL object must have a different name for each field error: GraphQL object must have a different name for each field
· note: https://spec.graphql.org/October2021#sec-Objects
--> fail/object/derive_fields_duplicate.rs:4:1 --> fail/object/derive_fields_duplicate.rs:4:1
| |
4 | / struct ObjA { 4 | struct ObjA {
5 | | id: String, | ^^^^^^
6 | | #[graphql(name = "id")]
7 | | id2: String,
8 | | }
| |_^
|
= note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/object/derive_name_double_underscored.rs:4:8 --> fail/object/derive_name_double_underscored.rs:4:8
| |
4 | struct __Obj { 4 | struct __Obj {
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -1,7 +1,6 @@
error: GraphQL object must have at least one field error: GraphQL object must have at least one field
· note: https://spec.graphql.org/October2021#sec-Objects
--> fail/object/derive_no_fields.rs:4:1 --> fail/object/derive_no_fields.rs:4:1
| |
4 | struct Obj {} 4 | struct Obj {}
| ^^^^^^^^^^^^^ | ^^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -2,4 +2,4 @@ error: GraphQL object can only be derived for structs
--> fail/object/derive_wrong_item.rs:4:1 --> fail/object/derive_wrong_item.rs:4:1
| |
4 | enum Character {} 4 | enum Character {}
| ^^^^^^^^^^^^^^^^^ | ^^^^

View file

@ -1,8 +1,5 @@
error: GraphQL scalar `transparent` attribute argument requires exactly 1 field error: GraphQL scalar `transparent` attribute argument requires exactly 1 field
--> fail/scalar/derive_input/attr_transparent_multiple_named_fields.rs:4:1 --> fail/scalar/derive_input/attr_transparent_multiple_named_fields.rs:4:1
| |
4 | / struct Scalar { 4 | struct Scalar {
5 | | id: i32, | ^^^^^^
6 | | another: i32,
7 | | }
| |_^

View file

@ -2,4 +2,4 @@ error: GraphQL scalar `transparent` attribute argument requires exactly 1 field
--> fail/scalar/derive_input/attr_transparent_multiple_unnamed_fields.rs:4:1 --> fail/scalar/derive_input/attr_transparent_multiple_unnamed_fields.rs:4:1
| |
4 | struct Scalar(i32, i32); 4 | struct Scalar(i32, i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^

View file

@ -2,4 +2,4 @@ error: GraphQL scalar `transparent` attribute argument requires exactly 1 field
--> fail/scalar/derive_input/attr_transparent_unit_struct.rs:4:1 --> fail/scalar/derive_input/attr_transparent_unit_struct.rs:4:1
| |
4 | struct ScalarSpecifiedByUrl; 4 | struct ScalarSpecifiedByUrl;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^

View file

@ -1,9 +1,5 @@
error: GraphQL scalar `transparent` attribute argument requires exactly 1 field error: GraphQL scalar `transparent` attribute argument requires exactly 1 field
--> fail/scalar/derive_input/derive_transparent_multiple_named_fields.rs:4:1 --> fail/scalar/derive_input/derive_transparent_multiple_named_fields.rs:4:1
| |
4 | / #[graphql(transparent)] 4 | #[graphql(transparent)]
5 | | struct Scalar { | ^
6 | | id: i32,
7 | | another: i32,
8 | | }
| |_^

View file

@ -1,6 +1,5 @@
error: GraphQL scalar `transparent` attribute argument requires exactly 1 field error: GraphQL scalar `transparent` attribute argument requires exactly 1 field
--> fail/scalar/derive_input/derive_transparent_multiple_unnamed_fields.rs:4:1 --> fail/scalar/derive_input/derive_transparent_multiple_unnamed_fields.rs:4:1
| |
4 | / #[graphql(transparent)] 4 | #[graphql(transparent)]
5 | | struct Scalar(i32, i32); | ^
| |________________________^

View file

@ -1,6 +1,5 @@
error: GraphQL scalar `transparent` attribute argument requires exactly 1 field error: GraphQL scalar `transparent` attribute argument requires exactly 1 field
--> fail/scalar/derive_input/derive_transparent_unit_struct.rs:4:1 --> fail/scalar/derive_input/derive_transparent_unit_struct.rs:4:1
| |
4 | / #[graphql(transparent)] 4 | #[graphql(transparent)]
5 | | struct ScalarSpecifiedByUrl; | ^
| |____________________________^

View file

@ -2,4 +2,4 @@ error: GraphQL scalar all the resolvers have to be provided via `with` attribute
--> fail/scalar/type_alias/attr_with_not_all_resolvers.rs:6:1 --> fail/scalar/type_alias/attr_with_not_all_resolvers.rs:6:1
| |
6 | type CustomScalar = Scalar; 6 | type CustomScalar = Scalar;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^

View file

@ -2,4 +2,4 @@ error: GraphQL scalar all the resolvers have to be provided via `with` attribute
--> fail/scalar/type_alias/attr_without_resolvers.rs:6:1 --> fail/scalar/type_alias/attr_without_resolvers.rs:6:1
| |
6 | type CustomScalar = Scalar; 6 | type CustomScalar = Scalar;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^

View file

@ -1,11 +1,5 @@
error: GraphQL built-in scalars missing `#[value(as_int, as_float)]` attributes. In case you are sure that it's ok, use `#[value(allow_missing_attributes)]` to suppress this error. error: GraphQL built-in scalars missing `#[value(as_int, as_float)]` attributes. In case you are sure that it's ok, use `#[value(allow_missing_attributes)]` to suppress this error.
--> fail/scalar_value/missing_attributes.rs:4:1 --> fail/scalar_value/missing_attributes.rs:4:1
| |
4 | / pub enum DefaultScalarValue { 4 | pub enum DefaultScalarValue {
5 | | Int(i32), | ^^^
6 | | Float(f64),
7 | | #[value(as_str, as_string, into_string)]
... |
10 | | Boolean(bool),
11 | | }
| |_^

View file

@ -2,4 +2,4 @@ error: GraphQL built-in scalars can only be derived for enums
--> fail/scalar_value/not_enum.rs:2:1 --> fail/scalar_value/not_enum.rs:2:1
| |
2 | struct ScalarValue; 2 | struct ScalarValue;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/subscription/argument_double_underscored.rs:11:24 --> fail/subscription/argument_double_underscored.rs:11:24
| |
11 | async fn id(&self, __num: i32) -> Stream<'static, &'static str> { 11 | async fn id(&self, __num: i32) -> Stream<'static, &'static str> {
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -24,13 +24,10 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
and $N others and $N others
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/subscription/argument_non_input_type.rs:17:29 --> fail/subscription/argument_non_input_type.rs:15:1
| |
15 | #[graphql_subscription] 15 | #[graphql_subscription]
| ----------------------- required by a bound introduced by this call | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
16 | impl ObjB {
17 | async fn id(&self, obj: ObjA) -> Stream<'static, &'static str> {
| ^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
| |
= help: the following other types implement trait `FromInputValue<S>`: = help: the following other types implement trait `FromInputValue<S>`:
<bool as FromInputValue<__S>> <bool as FromInputValue<__S>>
@ -50,6 +47,7 @@ note: required by a bound in `Registry::<'r, S>::arg`
| where | where
| T: GraphQLType<S> + FromInputValue<S>, | T: GraphQLType<S> + FromInputValue<S>,
| ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg` | ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg`
= note: this error originates in the attribute macro `graphql_subscription` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/subscription/argument_non_input_type.rs:15:1 --> fail/subscription/argument_non_input_type.rs:15:1
@ -68,20 +66,3 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>> <juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
and $N others and $N others
= note: this error originates in the attribute macro `graphql_subscription` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the attribute macro `graphql_subscription` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/subscription/argument_non_input_type.rs:17:29
|
17 | async fn id(&self, obj: ObjA) -> Stream<'static, &'static str> {
| ^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
|
= help: the following other types implement trait `FromInputValue<S>`:
<bool as FromInputValue<__S>>
<i32 as FromInputValue<__S>>
<f64 as FromInputValue<__S>>
<Box<T> as FromInputValue<S>>
<uuid::Uuid as FromInputValue<__S>>
<url::Url as FromInputValue<__S>>
<bson::datetime::DateTime as FromInputValue<__S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
and $N others

View file

@ -1,5 +1,5 @@
error: #[graphql_subscription] attribute is applicable to non-trait `impl` blocks only error: #[graphql_subscription] attribute is applicable to non-trait `impl` blocks only
--> $DIR/field_double_underscored.rs:9:1 --> fail/subscription/field_double_underscored.rs:9:1
| |
9 | #[graphql_subscription] 9 | #[graphql_subscription]
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/subscription/field_non_output_return_type.rs:15:1 --> fail/subscription/field_non_output_return_type.rs:17:27
| |
15 | #[graphql_subscription] 17 | async fn id(&self) -> Stream<'static, ObjB> {
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB` | ^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
| |
= help: the following other types implement trait `IsOutputType<S>`: = help: the following other types implement trait `IsOutputType<S>`:
<bool as IsOutputType<__S>> <bool as IsOutputType<__S>>

View file

@ -1,8 +1,7 @@
error: GraphQL object synchronous resolvers are not supported error: GraphQL object synchronous resolvers are not supported
· note: https://spec.graphql.org/October2021#sec-Objects
· note: Specify that this function is async: `async fn foo()`
--> fail/subscription/field_not_async.rs:11:5 --> fail/subscription/field_not_async.rs:11:5
| |
11 | fn id(&self) -> Stream<'static, bool> { 11 | fn id(&self) -> Stream<'static, bool> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^
|
= note: https://spec.graphql.org/October2021#sec-Objects
= note: Specify that this function is async: `async fn foo()`

View file

@ -1,7 +1,6 @@
error: GraphQL object must have a different name for each field error: GraphQL object must have a different name for each field
· note: https://spec.graphql.org/October2021#sec-Objects
--> fail/subscription/fields_duplicate.rs:10:6 --> fail/subscription/fields_duplicate.rs:10:6
| |
10 | impl ObjA { 10 | impl ObjA {
| ^^^^ | ^^^^
|
= note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -1,7 +1,6 @@
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system. error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQLs introspection system.
· note: https://spec.graphql.org/October2021#sec-Schema
--> fail/subscription/name_double_underscored.rs:10:6 --> fail/subscription/name_double_underscored.rs:10:6
| |
10 | impl __Obj { 10 | impl __Obj {
| ^^^^^ | ^^^^^
|
= note: https://spec.graphql.org/October2021#sec-Schema

Some files were not shown because too many files have changed in this diff Show more