Repository: graphql-rust/juniper (language: rust)

Issue:
Fix helper macros for 2018 edition.
Fixes #298 


Discussion / hints:

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index 52218edff..f3b6d117b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,8 @@
 members = [
   "juniper_codegen",
   "juniper",
-  "juniper_tests",
+  "integration_tests/juniper_tests",
+  "integration_tests/juniper_2018_edition_tests",
   "juniper_hyper",
   "juniper_iron",
   "juniper_rocket",
diff --git a/juniper/CHANGELOG.md b/juniper/CHANGELOG.md
index 8aa5cdef8..0522fd1d8 100644
--- a/juniper/CHANGELOG.md
+++ b/juniper/CHANGELOG.md
@@ -2,11 +2,21 @@
 
 - No changes yet
 
+# [0.11.1] 2018-12-19
+
+## Changes
+
+- The minimum required Rust version is now `1.30`.
+- All macros and the custom derives now support the macro system changes properly
+  and also support Rust 2018 edition crates.
+
+  [#298](https://github.com/graphql-rust/juniper/pull/298)
+
 # [0.11.0] 2018-12-17
 
 ## Changes
 
-- The minimum required Rust version is now `1.28.0`.
+- The minimum required Rust version is now `1.30.0`.
 
   [#271](https://github.com/graphql-rust/juniper/pull/271)
 
diff --git a/juniper/Cargo.toml b/juniper/Cargo.toml
index 442335a98..fec422031 100644
--- a/juniper/Cargo.toml
+++ b/juniper/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "juniper"
-version = "0.11.0"
+version = "0.11.1"
 authors = [
     "Magnus Hallin <mhallin@fastmail.com>",
     "Christoph Herzog <chris@theduke.at>",
@@ -31,7 +31,7 @@ default = [
 ]
 
 [dependencies]
-juniper_codegen = { version = "0.11.0", path = "../juniper_codegen"  }
+juniper_codegen = { version = "0.11.1", path = "../juniper_codegen"  }
 
 fnv = "1.0.3"
 indexmap = { version = "1.0.0", features = ["serde-1"] }
diff --git a/juniper/src/lib.rs b/juniper/src/lib.rs
index c32cf3c7e..6d37632d0 100644
--- a/juniper/src/lib.rs
+++ b/juniper/src/lib.rs
@@ -121,20 +121,6 @@ extern crate juniper_codegen;
 #[doc(hidden)]
 pub use juniper_codegen::*;
 
-// This macro is used as abstraction to make custom derives work
-// in juniper itself and outside of juniper
-// This macro needs to be here because it is used a derive in value::scalar
-// The tests in macros are using a macro from the value module, and because
-// rust macros needs to be defined before they are used it would cause problems
-// to move this macro somewhere else.
-#[macro_export]
-#[doc(hidden)]
-macro_rules! __juniper_use_everything {
-    () => {
-        pub use $crate::*;
-    };
-}
-
 #[macro_use]
 mod value;
 #[macro_use]
diff --git a/juniper/src/macros/common.rs b/juniper/src/macros/common.rs
index 733ce93bf..168707b83 100644
--- a/juniper/src/macros/common.rs
+++ b/juniper/src/macros/common.rs
@@ -61,7 +61,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [$($lifetime,)*],
@@ -82,7 +82,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [$($lifetime,)*],
@@ -102,7 +102,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [$($lifetime,)*],
@@ -123,7 +123,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [],
@@ -144,7 +144,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [],
@@ -165,7 +165,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [],
@@ -186,7 +186,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [$($lifetime,)*],
@@ -207,7 +207,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [$($lifetime,)*],
@@ -227,7 +227,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [$($lifetime,)*],
@@ -250,7 +250,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [],
@@ -270,7 +270,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [],
@@ -290,7 +290,7 @@ macro_rules! __juniper_parse_object_header {
             $($items: tt)*
         }
     ) => {
-        $callback!(
+        $crate::$callback!(
             @parse,
             meta = {
                 lifetimes = [],
@@ -311,7 +311,6 @@ macro_rules! __juniper_parse_object_header {
     };
 }
 
-
 #[doc(hidden)]
 #[macro_export]
 macro_rules! __juniper_parse_field_list {
@@ -322,7 +321,7 @@ macro_rules! __juniper_parse_field_list {
         items = [$({$($items: tt)*},)*],
         rest =
     ) => {
-        $success_callback!(
+        $crate::$success_callback!(
             @generate,
             meta = {$($meta)*},
             items = [$({$($items)*},)*],
@@ -336,7 +335,7 @@ macro_rules! __juniper_parse_field_list {
         items = [$({$($items: tt)*},)*],
         rest = , $($rest: tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {$($meta)*},
@@ -363,7 +362,7 @@ macro_rules! __juniper_parse_field_list {
         items = [$({$($items: tt)*},)*],
         rest = $desc: tt  $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {
@@ -388,7 +387,7 @@ macro_rules! __juniper_parse_field_list {
         items = [$({$($items: tt)*},)*],
         rest = description:  $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             @parse_description,
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
@@ -411,7 +410,7 @@ macro_rules! __juniper_parse_field_list {
         ) -> $return_ty: ty $body: block
             $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {$($meta)*},
@@ -446,7 +445,7 @@ macro_rules! __juniper_parse_field_list {
         ) -> $return_ty: ty $body: block
             $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {$($meta)*},
@@ -479,7 +478,7 @@ macro_rules! __juniper_parse_field_list {
         ) -> $return_ty: ty $(as $desc: tt)* $body: block
             $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {$($meta)*},
@@ -513,7 +512,7 @@ macro_rules! __juniper_parse_field_list {
         ) -> $return_ty: ty $(as $desc: tt)* $body: block
             $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {$($meta)*},
@@ -546,7 +545,7 @@ macro_rules! __juniper_parse_field_list {
         items = [$({$($items: tt)*},)*],
         rest = $($rest:tt)*
     ) => {
-        $callback!(
+        $crate::$callback!(
             $($header)*
             success_callback = $success_callback,
             additional_parser = {
@@ -586,7 +585,7 @@ macro_rules! __juniper_parse_instance_resolver {
             $( $srctype:ty => $resolver:expr ),* $(,)*
         } $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {
@@ -633,7 +632,7 @@ macro_rules! __juniper_parse_instance_resolver {
         items = [$({$($items: tt)*},)*],
         rest = instance_resolvers: |$(&)* _| {$( $srctype:ty => $resolver:expr ),* $(,)*} $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {
diff --git a/juniper/src/macros/interface.rs b/juniper/src/macros/interface.rs
index 43559841d..898ab0cc1 100644
--- a/juniper/src/macros/interface.rs
+++ b/juniper/src/macros/interface.rs
@@ -85,7 +85,7 @@ graphql_interface!(<'a> &'a Character: Database as "Character" |&self| {
 [1]: macro.graphql_object!.html
 
 */
-#[macro_export(local_inner_macros)]
+#[macro_export]
 macro_rules! graphql_interface {
 
     (
@@ -127,7 +127,7 @@ macro_rules! graphql_interface {
             $(executor_var = $executor: ident,)*
         },)*],
     ) => {
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl<$($scalar)* $(, $lifetimes)* > GraphQLType for $name {
                 type Context = $ctx;
                 type TypeInfo = ();
@@ -138,10 +138,10 @@ macro_rules! graphql_interface {
 
                 fn meta<'r>(
                     info: &Self::TypeInfo,
-                    registry: &mut $crate::Registry<'r, __juniper_insert_generic!($($scalar)+)>
-                ) -> $crate::meta::MetaType<'r, __juniper_insert_generic!($($scalar)+)>
-                where for<'__b> &'__b __juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
-                    __juniper_insert_generic!($($scalar)+): 'r
+                    registry: &mut $crate::Registry<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                ) -> $crate::meta::MetaType<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                where for<'__b> &'__b $crate::__juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
+                    $crate::__juniper_insert_generic!($($scalar)+): 'r
                 {
                     // Ensure all child types are registered
                     $(
@@ -149,14 +149,14 @@ macro_rules! graphql_interface {
                     )*
                     let fields = &[$(
                         registry.field_convert::<$return_ty, _, Self::Context>(
-                            &$crate::to_camel_case(__graphql__stringify!($fn_name)),
+                            &$crate::to_camel_case(stringify!($fn_name)),
                             info
                         )
                             $(.description($fn_description))*
                             .push_docstring(&[$($docstring,)*])
                             $(.deprecated($deprecated))*
                             $(.argument(
-                                __juniper_create_arg!(
+                                $crate::__juniper_create_arg!(
                                     registry = registry,
                                     info = info,
                                     arg_ty = $arg_ty,
@@ -180,17 +180,17 @@ macro_rules! graphql_interface {
                     &$main_self,
                     info: &Self::TypeInfo,
                     field: &str,
-                    args: &$crate::Arguments<__juniper_insert_generic!($($scalar)+)>,
-                    executor: &$crate::Executor<Self::Context, __juniper_insert_generic!($($scalar)+)>
-                ) -> $crate::ExecutionResult<__juniper_insert_generic!($($scalar)+)> {
+                    args: &$crate::Arguments<$crate::__juniper_insert_generic!($($scalar)+)>,
+                    executor: &$crate::Executor<Self::Context, $crate::__juniper_insert_generic!($($scalar)+)>
+                ) -> $crate::ExecutionResult<$crate::__juniper_insert_generic!($($scalar)+)> {
                     $(
-                        if field == &$crate::to_camel_case(__graphql__stringify!($fn_name)) {
+                        if field == &$crate::to_camel_case(stringify!($fn_name)) {
                             let result: $return_ty = (|| {
                                 $(
                                     let $arg_name: $arg_ty = args.get(&$crate::to_camel_case(stringify!($arg_name)))
-                                        .expect(__graphql__concat!(
+                                        .expect(concat!(
                                             "Argument ",
-                                            __graphql__stringify!($arg_name),
+                                            stringify!($arg_name),
                                             " missing - validation must have failed"
                                         ));
                                 )*
@@ -213,7 +213,7 @@ macro_rules! graphql_interface {
                         }
                     )*
 
-                    __graphql__panic!("Field {} not found on type {}", field, $($outname)*)
+                    panic!("Field {} not found on type {}", field, $($outname)*)
                 }
 
                 #[allow(unused_variables)]
@@ -227,16 +227,16 @@ macro_rules! graphql_interface {
                         }
                     )*
 
-                    __graphql__panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
+                    panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
                 }
 
                 fn resolve_into_type(
                     &$main_self,
                     _info: &Self::TypeInfo,
                     type_name: &str,
-                    _: Option<&[$crate::Selection<__juniper_insert_generic!($($scalar)*)>]>,
-                    executor: &$crate::Executor<Self::Context, __juniper_insert_generic!($($scalar)*)>,
-                ) -> $crate::ExecutionResult<__juniper_insert_generic!($($scalar)*)> {
+                    _: Option<&[$crate::Selection<$crate::__juniper_insert_generic!($($scalar)*)>]>,
+                    executor: &$crate::Executor<Self::Context, $crate::__juniper_insert_generic!($($scalar)*)>,
+                ) -> $crate::ExecutionResult<$crate::__juniper_insert_generic!($($scalar)*)> {
                     $(let $resolver_ctx = &executor.context();)*
 
                     $(
@@ -245,7 +245,7 @@ macro_rules! graphql_interface {
                         }
                     )*
 
-                     __graphql__panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
+                     panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
                 }
             }
         );
@@ -256,7 +256,7 @@ macro_rules! graphql_interface {
         meta = {$($meta:tt)*},
         rest = $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = graphql_interface,
             additional_parser = {
                 callback = __juniper_parse_instance_resolver,
@@ -269,13 +269,13 @@ macro_rules! graphql_interface {
     };
 
     (@$($stuff:tt)*) => {
-        __graphql__compile_error!("Invalid syntax for `graphql_interface!`");
+        compile_error!("Invalid syntax for `graphql_interface!`");
     };
 
     (
         $($rest:tt)*
     ) => {
-        __juniper_parse_object_header!(
+        $crate::__juniper_parse_object_header!(
             callback = graphql_interface,
             rest = $($rest)*
         );
diff --git a/juniper/src/macros/mod.rs b/juniper/src/macros/mod.rs
index 4526fa1f8..4da45a6a4 100644
--- a/juniper/src/macros/mod.rs
+++ b/juniper/src/macros/mod.rs
@@ -1,29 +1,5 @@
 // Wrapper macros which allows built-in macros to be recognized as "crate-local".
 
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __graphql__panic {
-    ($($t:tt)*) => ( panic!($($t)*) );
-}
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __graphql__stringify {
-    ($($t:tt)*) => ( stringify!($($t)*) );
-}
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __graphql__concat {
-    ($($t:tt)*) => ( concat!($($t)*) );
-}
-
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __graphql__compile_error {
-    ($t:expr) => ( compile_error!($t) );
-}
-
 #[macro_use]
 mod common;
 #[macro_use]
diff --git a/juniper/src/macros/object.rs b/juniper/src/macros/object.rs
index 310946a76..ee1054207 100644
--- a/juniper/src/macros/object.rs
+++ b/juniper/src/macros/object.rs
@@ -310,7 +310,7 @@ arg_name: ArgType
 [1]: struct.Executor.html
 
 */
-#[macro_export(local_inner_macros)]
+#[macro_export]
 macro_rules! graphql_object {
     (
         @generate,
@@ -343,7 +343,7 @@ macro_rules! graphql_object {
             $(executor_var = $executor: ident,)*
         },)*],
     ) => {
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl<$($scalar)* $(, $lifetimes)* > GraphQLType for $name {
                 type Context = $ctx;
                 type TypeInfo = ();
@@ -354,21 +354,21 @@ macro_rules! graphql_object {
 
                 fn meta<'r>(
                     info: &Self::TypeInfo,
-                    registry: &mut $crate::Registry<'r, __juniper_insert_generic!($($scalar)+)>
-                ) -> $crate::meta::MetaType<'r, __juniper_insert_generic!($($scalar)+)>
-                where for<'__b> &'__b __juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
-                    __juniper_insert_generic!($($scalar)+): 'r
+                    registry: &mut $crate::Registry<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                ) -> $crate::meta::MetaType<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                where for<'__b> &'__b $crate::__juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
+                    $crate::__juniper_insert_generic!($($scalar)+): 'r
                 {
                     let fields = &[$(
                         registry.field_convert::<$return_ty, _, Self::Context>(
-                            &$crate::to_camel_case(__graphql__stringify!($fn_name)),
+                            &$crate::to_camel_case(stringify!($fn_name)),
                             info
                         )
                             $(.description($fn_description))*
                             .push_docstring(&[$($docstring,)*])
                             $(.deprecated($deprecated))*
                             $(.argument(
-                                __juniper_create_arg!(
+                                $crate::__juniper_create_arg!(
                                     registry = registry,
                                     info = info,
                                     arg_ty = $arg_ty,
@@ -398,17 +398,17 @@ macro_rules! graphql_object {
                     &$main_self,
                     info: &Self::TypeInfo,
                     field: &str,
-                    args: &$crate::Arguments<__juniper_insert_generic!($($scalar)+)>,
-                    executor: &$crate::Executor<Self::Context, __juniper_insert_generic!($($scalar)+)>
-                ) -> $crate::ExecutionResult<__juniper_insert_generic!($($scalar)+)> {
+                    args: &$crate::Arguments<$crate::__juniper_insert_generic!($($scalar)+)>,
+                    executor: &$crate::Executor<Self::Context, $crate::__juniper_insert_generic!($($scalar)+)>
+                ) -> $crate::ExecutionResult<$crate::__juniper_insert_generic!($($scalar)+)> {
                     $(
-                        if field == &$crate::to_camel_case(__graphql__stringify!($fn_name)) {
+                        if field == &$crate::to_camel_case(stringify!($fn_name)) {
                             let result: $return_ty = (|| {
                                 $(
-                                    let $arg_name: $arg_ty = args.get(&$crate::to_camel_case(__graphql__stringify!($arg_name)))
-                                        .expect(__graphql__concat!(
+                                    let $arg_name: $arg_ty = args.get(&$crate::to_camel_case(stringify!($arg_name)))
+                                        .expect(concat!(
                                             "Argument ",
-                                            __graphql__stringify!($arg_name),
+                                            stringify!($arg_name),
                                             " missing - validation must have failed"
                                         ));
                                 )*
@@ -431,7 +431,7 @@ macro_rules! graphql_object {
                         }
                     )*
 
-                    __graphql__panic!("Field {} not found on type {}", field, $($outname)*);
+                    panic!("Field {} not found on type {}", field, $($outname)*);
                 }
             }
         );
@@ -457,7 +457,7 @@ macro_rules! graphql_object {
         items = [$({$($items: tt)*},)*],
         rest = [$($interface: ty),+]  $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
             meta = {
@@ -485,7 +485,7 @@ macro_rules! graphql_object {
         items = [$({$($items: tt)*},)*],
         rest = interfaces: $($rest:tt)*
     ) => {
-        graphql_object!(
+        $crate::graphql_object!(
             @parse_interfaces,
             success_callback = $success_callback,
             additional_parser = {$($additional)*},
@@ -501,7 +501,7 @@ macro_rules! graphql_object {
         meta = {$($meta:tt)*},
         rest = $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = graphql_object,
             additional_parser = {
                 callback = graphql_object,
@@ -514,13 +514,13 @@ macro_rules! graphql_object {
     };
 
     (@$($stuff:tt)*) => {
-        __graphql__compile_error!("Invalid syntax for `graphql_object!`");
+        compile_error!("Invalid syntax for `graphql_object!`");
     };
 
     (
         $($rest:tt)*
     ) => {
-        __juniper_parse_object_header!(
+        $crate::__juniper_parse_object_header!(
             callback = graphql_object,
             rest = $($rest)*
         );
diff --git a/juniper/src/macros/scalar.rs b/juniper/src/macros/scalar.rs
index 967857cca..93e2e324b 100644
--- a/juniper/src/macros/scalar.rs
+++ b/juniper/src/macros/scalar.rs
@@ -45,7 +45,7 @@ In addition to implementing `GraphQLType` for the type in question,
 usable as arguments and default values.
 
 */
-#[macro_export(local_inner_macros)]
+#[macro_export]
 macro_rules! graphql_scalar {
     ( @as_expr $e:expr) => { $e };
     (
@@ -74,21 +74,21 @@ macro_rules! graphql_scalar {
         },
 
     ) => {
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl <$($scalar)+> GraphQLType for $name {
                 type Context = ();
                 type TypeInfo = ();
 
                 fn name(_: &Self::TypeInfo) -> Option<&str> {
-                    Some(graphql_scalar!(@as_expr $($outname)+))
+                    Some($crate::graphql_scalar!(@as_expr $($outname)+))
                 }
 
                 fn meta<'r>(
                     info: &Self::TypeInfo,
-                    registry: &mut $crate::Registry<'r, __juniper_insert_generic!($($scalar)+)>
-                ) -> $crate::meta::MetaType<'r, __juniper_insert_generic!($($scalar)+)>
-                where for<'__b> &'__b __juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
-                    __juniper_insert_generic!($($scalar)+): 'r
+                    registry: &mut $crate::Registry<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                ) -> $crate::meta::MetaType<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                where for<'__b> &'__b $crate::__juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
+                    $crate::__juniper_insert_generic!($($scalar)+): 'r
                 {
                     let meta = registry.build_scalar_type::<Self>(info);
                     $(
@@ -100,35 +100,35 @@ macro_rules! graphql_scalar {
                 fn resolve(
                     &$resolve_self_var,
                     _: &(),
-                    _: Option<&[$crate::Selection<__juniper_insert_generic!($($scalar)+)>]>,
+                    _: Option<&[$crate::Selection<$crate::__juniper_insert_generic!($($scalar)+)>]>,
                     _: &$crate::Executor<
                         Self::Context,
-                        __juniper_insert_generic!($($scalar)+)
-                    >) -> $crate::Value<__juniper_insert_generic!($($scalar)+)> {
+                        $crate::__juniper_insert_generic!($($scalar)+)
+                    >) -> $crate::Value<$crate::__juniper_insert_generic!($($scalar)+)> {
                     $resolve_body
                 }
             });
 
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl<$($scalar)+> ToInputValue for $name {
-                fn to_input_value(&$resolve_self_var) -> $crate::InputValue<__juniper_insert_generic!($($scalar)+)> {
+                fn to_input_value(&$resolve_self_var) -> $crate::InputValue<$crate::__juniper_insert_generic!($($scalar)+)> {
                     let v = $resolve_body;
                     $crate::ToInputValue::to_input_value(&v)
                 }
             }
         );
 
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl<$($scalar)+> FromInputValue for $name {
                 fn from_input_value(
-                    $from_input_value_arg: &$crate::InputValue<__juniper_insert_generic!($($scalar)+)>
+                    $from_input_value_arg: &$crate::InputValue<$crate::__juniper_insert_generic!($($scalar)+)>
                 ) -> $from_input_value_result {
                     $from_input_value_body
                 }
             }
         );
 
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl<$($scalar)+> ParseScalarValue for $name {
                 fn from_str<$from_str_lt>($from_str_arg: $crate::parser::ScalarToken<$from_str_lt>) -> $from_str_result {
                     $from_str_body
@@ -151,7 +151,7 @@ macro_rules! graphql_scalar {
         from_str = {$($from_str_body:tt)+},
         rest =
     ) => {
-        graphql_scalar!(
+        $crate::graphql_scalar!(
             @generate,
             meta = {
                 name = $name,
@@ -177,7 +177,7 @@ macro_rules! graphql_scalar {
         $(from_str = {$($from_str_body:tt)+})*,
         rest =
     ) => {
-        __graphql__compile_error!("Missing resolve function");
+        compile_error!("Missing resolve function");
     };
 
     (
@@ -192,7 +192,7 @@ macro_rules! graphql_scalar {
         $(from_str = {$($from_str_body:tt)+})*,
         rest =
     ) => {
-        __graphql__compile_error!("Missing from_input_value function");
+        compile_error!("Missing from_input_value function");
     };
 
     (
@@ -207,7 +207,7 @@ macro_rules! graphql_scalar {
         from_input_value = {$($from_input_value_body:tt)+},
         rest =
     ) =>{
-        __graphql__compile_error!("Missing from_str function");
+        compile_error!("Missing from_str function");
     };
 
 
@@ -220,7 +220,7 @@ macro_rules! graphql_scalar {
         $(from_str = {$($from_str_body:tt)+},)*
         rest = resolve(&$selfvar:ident) -> $return_ty:ty $body:block $($rest:tt)*
     ) => {
-        graphql_scalar!(
+        $crate::graphql_scalar!(
             @parse_functions,
             meta = {$($meta)*},
             resolve = {
@@ -243,7 +243,7 @@ macro_rules! graphql_scalar {
         $(from_str = {$($from_str_body:tt)+},)*
         rest = from_input_value($arg:ident: &InputValue) -> $result:ty $body:block $($rest:tt)*
     ) => {
-        graphql_scalar!(
+        $crate::graphql_scalar!(
             @parse_functions,
             meta = { $($meta)* },
             $(resolve = {$($resolve_body)+},)*
@@ -266,7 +266,7 @@ macro_rules! graphql_scalar {
         $(from_str = {$($from_str_body:tt)+},)*
         rest = from_str<$from_str_lt: tt>($value_arg:ident: ScalarToken<$ignored_lt2: tt>) -> $result:ty $body:block $($rest:tt)*
     ) => {
-        graphql_scalar!(
+        $crate::graphql_scalar!(
             @parse_functions,
             meta = { $($meta)* },
             $(resolve = {$($resolve_body)+},)*
@@ -294,7 +294,7 @@ macro_rules! graphql_scalar {
         $(from_str = {$($from_str_body:tt)+},)*
         rest = description: $descr:tt $($rest:tt)*
     ) => {
-        graphql_scalar!(
+        $crate::graphql_scalar!(
             @parse_functions,
             meta = {
                 name = $name,
@@ -319,7 +319,7 @@ macro_rules! graphql_scalar {
         },
         rest = $($rest:tt)*
     ) => {
-         graphql_scalar!(
+         $crate::graphql_scalar!(
             @parse_functions,
             meta = {
                 name = $name,
@@ -331,11 +331,11 @@ macro_rules! graphql_scalar {
     };
 
     (@$($stuff:tt)*) => {
-        __graphql__compile_error!("Invalid syntax for `graphql_scalar!`");
+        compile_error!("Invalid syntax for `graphql_scalar!`");
     };
 
     ($($rest:tt)*) => {
-        __juniper_parse_object_header!(
+        $crate::__juniper_parse_object_header!(
             callback = graphql_scalar,
             rest = $($rest)*
         );
diff --git a/juniper/src/macros/union.rs b/juniper/src/macros/union.rs
index 60fe627b4..6fa444802 100644
--- a/juniper/src/macros/union.rs
+++ b/juniper/src/macros/union.rs
@@ -17,7 +17,7 @@ resolvers.
 [1]: macro.graphql_object!.html
 [2]: macro.graphql_interface!.html
 */
-#[macro_export(local_inner_macros)]
+#[macro_export]
 macro_rules! graphql_union {
 
     (
@@ -44,7 +44,7 @@ macro_rules! graphql_union {
         },
         items = [],
     ) => {
-        __juniper_impl_trait!(
+        $crate::__juniper_impl_trait!(
             impl<$($scalar)* $(, $lifetimes)* > GraphQLType for $name {
                 type Context = $ctx;
                 type TypeInfo = ();
@@ -55,10 +55,10 @@ macro_rules! graphql_union {
 
                 fn meta<'r>(
                     info: &Self::TypeInfo,
-                    registry: &mut $crate::Registry<'r, __juniper_insert_generic!($($scalar)+)>
-                ) -> $crate::meta::MetaType<'r, __juniper_insert_generic!($($scalar)+)>
-                where for<'__b> &'__b __juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
-                    __juniper_insert_generic!($($scalar)+): 'r
+                    registry: &mut $crate::Registry<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                ) -> $crate::meta::MetaType<'r, $crate::__juniper_insert_generic!($($scalar)+)>
+                where for<'__b> &'__b $crate::__juniper_insert_generic!($($scalar)+): $crate::ScalarRefValue<'__b>,
+                    $crate::__juniper_insert_generic!($($scalar)+): 'r
                 {
                     let types = &[
                         $(
@@ -83,16 +83,16 @@ macro_rules! graphql_union {
                         }
                     )*
 
-                    __graphql__panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
+                    panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
                 }
 
                 fn resolve_into_type(
                     &$main_self,
                     _info: &Self::TypeInfo,
                     type_name: &str,
-                    _: Option<&[$crate::Selection<__juniper_insert_generic!($($scalar)*)>]>,
-                    executor: &$crate::Executor<Self::Context, __juniper_insert_generic!($($scalar)*)>,
-                ) -> $crate::ExecutionResult<__juniper_insert_generic!($($scalar)*)> {
+                    _: Option<&[$crate::Selection<$crate::__juniper_insert_generic!($($scalar)*)>]>,
+                    executor: &$crate::Executor<Self::Context, $crate::__juniper_insert_generic!($($scalar)*)>,
+                ) -> $crate::ExecutionResult<$crate::__juniper_insert_generic!($($scalar)*)> {
                     $(let $resolver_ctx = &executor.context();)*
 
                     $(
@@ -101,7 +101,7 @@ macro_rules! graphql_union {
                         }
                     )*
 
-                     __graphql__panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
+                     panic!("Concrete type not handled by instance resolvers on {}", $($outname)*);
                 }
             }
         );
@@ -113,7 +113,7 @@ macro_rules! graphql_union {
         meta = {$($meta:tt)*},
         rest = $($rest:tt)*
     ) => {
-        __juniper_parse_field_list!(
+        $crate::__juniper_parse_field_list!(
             success_callback = graphql_union,
             additional_parser = {
                 callback = __juniper_parse_instance_resolver,
@@ -125,11 +125,11 @@ macro_rules! graphql_union {
         );
     };
     (@$($stuff:tt)*) => {
-        __graphql__compile_error!("Invalid syntax for `graphql_union!`");
+        compile_error!("Invalid syntax for `graphql_union!`");
     };
 
     ($($rest: tt)*) => {
-        __juniper_parse_object_header!(
+        $crate::__juniper_parse_object_header!(
             callback = graphql_union,
             rest = $($rest)*
         );
diff --git a/juniper/src/schema/model.rs b/juniper/src/schema/model.rs
index 3b18736ff..77b43c601 100644
--- a/juniper/src/schema/model.rs
+++ b/juniper/src/schema/model.rs
@@ -57,7 +57,7 @@ pub struct DirectiveType<'a, S> {
     pub arguments: Vec<Argument<'a, S>>,
 }
 
-#[derive(Clone, PartialEq, Eq, Debug, GraphQLEnum)]
+#[derive(Clone, PartialEq, Eq, Debug, GraphQLEnumInternal)]
 #[graphql(name = "__DirectiveLocation")]
 pub enum DirectiveLocation {
     Query,
diff --git a/juniper/src/types/base.rs b/juniper/src/types/base.rs
index f62216fe0..69a2ae95c 100644
--- a/juniper/src/types/base.rs
+++ b/juniper/src/types/base.rs
@@ -12,7 +12,7 @@ use schema::meta::{Argument, MetaType};
 ///
 /// The GraphQL specification defines a number of type kinds - the meta type
 /// of a type.
-#[derive(Clone, Eq, PartialEq, Debug, GraphQLEnum)]
+#[derive(Clone, Eq, PartialEq, Debug, GraphQLEnumInternal)]
 #[graphql(name = "__TypeKind")]
 pub enum TypeKind {
     /// ## Scalar types
diff --git a/juniper/src/value/scalar.rs b/juniper/src/value/scalar.rs
index 5c110ead2..2f61fee33 100644
--- a/juniper/src/value/scalar.rs
+++ b/juniper/src/value/scalar.rs
@@ -251,7 +251,7 @@ where
 /// The default scalar value representation in juniper
 ///
 /// This types closely follows the graphql specification.
-#[derive(Debug, PartialEq, Clone, ScalarValue)]
+#[derive(Debug, PartialEq, Clone, GraphQLScalarValueInternal)]
 #[allow(missing_docs)]
 pub enum DefaultScalarValue {
     Int(i32),
diff --git a/juniper_codegen/Cargo.toml b/juniper_codegen/Cargo.toml
index b2503b87e..39f9cc511 100644
--- a/juniper_codegen/Cargo.toml
+++ b/juniper_codegen/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "juniper_codegen"
-version = "0.11.0"
+version = "0.11.1"
 authors = [
     "Magnus Hallin <mhallin@fastmail.com>",
     "Christoph Herzog <chris@theduke.at>",
diff --git a/juniper_codegen/src/derive_enum.rs b/juniper_codegen/src/derive_enum.rs
index b6f196aa0..bfc8c8327 100644
--- a/juniper_codegen/src/derive_enum.rs
+++ b/juniper_codegen/src/derive_enum.rs
@@ -1,7 +1,7 @@
-use proc_macro2::{Span, TokenStream};
+use proc_macro2::{TokenStream};
 
 use syn;
-use syn::{Data, DeriveInput, Fields, Ident, Variant};
+use syn::{Data, DeriveInput, Fields, Variant};
 
 use util::*;
 
@@ -119,7 +119,13 @@ impl EnumVariantAttrs {
     }
 }
 
-pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
+pub fn impl_enum(ast: &syn::DeriveInput, is_internal: bool) -> TokenStream {
+    let juniper_path = if is_internal {
+        quote!(crate)
+    } else {
+        quote!(juniper)
+    };
+
     let variants = match ast.data {
         Data::Enum(ref enum_data) => enum_data.variants.iter().collect::<Vec<_>>(),
         _ => {
@@ -166,17 +172,17 @@ pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
         };
         let depr = match var_attrs.deprecation {
             Some(DeprecationAttr { reason: Some(s) }) => quote!{
-                _juniper::meta::DeprecationStatus::Deprecated(Some(#s.to_string()))
+                #juniper_path::meta::DeprecationStatus::Deprecated(Some(#s.to_string()))
             },
             Some(DeprecationAttr { reason: None }) => quote!{
-                _juniper::meta::DeprecationStatus::Deprecated(None)
+                #juniper_path::meta::DeprecationStatus::Deprecated(None)
             },
             None => quote!{
-                _juniper::meta::DeprecationStatus::Current
+                #juniper_path::meta::DeprecationStatus::Current
             },
         };
         values.extend(quote!{
-            _juniper::meta::EnumValue{
+            #juniper_path::meta::EnumValue{
                 name: #name.to_string(),
                 description: #descr,
                 deprecation_status: #depr,
@@ -185,7 +191,7 @@ pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
 
         // Build resolve match clause.
         resolves.extend(quote!{
-            &#ident::#var_ident => _juniper::Value::scalar(String::from(#name)),
+            &#ident::#var_ident => #juniper_path::Value::scalar(String::from(#name)),
         });
 
         // Build from_input clause.
@@ -196,14 +202,14 @@ pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
         // Build to_input clause.
         to_inputs.extend(quote!{
             &#ident::#var_ident =>
-                _juniper::InputValue::scalar(#name.to_string()),
+                #juniper_path::InputValue::scalar(#name.to_string()),
         });
     }
 
     let body = quote! {
-        impl<__S> _juniper::GraphQLType<__S> for #ident
-        where __S: _juniper::ScalarValue,
-            for<'__b> &'__b __S: _juniper::ScalarRefValue<'__b>
+        impl<__S> #juniper_path::GraphQLType<__S> for #ident
+        where __S: #juniper_path::ScalarValue,
+            for<'__b> &'__b __S: #juniper_path::ScalarRefValue<'__b>
         {
             type Context = ();
             type TypeInfo = ();
@@ -212,8 +218,8 @@ pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
                 Some(#name)
             }
 
-            fn meta<'r>(_: &(), registry: &mut _juniper::Registry<'r, __S>)
-                        -> _juniper::meta::MetaType<'r, __S>
+            fn meta<'r>(_: &(), registry: &mut #juniper_path::Registry<'r, __S>)
+                        -> #juniper_path::meta::MetaType<'r, __S>
             where __S: 'r,
             {
                 let meta = registry.build_enum_type::<#ident>(&(), &[
@@ -226,18 +232,18 @@ pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
             fn resolve(
                 &self,
                 _: &(),
-                _: Option<&[_juniper::Selection<__S>]>,
-                _: &_juniper::Executor<Self::Context, __S>
-            ) -> _juniper::Value<__S> {
+                _: Option<&[#juniper_path::Selection<__S>]>,
+                _: &#juniper_path::Executor<Self::Context, __S>
+            ) -> #juniper_path::Value<__S> {
                 match self {
                     #(#resolves)*
                 }
             }
         }
 
-        impl<__S: _juniper::ScalarValue> _juniper::FromInputValue<__S> for #ident {
-            fn from_input_value(v: &_juniper::InputValue<__S>) -> Option<#ident>
-                where for<'__b> &'__b __S: _juniper::ScalarRefValue<'__b>
+        impl<__S: #juniper_path::ScalarValue> #juniper_path::FromInputValue<__S> for #ident {
+            fn from_input_value(v: &#juniper_path::InputValue<__S>) -> Option<#ident>
+                where for<'__b> &'__b __S: #juniper_path::ScalarRefValue<'__b>
             {
                 match v.as_enum_value().or_else(|| {
                     v.as_scalar_value::<String>().map(|s| s as &str)
@@ -248,30 +254,13 @@ pub fn impl_enum(ast: &syn::DeriveInput) -> TokenStream {
             }
         }
 
-        impl<__S: _juniper::ScalarValue> _juniper::ToInputValue<__S> for #ident {
-            fn to_input_value(&self) -> _juniper::InputValue<__S> {
+        impl<__S: #juniper_path::ScalarValue> #juniper_path::ToInputValue<__S> for #ident {
+            fn to_input_value(&self) -> #juniper_path::InputValue<__S> {
                 match self {
                     #(#to_inputs)*
                 }
             }
         }
     };
-
-    let dummy_const = Ident::new(
-        &format!("_IMPL_GRAPHQLENUM_FOR_{}", ident),
-        Span::call_site(),
-    );
-
-    let generated = quote! {
-        #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
-        #[doc(hidden)]
-        const #dummy_const : () = {
-            mod _juniper {
-                __juniper_use_everything!();
-            }
-            #body
-        };
-    };
-
-    generated
+    body
 }
diff --git a/juniper_codegen/src/derive_input_object.rs b/juniper_codegen/src/derive_input_object.rs
index 25a3c7137..342368e74 100644
--- a/juniper_codegen/src/derive_input_object.rs
+++ b/juniper_codegen/src/derive_input_object.rs
@@ -121,7 +121,13 @@ impl ObjFieldAttrs {
     }
 }
 
-pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
+pub fn impl_input_object(ast: &syn::DeriveInput, is_internal: bool) -> TokenStream {
+    let juniper_path = if is_internal {
+        quote!(crate)
+    } else {
+        quote!(juniper)
+    };
+
     let fields = match ast.data {
         Data::Struct(ref data) => match data.fields {
             Fields::Named(ref named) => named.named.iter().collect::<Vec<_>>(),
@@ -222,7 +228,7 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
         let from_input_default = match default {
             Some(ref def) => {
                 quote!{
-                    Some(&&_juniper::InputValue::Null) | None if true => #def,
+                    Some(&&#juniper_path::InputValue::Null) | None if true => #def,
                 }
             }
             None => quote!{},
@@ -233,9 +239,9 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
                 // TODO: investigate the unwraps here, they seem dangerous!
                 match obj.get(#name) {
                     #from_input_default
-                    Some(ref v) => _juniper::FromInputValue::from_input_value(v).unwrap(),
+                    Some(ref v) => #juniper_path::FromInputValue::from_input_value(v).unwrap(),
                     None => {
-                        _juniper::FromInputValue::from_input_value(&_juniper::InputValue::null())
+                        #juniper_path::FromInputValue::from_input_value(&#juniper_path::InputValue::null())
                             .unwrap()
                     },
                 }
@@ -260,10 +266,10 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
             let where_clause = generics.where_clause.get_or_insert(parse_quote!(where));
             where_clause
                 .predicates
-                .push(parse_quote!(__S: _juniper::ScalarValue));
+                .push(parse_quote!(__S: #juniper_path::ScalarValue));
             where_clause
                 .predicates
-                .push(parse_quote!(for<'__b> &'__b __S: _juniper::ScalarRefValue<'__b>));
+                .push(parse_quote!(for<'__b> &'__b __S: #juniper_path::ScalarRefValue<'__b>));
         }
         Ident::new("__S", Span::call_site())
     };
@@ -271,7 +277,7 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
     let (impl_generics, _, where_clause) = generics.split_for_impl();
 
     let body = quote! {
-        impl#impl_generics _juniper::GraphQLType<#scalar> for #ident #ty_generics
+        impl#impl_generics #juniper_path::GraphQLType<#scalar> for #ident #ty_generics
         #where_clause
         {
             type Context = ();
@@ -283,8 +289,8 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
 
             fn meta<'r>(
                 _: &(),
-                registry: &mut _juniper::Registry<'r, #scalar>
-            ) -> _juniper::meta::MetaType<'r, #scalar>
+                registry: &mut #juniper_path::Registry<'r, #scalar>
+            ) -> #juniper_path::meta::MetaType<'r, #scalar>
                 where #scalar: 'r
             {
                 let fields = &[
@@ -296,12 +302,12 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
             }
         }
 
-        impl#impl_generics _juniper::FromInputValue<#scalar> for #ident #ty_generics
+        impl#impl_generics #juniper_path::FromInputValue<#scalar> for #ident #ty_generics
         #where_clause
         {
-            fn from_input_value(value: &_juniper::InputValue<#scalar>) -> Option<Self>
+            fn from_input_value(value: &#juniper_path::InputValue<#scalar>) -> Option<Self>
             where
-                for<'__b> &'__b #scalar: _juniper::ScalarRefValue<'__b>
+                for<'__b> &'__b #scalar: #juniper_path::ScalarRefValue<'__b>
             {
                 if let Some(obj) = value.to_object_value() {
                     let item = #ident {
@@ -315,32 +321,16 @@ pub fn impl_input_object(ast: &syn::DeriveInput) -> TokenStream {
             }
         }
 
-        impl#impl_generics _juniper::ToInputValue<#scalar> for #ident #ty_generics
+        impl#impl_generics #juniper_path::ToInputValue<#scalar> for #ident #ty_generics
         #where_clause
         {
-            fn to_input_value(&self) -> _juniper::InputValue<#scalar> {
-                _juniper::InputValue::object(vec![
+            fn to_input_value(&self) -> #juniper_path::InputValue<#scalar> {
+                #juniper_path::InputValue::object(vec![
                     #(#to_inputs)*
                 ].into_iter().collect())
             }
         }
     };
 
-    let dummy_const = Ident::new(
-        &format!("_IMPL_GRAPHQLINPUTOBJECT_FOR_{}", ident),
-        Span::call_site(),
-    );
-
-    let generated = quote! {
-        #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
-        #[doc(hidden)]
-        const #dummy_const : () = {
-            mod _juniper {
-                __juniper_use_everything!();
-            }
-            #body
-        };
-    };
-
-    generated
+   body
 }
diff --git a/juniper_codegen/src/derive_object.rs b/juniper_codegen/src/derive_object.rs
index 8f01b66b0..1d83a9526 100644
--- a/juniper_codegen/src/derive_object.rs
+++ b/juniper_codegen/src/derive_object.rs
@@ -225,7 +225,7 @@ pub fn impl_object(ast: &syn::DeriveInput) -> TokenStream {
 
     let (impl_generics, _, where_clause) = generics.split_for_impl();
 
-    let toks = quote! {
+    let body = quote! {
         impl#impl_generics juniper::GraphQLType<#scalar> for #ident #ty_generics
             #where_clause
         {
@@ -271,23 +271,5 @@ pub fn impl_object(ast: &syn::DeriveInput) -> TokenStream {
             }
         }
     };
-
-    let dummy_const = Ident::new(
-        format!("_IMPL_JUNIPER_SCALAR_VALUE_FOR_{}", ident).as_str(),
-        Span::call_site(),
-    );
-
-    quote!{
-        #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
-        #[doc(hidden)]
-        const #dummy_const: () = {
-            mod juniper {
-                __juniper_use_everything!();
-            }
-
-            extern crate std;
-
-            #toks
-        };
-    }
+    body
 }
diff --git a/juniper_codegen/src/derive_juniper_scalar_value.rs b/juniper_codegen/src/derive_scalar_value.rs
similarity index 76%
rename from juniper_codegen/src/derive_juniper_scalar_value.rs
rename to juniper_codegen/src/derive_scalar_value.rs
index 7f6fb1c0b..75b06e4c0 100644
--- a/juniper_codegen/src/derive_juniper_scalar_value.rs
+++ b/juniper_codegen/src/derive_scalar_value.rs
@@ -1,8 +1,8 @@
-use proc_macro2::{Span, TokenStream};
+use proc_macro2::{TokenStream};
 
 use syn::{self, Data, Fields, Ident, Variant};
 
-pub fn impl_scalar_value(ast: &syn::DeriveInput) -> TokenStream {
+pub fn impl_scalar_value(ast: &syn::DeriveInput, is_internal: bool) -> TokenStream {
     let ident = &ast.ident;
 
     let variants = match ast.data {
@@ -18,29 +18,15 @@ pub fn impl_scalar_value(ast: &syn::DeriveInput) -> TokenStream {
         .collect::<Result<Vec<_>, String>>()
         .unwrap_or_else(|s| panic!("{}", s));
 
-    let serialize = derive_serialize(variants.iter(), ident);
+    let serialize = derive_serialize(variants.iter(), ident, is_internal);
 
     let display = derive_display(variants.iter(), ident);
-    let dummy_const = Ident::new(
-        format!("_IMPL_JUNIPER_SCALAR_VALUE_FOR_{}", ident).as_str(),
-        Span::call_site(),
-    );
 
     quote!{
-        #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
-        #[doc(hidden)]
-        const #dummy_const: () = {
-            mod juniper {
-                __juniper_use_everything!();
-            }
-
-            extern crate std;
-
-            #(#froms)*
+        #(#froms)*
 
-            #serialize
-            #display
-        };
+        #serialize
+        #display
     }
 }
 
@@ -64,7 +50,7 @@ where
     }
 }
 
-fn derive_serialize<'a, I>(variants: I, ident: &Ident) -> TokenStream
+fn derive_serialize<'a, I>(variants: I, ident: &Ident, is_internal: bool) -> TokenStream
 where
     I: Iterator<Item = &'a Variant>,
 {
@@ -73,10 +59,16 @@ where
         quote!(#ident::#variant(ref v) => v.serialize(serializer),)
     });
 
+    let serde_path = if is_internal {
+        quote!(crate::serde)
+    } else {
+        quote!(juniper::serde)
+    };
+
     quote!{
-        impl juniper::serde::Serialize for #ident {
+        impl #serde_path::Serialize for #ident {
             fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
-            where S: juniper::serde::Serializer
+            where S: #serde_path::Serializer
             {
                 match *self {
                     #(#arms)*
diff --git a/juniper_codegen/src/lib.rs b/juniper_codegen/src/lib.rs
index 03be1b608..9f7920598 100644
--- a/juniper_codegen/src/lib.rs
+++ b/juniper_codegen/src/lib.rs
@@ -19,7 +19,7 @@ extern crate regex;
 mod derive_enum;
 mod derive_input_object;
 mod derive_object;
-mod derive_juniper_scalar_value;
+mod derive_scalar_value;
 mod util;
 
 use proc_macro::TokenStream;
@@ -27,14 +27,30 @@ use proc_macro::TokenStream;
 #[proc_macro_derive(GraphQLEnum, attributes(graphql))]
 pub fn derive_enum(input: TokenStream) -> TokenStream {
     let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
-    let gen = derive_enum::impl_enum(&ast);
+    let gen = derive_enum::impl_enum(&ast, false);
+    gen.into()
+}
+
+#[proc_macro_derive(GraphQLEnumInternal, attributes(graphql))]
+#[doc(hidden)]
+pub fn derive_enum_internal(input: TokenStream) -> TokenStream {
+    let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
+    let gen = derive_enum::impl_enum(&ast, true);
     gen.into()
 }
 
 #[proc_macro_derive(GraphQLInputObject, attributes(graphql))]
 pub fn derive_input_object(input: TokenStream) -> TokenStream {
     let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
-    let gen = derive_input_object::impl_input_object(&ast);
+    let gen = derive_input_object::impl_input_object(&ast, false);
+    gen.into()
+}
+
+#[proc_macro_derive(GraphQLInputObjectInternal, attributes(graphql))]
+#[doc(hidden)]
+pub fn derive_input_object_internal(input: TokenStream) -> TokenStream {
+    let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
+    let gen = derive_input_object::impl_input_object(&ast, true);
     gen.into()
 }
 
@@ -46,8 +62,16 @@ pub fn derive_object(input: TokenStream) -> TokenStream {
 }
 
 #[proc_macro_derive(ScalarValue)]
-pub fn derive_juniper_scalar_value(input: TokenStream) -> TokenStream {
+pub fn derive_scalar_value(input: TokenStream) -> TokenStream {
+    let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
+    let gen = derive_scalar_value::impl_scalar_value(&ast, false);
+    gen.into()
+}
+
+#[proc_macro_derive(GraphQLScalarValueInternal)]
+#[doc(hidden)]
+pub fn derive_scalar_value_internal(input: TokenStream) -> TokenStream {
     let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
-    let gen = derive_juniper_scalar_value::impl_scalar_value(&ast);
+    let gen = derive_scalar_value::impl_scalar_value(&ast, true);
     gen.into()
 }


Test patch:
diff --git a/integration_tests/juniper_2018_edition_tests/Cargo.toml b/integration_tests/juniper_2018_edition_tests/Cargo.toml
new file mode 100644
index 000000000..e228ccc3d
--- /dev/null
+++ b/integration_tests/juniper_2018_edition_tests/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "juniper_2018_edition_tests"
+version = "0.1.0"
+authors = ["Christoph Herzog <chris@theduke.at>"]
+edition = "2018"
+
+[dependencies]
+juniper = { version = "0.11", path = "../../juniper" }
diff --git a/integration_tests/juniper_2018_edition_tests/Makefile.toml b/integration_tests/juniper_2018_edition_tests/Makefile.toml
new file mode 100644
index 000000000..2eb535653
--- /dev/null
+++ b/integration_tests/juniper_2018_edition_tests/Makefile.toml
@@ -0,0 +1,16 @@
+
+[tasks.build-verbose]
+condition = { rust_version = { min = "1.32.0" } }
+
+[tasks.build-verbose.windows]
+condition = { rust_version = { min = "1.32.0" } }
+
+[tasks.test-verbose]
+condition = { rust_version = { min = "1.32.0" } }
+
+[tasks.test-verbose.windows]
+condition = { rust_version = { min = "1.32.0" } }
+
+[tasks.ci-coverage-flow]
+disabled = true
+
diff --git a/integration_tests/juniper_2018_edition_tests/src/main.rs b/integration_tests/juniper_2018_edition_tests/src/main.rs
new file mode 100644
index 000000000..82b6b3da9
--- /dev/null
+++ b/integration_tests/juniper_2018_edition_tests/src/main.rs
@@ -0,0 +1,36 @@
+/// A VERY minimal test case that ensures that
+/// macros and custom derives work in 2018 edition crates.
+/// This can be removed once juniper is refactored to the 2018 edition.
+
+#[derive(juniper::GraphQLEnum, PartialEq, Eq, Clone, Copy, Debug)]
+enum TaskStatus {
+    Todo,
+    Done,
+    Closed,
+}
+
+#[derive(juniper::GraphQLObject, Clone, Debug)]
+struct Task {
+    pub id: i32,
+    pub status: TaskStatus,
+    pub title: String,
+    pub description: Option<String>,
+}
+
+#[derive(juniper::GraphQLInputObject, Clone, Debug)]
+struct TaskCreate {
+    pub title: String,
+    pub description: Option<String>,
+}
+
+struct Query;
+
+juniper::graphql_object!(Query: () |&self| {
+    field task(id: i32) -> Task {
+        unimplemented!()
+    }
+});
+
+
+fn main() {
+}
diff --git a/juniper_tests/Cargo.toml b/integration_tests/juniper_tests/Cargo.toml
similarity index 80%
rename from juniper_tests/Cargo.toml
rename to integration_tests/juniper_tests/Cargo.toml
index 5c0d2286d..fa300fe06 100644
--- a/juniper_tests/Cargo.toml
+++ b/integration_tests/juniper_tests/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
 publish = false
 
 [dependencies]
-juniper = { version = "0.11.0", path = "../juniper" }
+juniper = { version = "0.11.0", path = "../../juniper" }
 serde_json = { version = "1" }
 
 [dev-dependencies]
diff --git a/juniper_tests/Makefile.toml b/integration_tests/juniper_tests/Makefile.toml
similarity index 100%
rename from juniper_tests/Makefile.toml
rename to integration_tests/juniper_tests/Makefile.toml
diff --git a/juniper_tests/src/codegen/derive_enum.rs b/integration_tests/juniper_tests/src/codegen/derive_enum.rs
similarity index 100%
rename from juniper_tests/src/codegen/derive_enum.rs
rename to integration_tests/juniper_tests/src/codegen/derive_enum.rs
diff --git a/juniper_tests/src/codegen/derive_input_object.rs b/integration_tests/juniper_tests/src/codegen/derive_input_object.rs
similarity index 100%
rename from juniper_tests/src/codegen/derive_input_object.rs
rename to integration_tests/juniper_tests/src/codegen/derive_input_object.rs
diff --git a/juniper_tests/src/codegen/derive_object.rs b/integration_tests/juniper_tests/src/codegen/derive_object.rs
similarity index 100%
rename from juniper_tests/src/codegen/derive_object.rs
rename to integration_tests/juniper_tests/src/codegen/derive_object.rs
diff --git a/juniper_tests/src/codegen/mod.rs b/integration_tests/juniper_tests/src/codegen/mod.rs
similarity index 100%
rename from juniper_tests/src/codegen/mod.rs
rename to integration_tests/juniper_tests/src/codegen/mod.rs
diff --git a/juniper_tests/src/custom_scalar.rs b/integration_tests/juniper_tests/src/custom_scalar.rs
similarity index 100%
rename from juniper_tests/src/custom_scalar.rs
rename to integration_tests/juniper_tests/src/custom_scalar.rs
diff --git a/juniper_tests/src/lib.rs b/integration_tests/juniper_tests/src/lib.rs
similarity index 100%
rename from juniper_tests/src/lib.rs
rename to integration_tests/juniper_tests/src/lib.rs
diff --git a/juniper/src/executor_tests/enums.rs b/juniper/src/executor_tests/enums.rs
index 025af1af1..ec4a27995 100644
--- a/juniper/src/executor_tests/enums.rs
+++ b/juniper/src/executor_tests/enums.rs
@@ -7,7 +7,7 @@ use validation::RuleError;
 use value::{DefaultScalarValue, Object, Value};
 use GraphQLError::ValidationError;
 
-#[derive(GraphQLEnum, Debug)]
+#[derive(GraphQLEnumInternal, Debug)]
 enum Color {
     Red,
     Green,
diff --git a/juniper/src/executor_tests/introspection/enums.rs b/juniper/src/executor_tests/introspection/enums.rs
index 0862d1106..287494f6e 100644
--- a/juniper/src/executor_tests/introspection/enums.rs
+++ b/juniper/src/executor_tests/introspection/enums.rs
@@ -15,33 +15,33 @@ Syntax to validate:
 
 */
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 enum DefaultName {
     Foo,
     Bar,
 }
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 #[graphql(name = "ANamedEnum")]
 enum Named {
     Foo,
     Bar,
 }
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 enum NoTrailingComma {
     Foo,
     Bar,
 }
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 #[graphql(description = "A description of the enum itself")]
 enum EnumDescription {
     Foo,
     Bar,
 }
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 enum EnumValueDescription {
     #[graphql(description = "The FOO value")]
     Foo,
@@ -49,7 +49,7 @@ enum EnumValueDescription {
     Bar,
 }
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 enum EnumDeprecation {
     #[graphql(deprecated = "Please don't use FOO any more")]
     Foo,
diff --git a/juniper/src/executor_tests/introspection/input_object.rs b/juniper/src/executor_tests/introspection/input_object.rs
index aa711e621..9258f1ca2 100644
--- a/juniper/src/executor_tests/introspection/input_object.rs
+++ b/juniper/src/executor_tests/introspection/input_object.rs
@@ -6,47 +6,47 @@ use value::{DefaultScalarValue, Object, Value};
 
 struct Root;
 
-#[derive(GraphQLInputObject)]
+#[derive(GraphQLInputObjectInternal)]
 struct DefaultName {
     field_one: String,
     field_two: String,
 }
 
-#[derive(GraphQLInputObject)]
+#[derive(GraphQLInputObjectInternal)]
 struct NoTrailingComma {
     field_one: String,
     field_two: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 struct Derive {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(name = "ANamedInputObject")]
 struct Named {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(description = "Description for the input object")]
 struct Description {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 pub struct Public {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(description = "Description for the input object")]
 pub struct PublicWithDescription {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(
     name = "APublicNamedInputObjectWithDescription",
     description = "Description for the input object",
@@ -55,13 +55,13 @@ pub struct NamedPublicWithDescription {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(name = "APublicNamedInputObject")]
 pub struct NamedPublic {
     field_one: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 struct FieldDescription {
     #[graphql(description = "The first field")]
     field_one: String,
@@ -69,7 +69,7 @@ struct FieldDescription {
     field_two: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 struct FieldWithDefaults {
     #[graphql(default = "123")]
     field_one: i32,
diff --git a/juniper/src/executor_tests/introspection/mod.rs b/juniper/src/executor_tests/introspection/mod.rs
index c2a527eaf..d9c88b742 100644
--- a/juniper/src/executor_tests/introspection/mod.rs
+++ b/juniper/src/executor_tests/introspection/mod.rs
@@ -10,7 +10,7 @@ use schema::model::RootNode;
 use types::scalars::EmptyMutation;
 use value::{ParseScalarResult, ParseScalarValue, Value};
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 #[graphql(name = "SampleEnum")]
 enum Sample {
     One,
diff --git a/juniper/src/executor_tests/variables.rs b/juniper/src/executor_tests/variables.rs
index d450a8a01..7cccfc0b7 100644
--- a/juniper/src/executor_tests/variables.rs
+++ b/juniper/src/executor_tests/variables.rs
@@ -32,7 +32,7 @@ graphql_scalar!(TestComplexScalar {
     }
 });
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(scalar = "DefaultScalarValue")]
 struct TestInputObject {
     a: Option<String>,
@@ -41,20 +41,20 @@ struct TestInputObject {
     d: Option<TestComplexScalar>,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 #[graphql(scalar = "DefaultScalarValue")]
 struct TestNestedInputObject {
     na: TestInputObject,
     nb: String,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 struct ExampleInputObject {
     a: Option<String>,
     b: i32,
 }
 
-#[derive(GraphQLInputObject, Debug)]
+#[derive(GraphQLInputObjectInternal, Debug)]
 struct InputWithDefaults {
     #[graphql(default = "123")]
     a: i32,
diff --git a/juniper/src/macros/tests/args.rs b/juniper/src/macros/tests/args.rs
index fbe42aa86..9898abcd8 100644
--- a/juniper/src/macros/tests/args.rs
+++ b/juniper/src/macros/tests/args.rs
@@ -19,7 +19,7 @@ Syntax to validate:
 
 */
 
-#[derive(GraphQLInputObject)]
+#[derive(GraphQLInputObjectInternal)]
 struct Point {
     x: i32,
 }
diff --git a/juniper/src/parser/tests/value.rs b/juniper/src/parser/tests/value.rs
index 88411f576..e74cb475e 100644
--- a/juniper/src/parser/tests/value.rs
+++ b/juniper/src/parser/tests/value.rs
@@ -9,17 +9,17 @@ use schema::meta::{MetaType, ScalarMeta, EnumMeta, EnumValue, InputObjectMeta, A
 use schema::model::SchemaType;
 use types::scalars::EmptyMutation;
 
-#[derive(GraphQLEnum)]
+#[derive(GraphQLEnumInternal)]
 enum Enum {
     EnumValue
 }
 
-#[derive(GraphQLInputObject)]
+#[derive(GraphQLInputObjectInternal)]
 struct Bar {
     foo: String,
 }
 
-#[derive(GraphQLInputObject)]
+#[derive(GraphQLInputObjectInternal)]
 struct Foo {
     key: i32,
     other: Bar,
diff --git a/juniper/src/tests/model.rs b/juniper/src/tests/model.rs
index 3d900b0c7..27681a01b 100644
--- a/juniper/src/tests/model.rs
+++ b/juniper/src/tests/model.rs
@@ -2,7 +2,7 @@
 
 use std::collections::HashMap;
 
-#[derive(GraphQLEnum, Copy, Clone, Eq, PartialEq, Debug)]
+#[derive(GraphQLEnumInternal, Copy, Clone, Eq, PartialEq, Debug)]
 pub enum Episode {
     #[graphql(name = "NEW_HOPE")]
     NewHope,
diff --git a/juniper/src/validation/test_harness.rs b/juniper/src/validation/test_harness.rs
index 987d91bdf..73e86b83b 100644
--- a/juniper/src/validation/test_harness.rs
+++ b/juniper/src/validation/test_harness.rs
@@ -27,7 +27,7 @@ struct ComplicatedArgs;
 
 pub(crate) struct QueryRoot;
 
-#[derive(Debug, GraphQLInputObject)]
+#[derive(Debug, GraphQLInputObjectInternal)]
 struct TestInput {
     id: i32,
     name: String,