@@ -693,17 +693,19 @@ macro_rules! assert_field_args {
693
693
$field_name: expr $( , ) ?
694
694
) => {
695
695
const _: ( ) = {
696
- const BASE_NAME : & str = <$base_ty as $crate:: macros:: reflect:: BaseType <$scalar>>:: NAME ;
697
- const IMPL_NAME : & str = <$impl_ty as $crate:: macros:: reflect:: BaseType <$scalar>>:: NAME ;
698
- const ERR_PREFIX : & str = $crate:: const_concat!(
696
+ const BASE_NAME : & :: core:: primitive:: str =
697
+ <$base_ty as $crate:: macros:: reflect:: BaseType <$scalar>>:: NAME ;
698
+ const IMPL_NAME : & :: core:: primitive:: str =
699
+ <$impl_ty as $crate:: macros:: reflect:: BaseType <$scalar>>:: NAME ;
700
+ const ERR_PREFIX : & :: core:: primitive:: str = $crate:: const_concat!(
699
701
"Failed to implement interface `" ,
700
702
BASE_NAME ,
701
703
"` on `" ,
702
704
IMPL_NAME ,
703
705
"`: " ,
704
706
) ;
705
707
706
- const FIELD_NAME : & str = $field_name;
708
+ const FIELD_NAME : & :: core :: primitive :: str = $field_name;
707
709
708
710
const BASE_ARGS : :: juniper:: macros:: reflect:: Arguments =
709
711
<$base_ty as $crate:: macros:: reflect:: FieldMeta <
@@ -728,20 +730,20 @@ macro_rules! assert_field_args {
728
730
TypeMismatch ,
729
731
}
730
732
731
- const fn unwrap_error( v: :: std :: result:: Result <( ) , Error >) -> Error {
733
+ const fn unwrap_error( v: :: core :: result:: Result <( ) , Error >) -> Error {
732
734
match v {
733
735
// Unfortunately we can't use `unreachable!()` here, as this
734
736
// branch will be executed either way.
735
- Ok ( ( ) ) => Error {
737
+ :: core :: result :: Result :: Ok ( ( ) ) => Error {
736
738
cause: Cause :: RequiredField ,
737
739
base: ( "unreachable" , "unreachable" , 1 ) ,
738
740
implementation: ( "unreachable" , "unreachable" , 1 ) ,
739
741
} ,
740
- Err ( err) => err,
742
+ :: core :: result :: Result :: Err ( err) => err,
741
743
}
742
744
}
743
745
744
- const fn check( ) -> Result <( ) , Error > {
746
+ const fn check( ) -> :: core :: result :: Result <( ) , Error > {
745
747
let mut base_i = 0 ;
746
748
while base_i < BASE_ARGS . len( ) {
747
749
let ( base_name, base_type, base_wrap_val) = BASE_ARGS [ base_i] ;
@@ -800,18 +802,18 @@ macro_rules! assert_field_args {
800
802
base_i += 1 ;
801
803
}
802
804
if !was_found {
803
- return Err ( Error {
805
+ return :: core :: result :: Result :: Err ( Error {
804
806
cause: Cause :: AdditionalNonNullableField ,
805
807
base: ( impl_name, impl_type, impl_wrapped_val) ,
806
808
implementation: ( impl_name, impl_type, impl_wrapped_val) ,
807
809
} ) ;
808
810
}
809
811
}
810
812
811
- Ok ( ( ) )
813
+ :: core :: result :: Result :: Ok ( ( ) )
812
814
}
813
815
814
- const RES : :: std :: result:: Result <( ) , Error > = check( ) ;
816
+ const RES : :: core :: result:: Result <( ) , Error > = check( ) ;
815
817
if RES . is_err( ) {
816
818
const ERROR : Error = unwrap_error( RES ) ;
817
819
@@ -822,7 +824,7 @@ macro_rules! assert_field_args {
822
824
const IMPL_TYPE_FORMATTED : & str =
823
825
$crate:: format_type!( ERROR . implementation. 1 , ERROR . implementation. 2 ) ;
824
826
825
- const MSG : & str = match ERROR . cause {
827
+ const MSG : & :: core :: primitive :: str = match ERROR . cause {
826
828
Cause :: TypeMismatch => {
827
829
$crate:: const_concat!(
828
830
"Argument `" ,
@@ -865,9 +867,9 @@ macro_rules! assert_field_args {
865
867
#[ macro_export]
866
868
macro_rules! const_concat {
867
869
( $( $s: expr) ,* $( , ) ?) => { {
868
- const LEN : usize = 0 $( + $s. as_bytes( ) . len( ) ) * ;
869
- const CNT : usize = [ $( $s) ,* ] . len( ) ;
870
- const fn concat( input: [ & str ; CNT ] ) -> [ u8 ; LEN ] {
870
+ const LEN : :: core :: primitive :: usize = 0 $( + $s. as_bytes( ) . len( ) ) * ;
871
+ const CNT : :: core :: primitive :: usize = [ $( $s) ,* ] . len( ) ;
872
+ const fn concat( input: [ & :: core :: primitive :: str ; CNT ] ) -> [ :: core :: primitive :: u8 ; LEN ] {
871
873
let mut bytes = [ 0 ; LEN ] ;
872
874
let ( mut i, mut byte) = ( 0 , 0 ) ;
873
875
while i < CNT {
@@ -881,12 +883,12 @@ macro_rules! const_concat {
881
883
}
882
884
bytes
883
885
}
884
- const CON : [ u8 ; LEN ] = concat( [ $( $s) ,* ] ) ;
886
+ const CON : [ :: core :: primitive :: u8 ; LEN ] = concat( [ $( $s) ,* ] ) ;
885
887
886
888
// TODO: Use `.unwrap()` once it becomes `const`.
887
- match :: std :: str :: from_utf8( & CON ) {
888
- :: std :: result:: Result :: Ok ( s) => s,
889
- _ => unreachable!( ) ,
889
+ match :: core :: str :: from_utf8( & CON ) {
890
+ :: core :: result:: Result :: Ok ( s) => s,
891
+ _ => :: core :: unreachable!( ) ,
890
892
}
891
893
} } ;
892
894
}
@@ -936,13 +938,13 @@ macro_rules! format_type {
936
938
) = ( $ty, $wrapped_value) ;
937
939
const RES_LEN : usize = $crate:: macros:: reflect:: type_len_with_wrapped_val( TYPE . 0 , TYPE . 1 ) ;
938
940
939
- const OPENING_BRACKET : & str = "[" ;
940
- const CLOSING_BRACKET : & str = "]" ;
941
- const BANG : & str = "!" ;
941
+ const OPENING_BRACKET : & :: core :: primitive :: str = "[" ;
942
+ const CLOSING_BRACKET : & :: core :: primitive :: str = "]" ;
943
+ const BANG : & :: core :: primitive :: str = "!" ;
942
944
943
- const fn format_type_arr( ) -> [ u8 ; RES_LEN ] {
945
+ const fn format_type_arr( ) -> [ :: core :: primitive :: u8 ; RES_LEN ] {
944
946
let ( ty, wrap_val) = TYPE ;
945
- let mut type_arr: [ u8 ; RES_LEN ] = [ 0 ; RES_LEN ] ;
947
+ let mut type_arr: [ :: core :: primitive :: u8 ; RES_LEN ] = [ 0 ; RES_LEN ] ;
946
948
947
949
let mut current_start = 0 ;
948
950
let mut current_end = RES_LEN - 1 ;
@@ -1003,13 +1005,14 @@ macro_rules! format_type {
1003
1005
type_arr
1004
1006
}
1005
1007
1006
- const TYPE_ARR : [ u8 ; RES_LEN ] = format_type_arr( ) ;
1008
+ const TYPE_ARR : [ :: core :: primitive :: u8 ; RES_LEN ] = format_type_arr( ) ;
1007
1009
1008
1010
// TODO: Use `.unwrap()` once it becomes `const`.
1009
- const TYPE_FORMATTED : & str = match :: std:: str :: from_utf8( TYPE_ARR . as_slice( ) ) {
1010
- :: std:: result:: Result :: Ok ( s) => s,
1011
- _ => unreachable!( ) ,
1012
- } ;
1011
+ const TYPE_FORMATTED : & :: core:: primitive:: str =
1012
+ match :: core:: str :: from_utf8( TYPE_ARR . as_slice( ) ) {
1013
+ :: core:: result:: Result :: Ok ( s) => s,
1014
+ _ => unreachable!( ) ,
1015
+ } ;
1013
1016
1014
1017
TYPE_FORMATTED
1015
1018
} } ;
0 commit comments