diff --git a/juniper/Cargo.toml b/juniper/Cargo.toml index 5c5fbc70c..bbf55964f 100644 --- a/juniper/Cargo.toml +++ b/juniper/Cargo.toml @@ -38,7 +38,7 @@ schema-language = ["graphql-parser"] anyhow = { version = "1.0.32", default-features = false, optional = true } async-trait = "0.1.39" bigdecimal = { version = "0.3", optional = true } -bson = { version = "2.0", features = ["chrono-0_4"], optional = true } +bson = { version = "2.3", features = ["chrono-0_4"], optional = true } chrono = { version = "0.4", features = ["alloc"], default-features = false, optional = true } chrono-tz = { version = "0.6", default-features = false, optional = true } fnv = "1.0.3" diff --git a/juniper/src/integrations/bson.rs b/juniper/src/integrations/bson.rs index f22691b2b..8d904025f 100644 --- a/juniper/src/integrations/bson.rs +++ b/juniper/src/integrations/bson.rs @@ -28,7 +28,10 @@ mod utc_date_time { use super::*; pub(super) fn to_output(v: &UtcDateTime) -> Value { - Value::scalar((*v).to_rfc3339_string()) + Value::scalar( + (*v).try_to_rfc3339_string() + .unwrap_or_else(|e| panic!("failed to format `UtcDateTime` as RFC3339: {}", e)), + ) } pub(super) fn from_input(v: &InputValue) -> Result { diff --git a/juniper_codegen/src/derive_enum.rs b/juniper_codegen/src/derive_enum.rs deleted file mode 100644 index 458bc43ea..000000000 --- a/juniper_codegen/src/derive_enum.rs +++ /dev/null @@ -1,153 +0,0 @@ -use proc_macro2::TokenStream; -use quote::quote; -use syn::{ext::IdentExt, spanned::Spanned, Data, Fields}; - -use crate::{ - result::{GraphQLScope, UnsupportedAttribute}, - util::{self, span_container::SpanContainer, RenameRule}, -}; - -pub fn impl_enum(ast: syn::DeriveInput, error: GraphQLScope) -> syn::Result { - let ast_span = ast.span(); - - if !ast.generics.params.is_empty() { - return Err(error.custom_error(ast_span, "does not support generics or lifetimes")); - } - - let variants = match ast.data { - Data::Enum(enum_data) => enum_data.variants, - _ => return Err(error.custom_error(ast_span, "can only be applied to enums")), - }; - - // Parse attributes. - let attrs = util::ObjectAttributes::from_attrs(&ast.attrs)?; - let ident = &ast.ident; - let name = attrs - .name - .clone() - .map(SpanContainer::into_inner) - .unwrap_or_else(|| ident.unraw().to_string()); - - let fields = variants - .into_iter() - .filter_map(|field| { - let span = field.span(); - let field_attrs = match util::FieldAttributes::from_attrs( - &field.attrs, - util::FieldAttributeParseMode::Object, - ) { - Ok(attrs) => attrs, - Err(err) => { - proc_macro_error::emit_error!(err); - return None; - } - }; - - let field_name = field.ident; - let name = field_attrs - .name - .clone() - .map(SpanContainer::into_inner) - .unwrap_or_else(|| { - attrs - .rename - .unwrap_or(RenameRule::ScreamingSnakeCase) - .apply(&field_name.unraw().to_string()) - }); - - let resolver_code = quote!( #ident::#field_name ); - - let _type = match field.fields { - Fields::Unit => syn::parse_str(&field_name.to_string()).unwrap(), - _ => { - error.emit_custom( - field.fields.span(), - "all fields of the enum must be unnamed, e.g., None", - ); - return None; - } - }; - - if let Some(skip) = field_attrs.skip { - error.unsupported_attribute(skip.span(), UnsupportedAttribute::Skip); - return None; - } - - if name.starts_with("__") { - error.no_double_underscore(if let Some(name) = field_attrs.name { - name.span_ident() - } else { - field_name.span() - }); - } - - if let Some(default) = field_attrs.default { - error.unsupported_attribute_within( - default.span_ident(), - UnsupportedAttribute::Default, - ); - } - - Some(util::GraphQLTypeDefinitionField { - name, - _type, - args: Vec::new(), - description: field_attrs.description.map(SpanContainer::into_inner), - deprecation: field_attrs.deprecation.map(SpanContainer::into_inner), - resolver_code, - is_type_inferred: true, - is_async: false, - default: None, - span, - }) - }) - .collect::>(); - - proc_macro_error::abort_if_dirty(); - - if fields.is_empty() { - error.not_empty(ast_span); - } - if let Some(duplicates) = - crate::util::duplicate::Duplicate::find_by_key(&fields, |field| &field.name) - { - error.duplicate(duplicates.iter()) - } - - if !attrs.interfaces.is_empty() { - attrs.interfaces.iter().for_each(|elm| { - error.unsupported_attribute(elm.span(), UnsupportedAttribute::Interface) - }); - } - - if let Some(scalar) = attrs.scalar { - error.unsupported_attribute(scalar.span_ident(), UnsupportedAttribute::Scalar); - } - - if !attrs.is_internal && name.starts_with("__") { - error.no_double_underscore(if let Some(name) = attrs.name { - name.span_ident() - } else { - ident.span() - }); - } - - proc_macro_error::abort_if_dirty(); - - let definition = util::GraphQLTypeDefiniton { - name, - _type: syn::parse_str(&ast.ident.to_string()).unwrap(), - context: attrs.context.map(SpanContainer::into_inner), - scalar: None, - description: attrs.description.map(SpanContainer::into_inner), - fields, - // NOTICE: only unit variants allow -> no generics possible - generics: syn::Generics::default(), - interfaces: vec![], - include_type_generics: true, - generic_scalar: true, - no_async: attrs.no_async.is_some(), - }; - - Ok(definition.into_enum_tokens()) -} diff --git a/juniper_codegen/src/graphql_enum/derive.rs b/juniper_codegen/src/graphql_enum/derive.rs new file mode 100644 index 000000000..7600226e8 --- /dev/null +++ b/juniper_codegen/src/graphql_enum/derive.rs @@ -0,0 +1,147 @@ +//! Code generation for `#[derive(GraphQLEnum)]` macro. + +use proc_macro2::TokenStream; +use quote::ToTokens as _; +use std::collections::HashSet; +use syn::{ext::IdentExt as _, parse_quote, spanned::Spanned}; + +use crate::{ + common::scalar, + result::GraphQLScope, + util::{span_container::SpanContainer, RenameRule}, +}; + +use super::{ContainerAttr, Definition, ValueDefinition, VariantAttr}; + +/// [`GraphQLScope`] of errors for `#[derive(GraphQLEnum)]` macro. +const ERR: GraphQLScope = GraphQLScope::EnumDerive; + +/// Expands `#[derive(GraphQLEnum)]` macro into generated code. +pub(crate) fn expand(input: TokenStream) -> syn::Result { + let ast = syn::parse2::(input)?; + let attr = ContainerAttr::from_attrs("graphql", &ast.attrs)?; + + let data = if let syn::Data::Enum(data) = &ast.data { + data + } else { + return Err(ERR.custom_error(ast.span(), "can only be derived on enums")); + }; + + let mut has_ignored_variants = false; + let renaming = attr + .rename_values + .map(SpanContainer::into_inner) + .unwrap_or(RenameRule::ScreamingSnakeCase); + let values = data + .variants + .iter() + .filter_map(|v| { + parse_value(v, renaming).or_else(|| { + has_ignored_variants = true; + None + }) + }) + .collect::>(); + + proc_macro_error::abort_if_dirty(); + + if values.is_empty() { + return Err(ERR.custom_error( + data.variants.span(), + "expected at least 1 non-ignored enum variant", + )); + } + + let unique_values = values.iter().map(|v| &v.name).collect::>(); + if unique_values.len() != values.len() { + return Err(ERR.custom_error( + data.variants.span(), + "expected all GraphQL enum values to have unique names", + )); + } + + let name = attr + .name + .clone() + .map(SpanContainer::into_inner) + .unwrap_or_else(|| ast.ident.unraw().to_string()) + .into_boxed_str(); + if !attr.is_internal && name.starts_with("__") { + ERR.no_double_underscore( + attr.name + .as_ref() + .map(SpanContainer::span_ident) + .unwrap_or_else(|| ast.ident.span()), + ); + } + + let context = attr + .context + .map_or_else(|| parse_quote! { () }, SpanContainer::into_inner); + + let description = attr.description.map(|d| d.into_inner().into_boxed_str()); + + let scalar = scalar::Type::parse(attr.scalar.as_deref(), &ast.generics); + + proc_macro_error::abort_if_dirty(); + + let definition = Definition { + ident: ast.ident, + generics: ast.generics, + name, + description, + context, + scalar, + values, + has_ignored_variants, + }; + + Ok(definition.into_token_stream()) +} + +/// Parses a [`ValueDefinition`] from the given Rust enum variant definition. +/// +/// Returns [`None`] if the parsing fails, or the enum variant is ignored. +fn parse_value(v: &syn::Variant, renaming: RenameRule) -> Option { + let attr = VariantAttr::from_attrs("graphql", &v.attrs) + .map_err(|e| proc_macro_error::emit_error!(e)) + .ok()?; + + if attr.ignore.is_some() { + return None; + } + + if !v.fields.is_empty() { + err_variant_with_fields(&v.fields)?; + } + + let name = attr + .name + .map_or_else( + || renaming.apply(&v.ident.unraw().to_string()), + SpanContainer::into_inner, + ) + .into_boxed_str(); + + let description = attr.description.map(|d| d.into_inner().into_boxed_str()); + + let deprecated = attr.deprecated.map(|desc| { + desc.into_inner() + .as_ref() + .map(|lit| lit.value().into_boxed_str()) + }); + + Some(ValueDefinition { + ident: v.ident.clone(), + name, + description, + deprecated, + }) +} + +/// Emits "no fields allowed for non-ignored variants" [`syn::Error`] pointing +/// to the given `span`. +pub fn err_variant_with_fields(span: &S) -> Option { + ERR.emit_custom(span.span(), "no fields allowed for non-ignored variants"); + None +} diff --git a/juniper_codegen/src/graphql_enum/mod.rs b/juniper_codegen/src/graphql_enum/mod.rs new file mode 100644 index 000000000..8556d8b6e --- /dev/null +++ b/juniper_codegen/src/graphql_enum/mod.rs @@ -0,0 +1,790 @@ +//! Code generation for [GraphQL enums][0]. +//! +//! [0]: https://spec.graphql.org/October2021#sec-Enums + +pub(crate) mod derive; + +use std::convert::TryInto as _; + +use proc_macro2::TokenStream; +use quote::{format_ident, quote, ToTokens}; +use syn::{ + ext::IdentExt as _, + parse::{Parse, ParseStream}, + parse_quote, + spanned::Spanned as _, + token, +}; + +use crate::{ + common::{ + parse::{ + attr::{err, OptionExt as _}, + ParseBufferExt as _, + }, + scalar, + }, + util::{ + filter_attrs, get_deprecated, get_doc_comment, span_container::SpanContainer, RenameRule, + }, +}; + +/// Available arguments behind `#[graphql]` attribute placed on a Rust enum +/// definition, when generating code for a [GraphQL enum][0] type. +/// +/// [0]: https://spec.graphql.org/October2021#sec-Enums +#[derive(Debug, Default)] +struct ContainerAttr { + /// Explicitly specified name of this [GraphQL enum][0]. + /// + /// If [`None`], then Rust enum name will be used by default. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + name: Option>, + + /// Explicitly specified [description][2] of this [GraphQL enum][0]. + /// + /// If [`None`], then Rust doc comment will be used as [description][2], if + /// any. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + /// [2]: https://spec.graphql.org/October2021#sec-Descriptions + description: Option>, + + /// Explicitly specified type of [`Context`] to use for resolving this + /// [GraphQL enum][0] type with. + /// + /// If [`None`], then unit type `()` is assumed as a type of [`Context`]. + /// + /// [`Context`]: juniper::Context + /// [0]: https://spec.graphql.org/October2021#sec-Enums + context: Option>, + + /// Explicitly specified type (or type parameter with its bounds) of + /// [`ScalarValue`] to resolve this [GraphQL enum][0] type with. + /// + /// If [`None`], then generated code will be generic over any + /// [`ScalarValue`] type. + /// + /// [`GraphQLType`]: juniper::GraphQLType + /// [`ScalarValue`]: juniper::ScalarValue + /// [0]: https://spec.graphql.org/October2021#sec-Enums + scalar: Option>, + + /// Explicitly specified [`RenameRule`] for all [values][1] of this + /// [GraphQL enum][0]. + /// + /// If [`None`], then the [`RenameRule::ScreamingSnakeCase`] rule will be + /// applied by default. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + /// [1]: https://spec.graphql.org/October2021#EnumValuesDefinition + rename_values: Option>, + + /// Indicator whether the generated code is intended to be used only inside + /// the [`juniper`] library. + is_internal: bool, +} + +impl Parse for ContainerAttr { + fn parse(input: ParseStream<'_>) -> syn::Result { + let mut out = Self::default(); + while !input.is_empty() { + let ident = input.parse_any_ident()?; + match ident.to_string().as_str() { + "name" => { + input.parse::()?; + let name = input.parse::()?; + out.name + .replace(SpanContainer::new( + ident.span(), + Some(name.span()), + name.value(), + )) + .none_or_else(|_| err::dup_arg(&ident))? + } + "desc" | "description" => { + input.parse::()?; + let desc = input.parse::()?; + out.description + .replace(SpanContainer::new( + ident.span(), + Some(desc.span()), + desc.value(), + )) + .none_or_else(|_| err::dup_arg(&ident))? + } + "ctx" | "context" | "Context" => { + input.parse::()?; + let ctx = input.parse::()?; + out.context + .replace(SpanContainer::new(ident.span(), Some(ctx.span()), ctx)) + .none_or_else(|_| err::dup_arg(&ident))? + } + "scalar" | "Scalar" | "ScalarValue" => { + input.parse::()?; + let scl = input.parse::()?; + out.scalar + .replace(SpanContainer::new(ident.span(), Some(scl.span()), scl)) + .none_or_else(|_| err::dup_arg(&ident))? + } + "rename_all" => { + input.parse::()?; + let val = input.parse::()?; + out.rename_values + .replace(SpanContainer::new( + ident.span(), + Some(val.span()), + val.try_into()?, + )) + .none_or_else(|_| err::dup_arg(&ident))?; + } + "internal" => { + out.is_internal = true; + } + name => { + return Err(err::unknown_arg(&ident, name)); + } + } + input.try_parse::()?; + } + Ok(out) + } +} + +impl ContainerAttr { + /// Tries to merge two [`ContainerAttr`]s into a single one, reporting about + /// duplicates, if any. + fn try_merge(self, mut another: Self) -> syn::Result { + Ok(Self { + name: try_merge_opt!(name: self, another), + description: try_merge_opt!(description: self, another), + context: try_merge_opt!(context: self, another), + scalar: try_merge_opt!(scalar: self, another), + rename_values: try_merge_opt!(rename_values: self, another), + is_internal: self.is_internal || another.is_internal, + }) + } + + /// Parses [`ContainerAttr`] from the given multiple `name`d + /// [`syn::Attribute`]s placed on a trait definition. + fn from_attrs(name: &str, attrs: &[syn::Attribute]) -> syn::Result { + let mut attr = filter_attrs(name, attrs) + .map(|attr| attr.parse_args()) + .try_fold(Self::default(), |prev, curr| prev.try_merge(curr?))?; + + if attr.description.is_none() { + attr.description = get_doc_comment(attrs); + } + + Ok(attr) + } +} + +/// Available arguments behind `#[graphql]` attribute when generating code for +/// a [GraphQL enum][0]'s [value][1]. +/// +/// [0]: https://spec.graphql.org/October2021#sec-Enums +/// [1]: https://spec.graphql.org/October2021#sec-Enum-Value +#[derive(Debug, Default)] +struct VariantAttr { + /// Explicitly specified name of this [GraphQL enum value][1]. + /// + /// If [`None`], then Rust enum variant's name is used by default. + /// + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + name: Option>, + + /// Explicitly specified [description][2] of this [GraphQL enum value][1]. + /// + /// If [`None`], then Rust doc comment is used as [description][2], if any. + /// + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + /// [2]: https://spec.graphql.org/October2021#sec-Descriptions + description: Option>, + + /// Explicitly specified [deprecation][2] of this [GraphQL enum value][1]. + /// + /// If [`None`], then Rust `#[deprecated]` attribute is used as the + /// [deprecation][2], if any. + /// + /// If the inner [`Option`] is [`None`], then no [reason][3] was provided. + /// + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + /// [2]: https://spec.graphql.org/October2021#sec--deprecated + /// [3]: https://spec.graphql.org/October2021#sel-GAHnBZDACEDDGAA_6L + deprecated: Option>>, + + /// Explicitly specified marker for the Rust enum variant to be ignored and + /// not included into the code generated for a [GraphQL enum][0] + /// implementation. + /// + /// [0]: https://spec.graphql.org/October20210#sec-Enums + ignore: Option>, +} + +impl Parse for VariantAttr { + fn parse(input: ParseStream<'_>) -> syn::Result { + let mut out = Self::default(); + while !input.is_empty() { + let ident = input.parse_any_ident()?; + match ident.to_string().as_str() { + "name" => { + input.parse::()?; + let name = input.parse::()?; + out.name + .replace(SpanContainer::new( + ident.span(), + Some(name.span()), + name.value(), + )) + .none_or_else(|_| err::dup_arg(&ident))? + } + "desc" | "description" => { + input.parse::()?; + let desc = input.parse::()?; + out.description + .replace(SpanContainer::new( + ident.span(), + Some(desc.span()), + desc.value(), + )) + .none_or_else(|_| err::dup_arg(&ident))? + } + "deprecated" => { + let mut reason = None; + if input.is_next::() { + input.parse::()?; + reason = Some(input.parse::()?); + } + out.deprecated + .replace(SpanContainer::new( + ident.span(), + reason.as_ref().map(|r| r.span()), + reason, + )) + .none_or_else(|_| err::dup_arg(&ident))? + } + "ignore" | "skip" => out + .ignore + .replace(SpanContainer::new(ident.span(), None, ident.clone())) + .none_or_else(|_| err::dup_arg(&ident))?, + name => { + return Err(err::unknown_arg(&ident, name)); + } + } + input.try_parse::()?; + } + Ok(out) + } +} + +impl VariantAttr { + /// Tries to merge two [`VariantAttr`]s into a single one, reporting about + /// duplicates, if any. + fn try_merge(self, mut another: Self) -> syn::Result { + Ok(Self { + name: try_merge_opt!(name: self, another), + description: try_merge_opt!(description: self, another), + deprecated: try_merge_opt!(deprecated: self, another), + ignore: try_merge_opt!(ignore: self, another), + }) + } + + /// Parses [`VariantAttr`] from the given multiple `name`d + /// [`syn::Attribute`]s placed on a trait definition. + fn from_attrs(name: &str, attrs: &[syn::Attribute]) -> syn::Result { + let mut attr = filter_attrs(name, attrs) + .map(|attr| attr.parse_args()) + .try_fold(Self::default(), |prev, curr| prev.try_merge(curr?))?; + + if attr.description.is_none() { + attr.description = get_doc_comment(attrs); + } + + if attr.deprecated.is_none() { + attr.deprecated = get_deprecated(attrs).map(|sc| { + let span = sc.span_ident(); + sc.map(|depr| depr.reason.map(|rsn| syn::LitStr::new(&rsn, span))) + }); + } + + Ok(attr) + } +} + +/// Representation of a [GraphQL enum value][1] for code generation. +/// +/// [1]: https://spec.graphql.org/October2021#sec-Enum-Value +#[derive(Debug)] +struct ValueDefinition { + /// [`Ident`] of the Rust enum variant behind this [GraphQL enum value][1]. + /// + /// [`Ident`]: syn::Ident + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + ident: syn::Ident, + + /// Name of this [GraphQL enum value][1] in GraphQL schema. + /// + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + name: Box, + + /// [Description][2] of this [GraphQL enum value][1] to put into GraphQL + /// schema. + /// + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + /// [2]: https://spec.graphql.org/October2021#sec-Descriptions + description: Option>, + + /// [Deprecation][2] of this [GraphQL enum value][1] to put into GraphQL + /// schema. + /// + /// If the inner [`Option`] is [`None`], then [deprecation][2] has no + /// [reason][3] attached. + /// + /// [1]: https://spec.graphql.org/October2021#sec-Enum-Value + /// [2]: https://spec.graphql.org/October2021#sec--deprecated + /// [3]: https://spec.graphql.org/October2021#sel-GAHnBZDACEDDGAA_6L + deprecated: Option>>, +} + +/// Representation of a [GraphQL enum][0] for code generation. +/// +/// [0]: https://spec.graphql.org/October2021#sec-Enums +struct Definition { + /// [`Ident`] of the Rust enum behind this [GraphQL enum][0]. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + ident: syn::Ident, + + /// [`syn::Generics`] of the Rust enum behind this [GraphQL enum][0]. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + generics: syn::Generics, + + /// Name of this [GraphQL enum][0] in GraphQL schema. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + name: Box, + + /// [Description][2] of this [GraphQL enum][0] to put into GraphQL schema. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + /// [2]: https://spec.graphql.org/October2021#sec-Descriptions + description: Option>, + + /// Rust type of [`Context`] to generate [`GraphQLType`] implementation with + /// for this [GraphQL enum][0]. + /// + /// [`GraphQLType`]: juniper::GraphQLType + /// [`Context`]: juniper::Context + /// [0]: https://spec.graphql.org/October2021#sec-Enums + context: syn::Type, + + /// [`ScalarValue`] parametrization to generate [`GraphQLType`] + /// implementation with for this [GraphQL enum][0]. + /// + /// [`GraphQLType`]: juniper::GraphQLType + /// [`ScalarValue`]: juniper::ScalarValue + /// [0]: https://spec.graphql.org/October2021#sec-Enums + scalar: scalar::Type, + + /// [Values][1] of this [GraphQL enum][0]. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + /// [1]: https://spec.graphql.org/October2021#EnumValuesDefinition + values: Vec, + + /// Indicates whether the Rust enum behind this [GraphQL enum][0] contains + /// ignored variants. + /// + /// [0]: https://spec.graphql.org/October2021#sec-Enums + has_ignored_variants: bool, +} + +impl ToTokens for Definition { + fn to_tokens(&self, into: &mut TokenStream) { + self.impl_input_and_output_type_tokens().to_tokens(into); + self.impl_graphql_type_tokens().to_tokens(into); + self.impl_graphql_value_tokens().to_tokens(into); + self.impl_graphql_value_async_tokens().to_tokens(into); + self.impl_from_input_value_tokens().to_tokens(into); + self.impl_to_input_value_tokens().to_tokens(into); + self.impl_reflection_traits_tokens().to_tokens(into); + } +} + +impl Definition { + /// Returns generated code implementing [`marker::IsOutputType`] trait for + /// this [GraphQL enum][0]. + /// + /// [`marker::IsOutputType`]: juniper::marker::IsOutputType + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_input_and_output_type_tokens(&self) -> TokenStream { + let ident = &self.ident; + let scalar = &self.scalar; + + let generics = self.impl_generics(false); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + quote! { + #[automatically_derived] + impl#impl_generics ::juniper::marker::IsInputType<#scalar> + for #ident#ty_generics + #where_clause {} + + #[automatically_derived] + impl#impl_generics ::juniper::marker::IsOutputType<#scalar> + for #ident#ty_generics + #where_clause {} + } + } + + /// Returns generated code implementing [`GraphQLType`] trait for this + /// [GraphQL enum][0]. + /// + /// [`GraphQLType`]: juniper::GraphQLType + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_graphql_type_tokens(&self) -> TokenStream { + let ident = &self.ident; + let scalar = &self.scalar; + + let generics = self.impl_generics(false); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + let name = &self.name; + let description = self + .description + .as_ref() + .map(|desc| quote! { .description(#desc) }); + + let variants_meta = self.values.iter().map(|v| { + let name = &v.name; + let description = v.description.as_ref().map_or_else( + || quote! { None }, + |desc| quote! { Some(String::from(#desc)) }, + ); + let deprecation_status = match &v.deprecated { + None => quote! { ::juniper::meta::DeprecationStatus::Current }, + Some(None) => quote! { + ::juniper::meta::DeprecationStatus::Deprecated(None) + }, + Some(Some(reason)) => { + quote! { + ::juniper::meta::DeprecationStatus::Deprecated( + Some(String::from(#reason)) + ) + } + } + }; + + quote! { + ::juniper::meta::EnumValue { + name: String::from(#name), + description: #description, + deprecation_status: #deprecation_status, + } + } + }); + + quote! { + #[automatically_derived] + impl#impl_generics ::juniper::GraphQLType<#scalar> + for #ident#ty_generics + #where_clause + { + fn name(_ : &Self::TypeInfo) -> Option<&'static str> { + Some(#name) + } + + fn meta<'r>( + info: &Self::TypeInfo, + registry: &mut ::juniper::Registry<'r, #scalar> + ) -> ::juniper::meta::MetaType<'r, #scalar> + where #scalar: 'r, + { + let variants = [#( #variants_meta ),*]; + + registry.build_enum_type::<#ident#ty_generics>(info, &variants) + #description + .into_meta() + } + } + } + } + + /// Returns generated code implementing [`GraphQLValue`] trait for this + /// [GraphQL enum][0]. + /// + /// [`GraphQLValue`]: juniper::GraphQLValue + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_graphql_value_tokens(&self) -> TokenStream { + let ident = &self.ident; + let scalar = &self.scalar; + let context = &self.context; + + let generics = self.impl_generics(false); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + let variants = self.values.iter().map(|v| { + let ident = &v.ident; + let name = &v.name; + + quote! { + Self::#ident => Ok(::juniper::Value::scalar(String::from(#name))), + } + }); + + let ignored = self.has_ignored_variants.then(|| { + quote! { + _ => Err(::juniper::FieldError::<#scalar>::from( + "Cannot resolve ignored enum variant", + )), + } + }); + + quote! { + impl#impl_generics ::juniper::GraphQLValue<#scalar> + for #ident#ty_generics + #where_clause + { + type Context = #context; + type TypeInfo = (); + + fn type_name<'__i>(&self, info: &'__i Self::TypeInfo) -> Option<&'__i str> { + >::name(info) + } + + fn resolve( + &self, + _: &(), + _: Option<&[::juniper::Selection<#scalar>]>, + _: &::juniper::Executor, + ) -> ::juniper::ExecutionResult<#scalar> { + match self { + #( #variants )* + #ignored + } + } + } + } + } + + /// Returns generated code implementing [`GraphQLValueAsync`] trait for this + /// [GraphQL enum][0]. + /// + /// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_graphql_value_async_tokens(&self) -> TokenStream { + let ident = &self.ident; + let scalar = &self.scalar; + + let generics = self.impl_generics(true); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + quote! { + impl#impl_generics ::juniper::GraphQLValueAsync<#scalar> + for #ident#ty_generics + #where_clause + { + fn resolve_async<'__a>( + &'__a self, + info: &'__a Self::TypeInfo, + selection_set: Option<&'__a [::juniper::Selection<#scalar>]>, + executor: &'__a ::juniper::Executor, + ) -> ::juniper::BoxFuture<'__a, ::juniper::ExecutionResult<#scalar>> { + let v = ::juniper::GraphQLValue::resolve(self, info, selection_set, executor); + Box::pin(::juniper::futures::future::ready(v)) + } + } + } + } + + /// Returns generated code implementing [`FromInputValue`] trait for this + /// [GraphQL enum][0]. + /// + /// [`FromInputValue`]: juniper::FromInputValue + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_from_input_value_tokens(&self) -> TokenStream { + let ident = &self.ident; + let scalar = &self.scalar; + + let generics = self.impl_generics(false); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + let variants = self.values.iter().map(|v| { + let ident = &v.ident; + let name = &v.name; + + quote! { + Some(#name) => Ok(Self::#ident), + } + }); + + quote! { + impl#impl_generics ::juniper::FromInputValue<#scalar> + for #ident#ty_generics + #where_clause + { + type Error = ::std::string::String; + + fn from_input_value(v: &::juniper::InputValue<#scalar>) -> Result { + match v.as_enum_value().or_else(|| v.as_string_value()) { + #( #variants )* + _ => Err(::std::format!("Unknown enum value: {}", v)), + } + } + } + } + } + + /// Returns generated code implementing [`ToInputValue`] trait for this + /// [GraphQL enum][0]. + /// + /// [`ToInputValue`]: juniper::ToInputValue + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_to_input_value_tokens(&self) -> TokenStream { + let ident = &self.ident; + let scalar = &self.scalar; + + let generics = self.impl_generics(false); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + let variants = self.values.iter().map(|v| { + let var_ident = &v.ident; + let name = &v.name; + + quote! { + #ident::#var_ident => ::juniper::InputValue::<#scalar>::scalar( + String::from(#name), + ), + } + }); + + let ignored = self.has_ignored_variants.then(|| { + quote! { + _ => panic!("Cannot resolve ignored enum variant"), + } + }); + + quote! { + impl#impl_generics ::juniper::ToInputValue<#scalar> + for #ident#ty_generics + #where_clause + { + fn to_input_value(&self) -> ::juniper::InputValue<#scalar> { + match self { + #( #variants )* + #ignored + } + } + } + } + } + + /// Returns generated code implementing [`BaseType`], [`BaseSubTypes`] and + /// [`WrappedType`] traits for this [GraphQL enum][0]. + /// + /// [`BaseSubTypes`]: juniper::macros::reflect::BaseSubTypes + /// [`BaseType`]: juniper::macros::reflect::BaseType + /// [`WrappedType`]: juniper::macros::reflect::WrappedType + /// [0]: https://spec.graphql.org/October2021#sec-Enums + fn impl_reflection_traits_tokens(&self) -> TokenStream { + let ident = &self.ident; + let name = &self.name; + let scalar = &self.scalar; + + let generics = self.impl_generics(false); + let (impl_generics, _, where_clause) = generics.split_for_impl(); + let (_, ty_generics, _) = self.generics.split_for_impl(); + + quote! { + impl#impl_generics ::juniper::macros::reflect::BaseType<#scalar> + for #ident#ty_generics + #where_clause + { + const NAME: ::juniper::macros::reflect::Type = #name; + } + + impl#impl_generics ::juniper::macros::reflect::BaseSubTypes<#scalar> + for #ident#ty_generics + #where_clause + { + const NAMES: ::juniper::macros::reflect::Types = + &[>::NAME]; + } + + impl#impl_generics ::juniper::macros::reflect::WrappedType<#scalar> + for #ident#ty_generics + #where_clause + { + const VALUE: ::juniper::macros::reflect::WrappedValue = 1; + } + } + } + + /// Returns prepared [`syn::Generics`] for [`GraphQLType`] trait (and + /// similar) implementation of this enum. + /// + /// If `for_async` is `true`, then additional predicates are added to suit + /// the [`GraphQLAsyncValue`] trait (and similar) requirements. + /// + /// [`GraphQLAsyncValue`]: juniper::GraphQLAsyncValue + /// [`GraphQLType`]: juniper::GraphQLType + fn impl_generics(&self, for_async: bool) -> syn::Generics { + let mut generics = self.generics.clone(); + + let scalar = &self.scalar; + if scalar.is_implicit_generic() { + generics.params.push(parse_quote! { #scalar }); + } + if scalar.is_generic() { + generics + .make_where_clause() + .predicates + .push(parse_quote! { #scalar: ::juniper::ScalarValue }); + } + if let Some(bound) = scalar.bounds() { + generics.make_where_clause().predicates.push(bound); + } + + if for_async { + let self_ty = if self.generics.lifetimes().next().is_some() { + // Modify lifetime names to omit "lifetime name `'a` shadows a + // lifetime name that is already in scope" error. + let mut generics = self.generics.clone(); + for lt in generics.lifetimes_mut() { + let ident = lt.lifetime.ident.unraw(); + lt.lifetime.ident = format_ident!("__fa__{}", ident); + } + + let lifetimes = generics.lifetimes().map(|lt| <.lifetime); + let ident = &self.ident; + let (_, ty_generics, _) = generics.split_for_impl(); + + quote! { for<#( #lifetimes ),*> #ident#ty_generics } + } else { + quote! { Self } + }; + generics + .make_where_clause() + .predicates + .push(parse_quote! { #self_ty: Sync }); + + if scalar.is_generic() { + generics + .make_where_clause() + .predicates + .push(parse_quote! { #scalar: Send + Sync }); + } + } + + generics + } +} diff --git a/juniper_codegen/src/lib.rs b/juniper_codegen/src/lib.rs index 1c7da4dbf..6ab96c2c6 100644 --- a/juniper_codegen/src/lib.rs +++ b/juniper_codegen/src/lib.rs @@ -100,10 +100,10 @@ macro_rules! try_merge_hashset { }; } -mod derive_enum; mod derive_input_object; mod common; +mod graphql_enum; mod graphql_interface; mod graphql_object; mod graphql_scalar; @@ -115,17 +115,6 @@ use proc_macro::TokenStream; use proc_macro_error::{proc_macro_error, ResultExt as _}; use result::GraphQLScope; -#[proc_macro_error] -#[proc_macro_derive(GraphQLEnum, attributes(graphql))] -pub fn derive_enum(input: TokenStream) -> TokenStream { - let ast = syn::parse::(input).unwrap(); - let gen = derive_enum::impl_enum(ast, GraphQLScope::DeriveEnum); - match gen { - Ok(gen) => gen.into(), - Err(err) => proc_macro_error::abort!(err), - } -} - #[proc_macro_error] #[proc_macro_derive(GraphQLInputObject, attributes(graphql))] pub fn derive_input_object(input: TokenStream) -> TokenStream { @@ -137,6 +126,133 @@ pub fn derive_input_object(input: TokenStream) -> TokenStream { } } +/// `#[derive(GraphQLEnum)]` macro for deriving a [GraphQL enum][0] +/// implementation for Rust enums. +/// +/// The `#[graphql]` helper attribute is used for configuring the derived +/// implementation. Specifying multiple `#[graphql]` attributes on the same +/// definition is totally okay. They all will be treated as a single attribute. +/// +/// ```rust +/// use juniper::GraphQLEnum; +/// +/// #[derive(GraphQLEnum)] +/// enum Episode { +/// NewHope, +/// Empire, +/// Jedi, +/// } +/// ``` +/// +/// # Custom name, description and deprecation +/// +/// The name of a [GraphQL enum][0] or its [values][1] may be overridden with +/// the `name` attribute's argument. By default, a type name is used or a +/// variant name in `SCREAMING_SNAKE_CASE`. +/// +/// The description of a [GraphQL enum][0] or its [values][1] may be specified +/// either with the `description`/`desc` attribute's argument, or with a regular +/// Rust doc comment. +/// +/// [GraphQL enum value][1] may be deprecated by specifying the `deprecated` +/// attribute's argument, or with regular a Rust `#[deprecated]` attribute. +/// +/// ```rust +/// # use juniper::GraphQLEnum; +/// # +/// #[derive(GraphQLEnum)] +/// #[graphql( +/// // Rename the type for GraphQL by specifying the name here. +/// name = "AvailableEpisodes", +/// // You may also specify a description here. +/// // If present, doc comments will be ignored. +/// desc = "Possible episodes.", +/// )] +/// enum Episode { +/// /// Doc comment, also acting as description. +/// #[deprecated(note = "Don't use it")] +/// NewHope, +/// +/// #[graphql(name = "Jedi", desc = "Arguably the best one in the trilogy")] +/// #[graphql(deprecated = "Don't use it")] +/// Jedai, +/// +/// Empire, +/// } +/// ``` +/// +/// # Renaming policy +/// +/// By default, all [GraphQL enum values][1] are renamed in a +/// `SCREAMING_SNAKE_CASE` manner (so a `NewHope` Rust enum variant becomes a +/// `NEW_HOPE` [value][1] in GraphQL schema, and so on). This complies with +/// default GraphQL naming conventions as [demonstrated in spec][0]. +/// +/// However, if you need for some reason another naming convention, it's +/// possible to do so by using the `rename_all` attribute's argument. At the +/// moment, it supports the following policies only: `SCREAMING_SNAKE_CASE`, +/// `camelCase`, `none` (disables any renaming). +/// +/// ```rust +/// # use juniper::GraphQLEnum; +/// # +/// #[derive(GraphQLEnum)] +/// #[graphql(rename_all = "none")] // disables renaming +/// enum Episode { +/// NewHope, +/// Empire, +/// Jedi, +/// } +/// ``` +/// +/// # Ignoring enum variants +/// +/// To omit exposing a Rust enum variant in a GraphQL schema, use the `ignore` +/// attribute's argument directly on that variant. Only ignored Rust enum +/// variants are allowed to contain fields. +/// +/// ```rust +/// # use juniper::GraphQLEnum; +/// # +/// #[derive(GraphQLEnum)] +/// enum Episode { +/// NewHope, +/// Empire, +/// Jedi, +/// #[graphql(ignore)] +/// Legends(T), +/// } +/// ``` +/// +/// # Custom `ScalarValue` +/// +/// By default, `#[derive(GraphQLEnum)]` macro generates code, which is generic +/// over a [`ScalarValue`] type. This can be changed with the `scalar` +/// attribute's argument. +/// +/// ```rust +/// # use juniper::{DefaultScalarValue, GraphQLEnum}; +/// # +/// #[derive(GraphQLEnum)] +/// #[graphql(scalar = DefaultScalarValue)] +/// enum Episode { +/// NewHope, +/// Empire, +/// Jedi, +/// } +/// ``` +/// +/// [`ScalarValue`]: juniper::ScalarValue +/// [0]: https://spec.graphql.org/October2021#sec-Enums +/// [1]: https://spec.graphql.org/October2021#sec-Enum-Value +#[proc_macro_error] +#[proc_macro_derive(GraphQLEnum, attributes(graphql))] +pub fn derive_enum(input: TokenStream) -> TokenStream { + graphql_enum::derive::expand(input.into()) + .unwrap_or_abort() + .into() +} + /// `#[derive(GraphQLScalar)]` macro for deriving a [GraphQL scalar][0] /// implementation. /// diff --git a/juniper_codegen/src/result.rs b/juniper_codegen/src/result.rs index 8b58339a5..5c979d690 100644 --- a/juniper_codegen/src/result.rs +++ b/juniper_codegen/src/result.rs @@ -9,6 +9,7 @@ use std::fmt; pub const SPEC_URL: &str = "https://spec.graphql.org/June2018/"; pub enum GraphQLScope { + EnumDerive, InterfaceAttr, InterfaceDerive, ObjectAttr, @@ -19,19 +20,18 @@ pub enum GraphQLScope { UnionAttr, UnionDerive, DeriveInputObject, - DeriveEnum, } impl GraphQLScope { pub fn spec_section(&self) -> &str { match self { + Self::EnumDerive => "#sec-Enums", Self::InterfaceAttr | Self::InterfaceDerive => "#sec-Interfaces", Self::ObjectAttr | Self::ObjectDerive => "#sec-Objects", Self::ScalarAttr | Self::ScalarDerive => "#sec-Scalars", Self::ScalarValueDerive => "#sec-Scalars.Built-in-Scalars", Self::UnionAttr | Self::UnionDerive => "#sec-Unions", Self::DeriveInputObject => "#sec-Input-Objects", - Self::DeriveEnum => "#sec-Enums", } } } @@ -39,13 +39,13 @@ impl GraphQLScope { impl fmt::Display for GraphQLScope { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let name = match self { + Self::EnumDerive => "enum", Self::InterfaceAttr | Self::InterfaceDerive => "interface", Self::ObjectAttr | Self::ObjectDerive => "object", Self::ScalarAttr | Self::ScalarDerive => "scalar", Self::ScalarValueDerive => "built-in scalars", Self::UnionAttr | Self::UnionDerive => "union", Self::DeriveInputObject => "input object", - Self::DeriveEnum => "enum", }; write!(f, "GraphQL {}", name) } @@ -56,9 +56,7 @@ impl fmt::Display for GraphQLScope { pub enum UnsupportedAttribute { Skip, Interface, - Scalar, Deprecation, - Default, } impl GraphQLScope { diff --git a/juniper_codegen/src/util/mod.rs b/juniper_codegen/src/util/mod.rs index 510c3aeb2..bda4bc6bb 100644 --- a/juniper_codegen/src/util/mod.rs +++ b/juniper_codegen/src/util/mod.rs @@ -683,232 +683,6 @@ impl GraphQLTypeDefiniton { self.fields.iter().any(|field| field.is_async) } - pub fn into_enum_tokens(self) -> TokenStream { - let name = &self.name; - let ty = &self._type; - let context = self - .context - .as_ref() - .map(|ctx| quote!( #ctx )) - .unwrap_or_else(|| quote!(())); - - let scalar = self - .scalar - .as_ref() - .map(|s| quote!( #s )) - .unwrap_or_else(|| { - if self.generic_scalar { - // If generic_scalar is true, we always insert a generic scalar. - // See more comments below. - quote!(__S) - } else { - quote!(::juniper::DefaultScalarValue) - } - }); - - let description = self - .description - .as_ref() - .map(|description| quote!( .description(#description) )); - - let values = self.fields.iter().map(|variant| { - let variant_name = &variant.name; - - let descr = variant - .description - .as_ref() - .map(|description| quote!(Some(#description.to_string()))) - .unwrap_or_else(|| quote!(None)); - - let depr = variant - .deprecation - .as_ref() - .map(|deprecation| match deprecation.reason.as_ref() { - Some(reason) => quote!( ::juniper::meta::DeprecationStatus::Deprecated(Some(#reason.to_string())) ), - None => quote!( ::juniper::meta::DeprecationStatus::Deprecated(None) ), - }) - .unwrap_or_else(|| quote!(::juniper::meta::DeprecationStatus::Current)); - - quote!( - ::juniper::meta::EnumValue { - name: #variant_name.to_string(), - description: #descr, - deprecation_status: #depr, - }, - ) - }); - - let resolves = self.fields.iter().map(|variant| { - let variant_name = &variant.name; - let resolver_code = &variant.resolver_code; - - quote!( - &#resolver_code => ::juniper::Value::scalar(String::from(#variant_name)), - ) - }); - - let from_inputs = self.fields.iter().map(|variant| { - let variant_name = &variant.name; - let resolver_code = &variant.resolver_code; - - quote!( - Some(#variant_name) => Ok(#resolver_code), - ) - }); - - let to_inputs = self.fields.iter().map(|variant| { - let variant_name = &variant.name; - let resolver_code = &variant.resolver_code; - - quote!( - &#resolver_code => - ::juniper::InputValue::scalar(#variant_name.to_string()), - ) - }); - - let mut generics = self.generics.clone(); - - if self.scalar.is_none() && self.generic_scalar { - // No custom scalar specified, but always generic specified. - // Therefore we inject the generic scalar. - - generics.params.push(parse_quote!(__S)); - - let where_clause = generics.where_clause.get_or_insert(parse_quote!(where)); - // Insert ScalarValue constraint. - where_clause - .predicates - .push(parse_quote!(__S: ::juniper::ScalarValue)); - } - - let (impl_generics, _, where_clause) = generics.split_for_impl(); - - let mut where_async = where_clause.cloned().unwrap_or_else(|| parse_quote!(where)); - where_async - .predicates - .push(parse_quote!( #scalar: Send + Sync )); - where_async.predicates.push(parse_quote!(Self: Sync)); - - let _async = quote!( - impl#impl_generics ::juniper::GraphQLValueAsync<#scalar> for #ty - #where_async - { - fn resolve_async<'a>( - &'a self, - info: &'a Self::TypeInfo, - selection_set: Option<&'a [::juniper::Selection<#scalar>]>, - executor: &'a ::juniper::Executor, - ) -> ::juniper::BoxFuture<'a, ::juniper::ExecutionResult<#scalar>> { - use ::juniper::futures::future; - let v = ::juniper::GraphQLValue::resolve(self, info, selection_set, executor); - Box::pin(future::ready(v)) - } - } - ); - - let mut body = quote!( - impl#impl_generics ::juniper::marker::IsInputType<#scalar> for #ty - #where_clause { } - - impl#impl_generics ::juniper::marker::IsOutputType<#scalar> for #ty - #where_clause { } - - impl#impl_generics ::juniper::GraphQLType<#scalar> for #ty - #where_clause - { - fn name(_: &()) -> Option<&'static str> { - Some(#name) - } - - fn meta<'r>( - _: &(), - registry: &mut ::juniper::Registry<'r, #scalar> - ) -> ::juniper::meta::MetaType<'r, #scalar> - where #scalar: 'r, - { - registry.build_enum_type::<#ty>(&(), &[ - #( #values )* - ]) - #description - .into_meta() - } - } - - impl#impl_generics ::juniper::GraphQLValue<#scalar> for #ty - #where_clause - { - type Context = #context; - type TypeInfo = (); - - fn type_name<'__i>(&self, info: &'__i Self::TypeInfo) -> Option<&'__i str> { - >::name(info) - } - - fn resolve( - &self, - _: &(), - _: Option<&[::juniper::Selection<#scalar>]>, - _: &::juniper::Executor - ) -> ::juniper::ExecutionResult<#scalar> { - let v = match self { - #( #resolves )* - }; - Ok(v) - } - } - - impl#impl_generics ::juniper::FromInputValue<#scalar> for #ty - #where_clause - { - type Error = ::std::string::String; - - fn from_input_value( - v: &::juniper::InputValue<#scalar> - ) -> Result<#ty, Self::Error> { - match v.as_enum_value().or_else(|| v.as_string_value()) { - #( #from_inputs )* - _ => Err(format!("Unknown enum value: {}", v)), - } - } - } - - impl#impl_generics ::juniper::ToInputValue<#scalar> for #ty - #where_clause - { - fn to_input_value(&self) -> ::juniper::InputValue<#scalar> { - match self { - #( #to_inputs )* - } - } - } - - impl#impl_generics ::juniper::macros::reflect::BaseType<#scalar> for #ty - #where_clause - { - const NAME: ::juniper::macros::reflect::Type = #name; - } - - impl#impl_generics ::juniper::macros::reflect::BaseSubTypes<#scalar> for #ty - #where_clause - { - const NAMES: ::juniper::macros::reflect::Types = - &[>::NAME]; - } - - impl#impl_generics ::juniper::macros::reflect::WrappedType<#scalar> for #ty - #where_clause - { - const VALUE: ::juniper::macros::reflect::WrappedValue = 1; - } - ); - - if !self.no_async { - body.extend(_async) - } - - body - } - pub fn into_input_object_tokens(self) -> TokenStream { let name = &self.name; let ty = &self._type; diff --git a/tests/codegen/Cargo.toml b/tests/codegen/Cargo.toml index eb513bf32..f08b1f1a9 100644 --- a/tests/codegen/Cargo.toml +++ b/tests/codegen/Cargo.toml @@ -9,6 +9,6 @@ futures = "0.3.1" juniper = { path = "../../juniper" } [dev-dependencies] -serde_json = { version = "1.0" } +serde_json = "1.0" tokio = { version = "1.0", features = ["rt", "time", "macros"] } trybuild = "1.0.25" diff --git a/tests/codegen/fail/enum/derive_duplicated_value_names.rs b/tests/codegen/fail/enum/derive_duplicated_value_names.rs new file mode 100644 index 000000000..3044f379a --- /dev/null +++ b/tests/codegen/fail/enum/derive_duplicated_value_names.rs @@ -0,0 +1,10 @@ +use juniper::GraphQLEnum; + +#[derive(GraphQLEnum)] +enum Test { + Test, + #[graphql(name = "TEST")] + Test1, +} + +fn main() {} diff --git a/tests/codegen/fail/enum/derive_duplicated_value_names.stderr b/tests/codegen/fail/enum/derive_duplicated_value_names.stderr new file mode 100644 index 000000000..8b5ca8305 --- /dev/null +++ b/tests/codegen/fail/enum/derive_duplicated_value_names.stderr @@ -0,0 +1,7 @@ +error: GraphQL enum expected all GraphQL enum values to have unique names + --> fail/enum/derive_duplicated_value_names.rs:5:5 + | +5 | / Test, +6 | | #[graphql(name = "TEST")] +7 | | Test1, + | |__________^ diff --git a/tests/codegen/fail/enum/derive_name_double_underscored.rs b/tests/codegen/fail/enum/derive_name_double_underscored.rs new file mode 100644 index 000000000..11c9d708f --- /dev/null +++ b/tests/codegen/fail/enum/derive_name_double_underscored.rs @@ -0,0 +1,8 @@ +use juniper::GraphQLEnum; + +#[derive(GraphQLEnum)] +enum __Test { + Test, +} + +fn main() {} diff --git a/tests/codegen/fail/enum/derive_name_double_underscored.stderr b/tests/codegen/fail/enum/derive_name_double_underscored.stderr new file mode 100644 index 000000000..6b00b6bd0 --- /dev/null +++ b/tests/codegen/fail/enum/derive_name_double_underscored.stderr @@ -0,0 +1,7 @@ +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 GraphQL’s introspection system. + --> fail/enum/derive_name_double_underscored.rs:4:6 + | +4 | enum __Test { + | ^^^^^^ + | + = note: https://spec.graphql.org/June2018/#sec-Schema diff --git a/tests/codegen/fail/enum/derive_no_fields.rs b/tests/codegen/fail/enum/derive_no_fields.rs deleted file mode 100644 index f7df4e7d5..000000000 --- a/tests/codegen/fail/enum/derive_no_fields.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[derive(juniper::GraphQLEnum)] -pub enum Test {} - -fn main() { } diff --git a/tests/codegen/fail/enum/derive_no_fields.stderr b/tests/codegen/fail/enum/derive_no_fields.stderr deleted file mode 100644 index 637156392..000000000 --- a/tests/codegen/fail/enum/derive_no_fields.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: GraphQL enum expects at least one field - --> fail/enum/derive_no_fields.rs:2:1 - | -2 | pub enum Test {} - | ^^^^^^^^^^^^^^^^ - | - = note: https://spec.graphql.org/June2018/#sec-Enums diff --git a/tests/codegen/fail/enum/derive_no_values.rs b/tests/codegen/fail/enum/derive_no_values.rs new file mode 100644 index 000000000..fe36fe44a --- /dev/null +++ b/tests/codegen/fail/enum/derive_no_values.rs @@ -0,0 +1,6 @@ +use juniper::GraphQLEnum; + +#[derive(GraphQLEnum)] +enum Test {} + +fn main() {} diff --git a/tests/codegen/fail/enum/derive_no_values.stderr b/tests/codegen/fail/enum/derive_no_values.stderr new file mode 100644 index 000000000..b9b26cae1 --- /dev/null +++ b/tests/codegen/fail/enum/derive_no_values.stderr @@ -0,0 +1,7 @@ +error: GraphQL enum expected at least 1 non-ignored enum variant + --> fail/enum/derive_no_values.rs:3:10 + | +3 | #[derive(GraphQLEnum)] + | ^^^^^^^^^^^ + | + = note: this error originates in the derive macro `GraphQLEnum` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/codegen/fail/enum/derive_variant_with_field.rs b/tests/codegen/fail/enum/derive_variant_with_field.rs new file mode 100644 index 000000000..61ddd7966 --- /dev/null +++ b/tests/codegen/fail/enum/derive_variant_with_field.rs @@ -0,0 +1,8 @@ +use juniper::GraphQLEnum; + +#[derive(GraphQLEnum)] +enum Test { + Variant(i32), +} + +fn main() {} diff --git a/tests/codegen/fail/enum/derive_variant_with_field.stderr b/tests/codegen/fail/enum/derive_variant_with_field.stderr new file mode 100644 index 000000000..96cae1a79 --- /dev/null +++ b/tests/codegen/fail/enum/derive_variant_with_field.stderr @@ -0,0 +1,7 @@ +error: GraphQL enum no fields allowed for non-ignored variants + --> fail/enum/derive_variant_with_field.rs:5:12 + | +5 | Variant(i32), + | ^^^^^ + | + = note: https://spec.graphql.org/June2018/#sec-Enums diff --git a/tests/codegen/fail/enum/derive_wrong_item.rs b/tests/codegen/fail/enum/derive_wrong_item.rs new file mode 100644 index 000000000..e31351f39 --- /dev/null +++ b/tests/codegen/fail/enum/derive_wrong_item.rs @@ -0,0 +1,6 @@ +use juniper::GraphQLEnum; + +#[derive(GraphQLEnum)] +struct Test {} + +fn main() {} diff --git a/tests/codegen/fail/enum/derive_wrong_item.stderr b/tests/codegen/fail/enum/derive_wrong_item.stderr new file mode 100644 index 000000000..3670fc045 --- /dev/null +++ b/tests/codegen/fail/enum/derive_wrong_item.stderr @@ -0,0 +1,5 @@ +error: GraphQL enum can only be derived on enums + --> fail/enum/derive_wrong_item.rs:4:1 + | +4 | struct Test {} + | ^^^^^^^^^^^^^^ diff --git a/tests/codegen/fail/interface/struct/attr_implementers_duplicate_pretty.stderr b/tests/codegen/fail/interface/struct/attr_implementers_duplicate_pretty.stderr index c87ad2e06..a9f9fe376 100644 --- a/tests/codegen/fail/interface/struct/attr_implementers_duplicate_pretty.stderr +++ b/tests/codegen/fail/interface/struct/attr_implementers_duplicate_pretty.stderr @@ -9,3 +9,27 @@ error[E0412]: cannot find type `CharacterValue` in this scope | 4 | #[graphql(impl = CharacterValue)] | ^^^^^^^^^^^^^^ not found in this scope + +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/attr_implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/attr_implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/attr_implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/codegen/fail/interface/struct/attr_missing_field.stderr b/tests/codegen/fail/interface/struct/attr_missing_field.stderr index 3d479ce5e..429efcea5 100644 --- a/tests/codegen/fail/interface/struct/attr_missing_field.stderr +++ b/tests/codegen/fail/interface/struct/attr_missing_field.stderr @@ -22,38 +22,807 @@ error[E0080]: erroneous constant used | = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0080]: erroneous constant used + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ + | | + | referenced constant has errors + | inside ` as juniper::macros::reflect::Field<__S, id>>::call::_::check` at $WORKSPACE/juniper/src/macros/reflect.rs:719:36 + | inside ` as juniper::macros::reflect::Field<__S, id>>::call::_::RES` at $WORKSPACE/juniper/src/macros/reflect.rs:782:59 + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ + | | + | referenced constant has errors + | inside ` as AsyncField<__S, id>>::call::_::check` at $WORKSPACE/juniper/src/macros/reflect.rs:719:36 + | inside ` as AsyncField<__S, id>>::call::_::RES` at $WORKSPACE/juniper/src/macros/reflect.rs:782:59 + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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 + | ^^ referenced constant has errors | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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 + | ^^ referenced constant has errors | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: erroneous constant used +error: any use of this value will cause an error --> fail/interface/struct/attr_missing_field.rs:11:5 | 11 | id: String, | ^^ referenced constant has errors | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: erroneous constant used +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error --> fail/interface/struct/attr_missing_field.rs:11:5 | 11 | id: String, | ^^ referenced constant has errors | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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 | @@ -61,3 +830,155 @@ 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 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/attr_missing_field.rs:11:5 + | +11 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/codegen/fail/interface/struct/derive_implementers_duplicate_pretty.stderr b/tests/codegen/fail/interface/struct/derive_implementers_duplicate_pretty.stderr index a4a803789..234878dec 100644 --- a/tests/codegen/fail/interface/struct/derive_implementers_duplicate_pretty.stderr +++ b/tests/codegen/fail/interface/struct/derive_implementers_duplicate_pretty.stderr @@ -9,3 +9,27 @@ error[E0412]: cannot find type `CharacterValue` in this scope | 4 | #[graphql(impl = CharacterValue)] | ^^^^^^^^^^^^^^ not found in this scope + +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/derive_implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/derive_implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/derive_implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/codegen/fail/interface/struct/derive_missing_field.stderr b/tests/codegen/fail/interface/struct/derive_missing_field.stderr index 1e1989bc3..b4e096f4a 100644 --- a/tests/codegen/fail/interface/struct/derive_missing_field.stderr +++ b/tests/codegen/fail/interface/struct/derive_missing_field.stderr @@ -22,38 +22,807 @@ error[E0080]: erroneous constant used | = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0080]: erroneous constant used + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ + | | + | referenced constant has errors + | inside ` as juniper::macros::reflect::Field<__S, id>>::call::_::check` at $WORKSPACE/juniper/src/macros/reflect.rs:719:36 + | inside ` as juniper::macros::reflect::Field<__S, id>>::call::_::RES` at $WORKSPACE/juniper/src/macros/reflect.rs:782:59 + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ + | | + | referenced constant has errors + | inside ` as AsyncField<__S, id>>::call::_::check` at $WORKSPACE/juniper/src/macros/reflect.rs:719:36 + | inside ` as AsyncField<__S, id>>::call::_::RES` at $WORKSPACE/juniper/src/macros/reflect.rs:782:59 + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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 + | ^^ referenced constant has errors | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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 + | ^^ referenced constant has errors | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: erroneous constant used +error: any use of this value will cause an error --> fail/interface/struct/derive_missing_field.rs:12:5 | 12 | id: String, | ^^ referenced constant has errors | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: erroneous constant used +error[E0080]: evaluation of constant value failed + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error --> fail/interface/struct/derive_missing_field.rs:12:5 | 12 | id: String, | ^^ referenced constant has errors | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::assert_field_args` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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 | @@ -61,3 +830,155 @@ 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 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/struct/derive_missing_field.rs:12:5 + | +12 | id: String, + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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, + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/codegen/fail/interface/trait/implementers_duplicate_pretty.stderr b/tests/codegen/fail/interface/trait/implementers_duplicate_pretty.stderr index 5d5469027..13696d8da 100644 --- a/tests/codegen/fail/interface/trait/implementers_duplicate_pretty.stderr +++ b/tests/codegen/fail/interface/trait/implementers_duplicate_pretty.stderr @@ -9,3 +9,27 @@ error[E0412]: cannot find type `CharacterValue` in this scope | 4 | #[graphql(impl = CharacterValue)] | ^^^^^^^^^^^^^^ not found in this scope + +error[E0080]: evaluation of constant value failed + --> fail/interface/trait/implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of constant value failed + --> fail/interface/trait/implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of constant value failed + --> fail/interface/trait/implementers_duplicate_pretty.rs:3:10 + | +3 | #[derive(GraphQLObject)] + | ^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/codegen/fail/interface/trait/missing_field.stderr b/tests/codegen/fail/interface/trait/missing_field.stderr index 6a6cda068..311c80110 100644 --- a/tests/codegen/fail/interface/trait/missing_field.stderr +++ b/tests/codegen/fail/interface/trait/missing_field.stderr @@ -22,38 +22,807 @@ error[E0080]: erroneous constant used | = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0080]: erroneous constant used + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ + | | + | referenced constant has errors + | inside ` as juniper::macros::reflect::Field<__S, id>>::call::_::check` at $WORKSPACE/juniper/src/macros/reflect.rs:719:36 + | inside ` as juniper::macros::reflect::Field<__S, id>>::call::_::RES` at $WORKSPACE/juniper/src/macros/reflect.rs:782:59 + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: erroneous constant used + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ + | | + | referenced constant has errors + | inside ` as AsyncField<__S, id>>::call::_::check` at $WORKSPACE/juniper/src/macros/reflect.rs:719:36 + | inside ` as AsyncField<__S, id>>::call::_::RES` at $WORKSPACE/juniper/src/macros/reflect.rs:782:59 + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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 + | ^^ referenced constant has errors | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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 + | ^^ referenced constant has errors | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: erroneous constant used +error: any use of this value will cause an error --> fail/interface/trait/missing_field.rs:11:8 | 11 | fn id(&self) -> &str; | ^^ referenced constant has errors | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: erroneous constant used +error[E0080]: evaluation of constant value failed + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error --> fail/interface/trait/missing_field.rs:11:8 | 11 | fn id(&self) -> &str; | ^^ referenced constant has errors | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::assert_field_args` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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 | @@ -61,3 +830,155 @@ 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 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::const_concat` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::assert_subtype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: any use of this value will cause an error + --> fail/interface/trait/missing_field.rs:11:8 + | +11 | fn id(&self) -> &str; + | ^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (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; + | ^^ referenced constant has errors + | + = note: this error originates in the macro `$crate::format_type` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/integration/src/codegen/derive_enum.rs b/tests/integration/src/codegen/derive_enum.rs deleted file mode 100644 index acaa49a8a..000000000 --- a/tests/integration/src/codegen/derive_enum.rs +++ /dev/null @@ -1,133 +0,0 @@ -use fnv::FnvHashMap; -use juniper::{ - graphql_input_value, DefaultScalarValue, FromInputValue, GraphQLEnum, GraphQLType, Registry, - ToInputValue, -}; - -pub struct CustomContext {} - -impl juniper::Context for CustomContext {} - -#[derive(GraphQLEnum, Debug, PartialEq)] -#[graphql(name = "Some", description = "enum descr")] -enum SomeEnum { - Regular, - #[graphql(name = "FULL", description = "field descr", deprecated = "depr")] - Full, -} - -#[derive(juniper::GraphQLEnum, Debug, PartialEq)] -#[graphql(rename = "none")] -enum NoRenameEnum { - OneVariant, - AnotherVariant, -} - -/// Enum doc. -#[derive(GraphQLEnum)] -enum DocEnum { - /// Variant doc. - Foo, -} - -/// Doc 1.\ -/// Doc 2. -/// -/// Doc 4. -#[derive(GraphQLEnum, Debug, PartialEq)] -enum MultiDocEnum { - /// Variant 1. - /// Variant 2. - Foo, -} - -/// This is not used as the description. -#[derive(GraphQLEnum, Debug, PartialEq)] -#[graphql(description = "enum override")] -enum OverrideDocEnum { - /// This is not used as the description. - #[graphql(description = "variant override")] - Foo, -} - -#[derive(GraphQLEnum)] -#[graphql(context = CustomContext, noasync)] -enum ContextEnum { - A, -} - -#[test] -fn test_derived_enum() { - // Ensure that rename works. - assert_eq!( - >::name(&()), - Some("Some") - ); - - // Ensure validity of meta info. - let mut registry: Registry<'_> = Registry::new(FnvHashMap::default()); - let meta = SomeEnum::meta(&(), &mut registry); - - assert_eq!(meta.name(), Some("Some")); - assert_eq!(meta.description(), Some("enum descr")); - - // Test no rename variant. - assert_eq!( - <_ as ToInputValue>::to_input_value(&NoRenameEnum::AnotherVariant), - graphql_input_value!("AnotherVariant"), - ); - - // Test Regular variant. - assert_eq!( - <_ as ToInputValue>::to_input_value(&SomeEnum::Regular), - graphql_input_value!("REGULAR"), - ); - assert_eq!( - FromInputValue::::from_input_value(&graphql_input_value!(REGULAR)), - Ok(SomeEnum::Regular), - ); - - // Test FULL variant. - assert_eq!( - <_ as ToInputValue>::to_input_value(&SomeEnum::Full), - graphql_input_value!("FULL"), - ); - assert_eq!( - FromInputValue::::from_input_value(&graphql_input_value!(FULL)), - Ok(SomeEnum::Full) - ); -} - -#[test] -fn test_doc_comment() { - let mut registry: Registry<'_> = Registry::new(FnvHashMap::default()); - let meta = DocEnum::meta(&(), &mut registry); - assert_eq!(meta.description(), Some("Enum doc.")); -} - -#[test] -fn test_multi_doc_comment() { - let mut registry: Registry<'_> = Registry::new(FnvHashMap::default()); - let meta = MultiDocEnum::meta(&(), &mut registry); - assert_eq!(meta.description(), Some("Doc 1. Doc 2.\n\nDoc 4.")); -} - -#[test] -fn test_doc_comment_override() { - let mut registry: Registry<'_> = Registry::new(FnvHashMap::default()); - let meta = OverrideDocEnum::meta(&(), &mut registry); - assert_eq!(meta.description(), Some("enum override")); -} - -fn test_context(_t: T) -where - T: GraphQLType, -{ - // empty -} - -#[test] -fn test_doc_custom_context() { - test_context(ContextEnum::A); - // test_context(OverrideDocEnum::Foo); does not work -} diff --git a/tests/integration/src/codegen/enum_derive.rs b/tests/integration/src/codegen/enum_derive.rs new file mode 100644 index 000000000..24aed8584 --- /dev/null +++ b/tests/integration/src/codegen/enum_derive.rs @@ -0,0 +1,932 @@ +//! Tests for `#[derive(GraphQLEnum)]` macro. + +use juniper::{ + execute, graphql_object, graphql_value, graphql_vars, parser::SourcePosition, + DefaultScalarValue, ExecutionError, FieldError, GraphQLEnum, ScalarValue, +}; + +use crate::util::{schema, schema_with_scalar}; + +mod trivial { + use super::*; + + #[derive(GraphQLEnum)] + enum Character { + Human, + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } + + #[tokio::test] + async fn is_graphql_enum() { + const DOC: &str = r#"{ + __type(name: "Character") { + kind + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"kind": "ENUM"}}), vec![])), + ); + } + + #[tokio::test] + async fn uses_type_name() { + const DOC: &str = r#"{ + __type(name: "Character") { + name + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"name": "Character"}}), vec![])), + ); + } + + #[tokio::test] + async fn has_no_description() { + const DOC: &str = r#"{ + __type(name: "Character") { + description + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"description": null}}), vec![])), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + {"name": "HUMAN", "description": null}, + {"name": "DROID", "description": null}, + ]}}), + vec![], + )), + ); + } +} + +mod ignored_variant { + use super::*; + + #[derive(GraphQLEnum)] + enum Character { + Human, + #[allow(dead_code)] + #[graphql(ignore)] + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + + fn droid() -> Character { + Character::Droid + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } + + #[tokio::test] + async fn err_on_droid() { + const DOC: &str = r#"{ + droid + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!(null), + vec![ExecutionError::new( + SourcePosition::new(14, 1, 12), + &["droid"], + FieldError::from("Cannot resolve ignored enum variant"), + )], + )), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + {"name": "HUMAN", "description": null}, + ]}}), + vec![], + )), + ); + } +} + +mod ignored_generic_variant { + use super::*; + + #[derive(GraphQLEnum)] + enum Character { + Human, + Droid, + #[allow(dead_code)] + #[graphql(ignore)] + Ignored(T), + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character<()>) -> Character<()> { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + {"name": "HUMAN", "description": null}, + {"name": "DROID", "description": null}, + ]}}), + vec![], + )), + ); + } +} + +mod description_from_doc_comment { + use super::*; + + /// Character doc. + #[derive(GraphQLEnum)] + enum Character { + /// Human doc. + Human, + + /// Droid doc. + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } + + #[tokio::test] + async fn is_graphql_enum() { + const DOC: &str = r#"{ + __type(name: "Character") { + kind + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"kind": "ENUM"}}), vec![])), + ); + } + + #[tokio::test] + async fn uses_type_name() { + const DOC: &str = r#"{ + __type(name: "Character") { + name + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"name": "Character"}}), vec![])), + ); + } + + #[tokio::test] + async fn has_description() { + const DOC: &str = r#"{ + __type(name: "Character") { + description + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"description": "Character doc."}}), + vec![], + )), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + isDeprecated + deprecationReason + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + { + "name": "HUMAN", + "description": "Human doc.", + "isDeprecated": false, + "deprecationReason": null, + }, + { + "name": "DROID", + "description": "Droid doc.", + "isDeprecated": false, + "deprecationReason": null, + }, + ]}}), + vec![], + )), + ); + } +} + +mod deprecation_from_attr { + #![allow(deprecated)] + + use super::*; + + /// Character doc. + #[derive(GraphQLEnum)] + enum Character { + /// Human doc. + #[deprecated] + Human, + + /// Droid doc. + #[deprecated(note = "Reason")] + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn has_description() { + const DOC: &str = r#"{ + __type(name: "Character") { + description + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"description": "Character doc."}}), + vec![], + )), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"enumValues": []}}), vec![])), + ); + } + + #[tokio::test] + async fn has_enum_values_with_deprecated() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues(includeDeprecated: true) { + name + description + isDeprecated + deprecationReason + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + { + "name": "HUMAN", + "description": "Human doc.", + "isDeprecated": true, + "deprecationReason": null, + }, + { + "name": "DROID", + "description": "Droid doc.", + "isDeprecated": true, + "deprecationReason": "Reason", + }, + ]}}), + vec![], + )), + ); + } +} + +mod deprecation_from_graphql_attr { + #![allow(deprecated)] + + use super::*; + + /// Character doc. + #[derive(GraphQLEnum)] + enum Character { + /// Human doc. + #[graphql(deprecated)] + Human, + + /// Droid doc. + #[graphql(deprecated = "Reason")] + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn has_description() { + const DOC: &str = r#"{ + __type(name: "Character") { + description + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"description": "Character doc."}}), + vec![], + )), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"enumValues": []}}), vec![])), + ); + } + + #[tokio::test] + async fn has_enum_values_with_deprecated() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues(includeDeprecated: true) { + name + description + isDeprecated + deprecationReason + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + { + "name": "HUMAN", + "description": "Human doc.", + "isDeprecated": true, + "deprecationReason": null, + }, + { + "name": "DROID", + "description": "Droid doc.", + "isDeprecated": true, + "deprecationReason": "Reason", + }, + ]}}), + vec![], + )), + ); + } +} + +mod explicit_name_description_and_deprecation { + #![allow(deprecated)] + + use super::*; + + /// Doc comment. + #[derive(GraphQLEnum)] + #[graphql(name = "MyCharacter", desc = "Character doc.")] + enum Character { + /// Human doc. + #[graphql(name = "MY_HUMAN", desc = "My human doc.", deprecated = "Not used.")] + #[deprecated(note = "Should be omitted.")] + Human, + + /// Droid doc. + #[graphql(deprecated = "Reason")] + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn has_no_description() { + const DOC: &str = r#"{ + __type(name: "MyCharacter") { + description + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"description": "Character doc."}}), + vec![], + )), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "MyCharacter") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"__type": {"enumValues": []}}), vec![])), + ); + } + + #[tokio::test] + async fn has_enum_values_with_deprecated() { + const DOC: &str = r#"{ + __type(name: "MyCharacter") { + enumValues(includeDeprecated: true) { + name + description + isDeprecated + deprecationReason + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + { + "name": "MY_HUMAN", + "description": "My human doc.", + "isDeprecated": true, + "deprecationReason": "Not used.", + }, + { + "name": "DROID", + "description": "Droid doc.", + "isDeprecated": true, + "deprecationReason": "Reason", + }, + ]}}), + vec![], + )), + ); + } +} + +mod renamed_all_fields { + use super::*; + + #[derive(GraphQLEnum)] + #[graphql(rename_all = "none")] + enum Character { + Human, + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: Human) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "Human"}), vec![])), + ); + } + + #[tokio::test] + async fn has_enum_values() { + const DOC: &str = r#"{ + __type(name: "Character") { + enumValues { + name + description + } + } + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok(( + graphql_value!({"__type": {"enumValues": [ + {"name": "Human", "description": null}, + {"name": "Droid", "description": null}, + ]}}), + vec![], + )), + ); + } +} + +mod explicit_scalar { + use super::*; + + #[derive(GraphQLEnum)] + #[graphql(scalar = DefaultScalarValue)] + enum Character { + Human, + Droid, + } + + struct QueryRoot; + + #[graphql_object(scalar = DefaultScalarValue)] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } +} + +mod custom_scalar { + use crate::custom_scalar::MyScalarValue; + + use super::*; + + #[derive(GraphQLEnum)] + #[graphql(scalar = MyScalarValue)] + enum Character { + Human, + Droid, + } + + struct QueryRoot; + + #[graphql_object(scalar = MyScalarValue)] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema_with_scalar::(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } +} + +mod explicit_generic_scalar { + + use super::*; + + #[derive(GraphQLEnum)] + #[graphql(scalar = S)] + enum Character { + Human, + Droid, + #[allow(dead_code)] + #[graphql(ignore)] + Scalar(S), + } + + struct QueryRoot; + + #[graphql_object(scalar = S: ScalarValue)] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } +} + +mod bounded_generic_scalar { + use super::*; + + #[derive(GraphQLEnum)] + #[graphql(scalar = S: ScalarValue + Clone)] + enum Character { + Human, + Droid, + } + + struct QueryRoot; + + #[graphql_object] + impl QueryRoot { + fn pass_as_is(character: Character) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &()).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } +} + +mod explicit_custom_context { + use super::*; + + struct CustomContext(String); + + impl juniper::Context for CustomContext {} + + #[derive(GraphQLEnum)] + #[graphql(context = CustomContext)] + enum Character { + Human, + Droid, + } + + struct QueryRoot; + + #[graphql_object(context = CustomContext)] + impl QueryRoot { + fn pass_as_is(character: Character, _ctx: &CustomContext) -> Character { + character + } + } + + #[tokio::test] + async fn resolves() { + const DOC: &str = r#"{ + passAsIs(character: HUMAN) + }"#; + + let schema = schema(QueryRoot); + let ctx = CustomContext("ctx".into()); + + assert_eq!( + execute(DOC, None, &schema, &graphql_vars! {}, &ctx).await, + Ok((graphql_value!({"passAsIs": "HUMAN"}), vec![])), + ); + } +} diff --git a/tests/integration/src/codegen/mod.rs b/tests/integration/src/codegen/mod.rs index 3a709c66a..830f6e1a3 100644 --- a/tests/integration/src/codegen/mod.rs +++ b/tests/integration/src/codegen/mod.rs @@ -1,6 +1,6 @@ -mod derive_enum; mod derive_input_object; mod derive_object_with_raw_idents; +mod enum_derive; mod interface_attr_struct; mod interface_attr_trait; mod interface_derive;