File tree Expand file tree Collapse file tree 4 files changed +45
-5
lines changed Expand file tree Collapse file tree 4 files changed +45
-5
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,20 @@ fn main() {
7
7
8
8
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
9
9
10
- if !enable_use_proc_macro ( & target) {
11
- return ;
12
- }
13
- println ! ( "cargo:rustc-cfg=use_proc_macro" ) ;
14
-
15
10
let minor = match rustc_minor_version ( ) {
16
11
Some ( n) => n,
17
12
None => return ,
18
13
} ;
19
14
15
+ if minor >= 26 {
16
+ println ! ( "cargo:rustc-cfg=u128" ) ;
17
+ }
18
+
19
+ if !enable_use_proc_macro ( & target) {
20
+ return ;
21
+ }
22
+ println ! ( "cargo:rustc-cfg=use_proc_macro" ) ;
23
+
20
24
// Rust 1.29 stabilized the necessary APIs in the `proc_macro` crate
21
25
if minor >= 29 || cfg ! ( feature = "nightly" ) {
22
26
println ! ( "cargo:rustc-cfg=wrap_proc_macro" ) ;
Original file line number Diff line number Diff line change @@ -973,6 +973,12 @@ impl Literal {
973
973
isize_suffixed => isize ,
974
974
}
975
975
976
+ #[ cfg( u128 ) ]
977
+ suffixed_int_literals ! {
978
+ u128_suffixed => u128 ,
979
+ i128_suffixed => i128 ,
980
+ }
981
+
976
982
unsuffixed_int_literals ! {
977
983
u8_unsuffixed => u8 ,
978
984
u16_unsuffixed => u16 ,
@@ -986,6 +992,12 @@ impl Literal {
986
992
isize_unsuffixed => isize ,
987
993
}
988
994
995
+ #[ cfg( u128 ) ]
996
+ unsuffixed_int_literals ! {
997
+ u128_unsuffixed => u128 ,
998
+ i128_unsuffixed => i128 ,
999
+ }
1000
+
989
1001
pub fn f64_unsuffixed ( f : f64 ) -> Literal {
990
1002
assert ! ( f. is_finite( ) ) ;
991
1003
Literal :: _new ( imp:: Literal :: f64_unsuffixed ( f) )
Original file line number Diff line number Diff line change @@ -678,6 +678,12 @@ impl Literal {
678
678
f64_suffixed => f64 ,
679
679
}
680
680
681
+ #[ cfg( u128 ) ]
682
+ suffixed_numbers ! {
683
+ u128_suffixed => u128 ,
684
+ i128_suffixed => i128 ,
685
+ }
686
+
681
687
unsuffixed_numbers ! {
682
688
u8_unsuffixed => u8 ,
683
689
u16_unsuffixed => u16 ,
@@ -691,6 +697,12 @@ impl Literal {
691
697
isize_unsuffixed => isize ,
692
698
}
693
699
700
+ #[ cfg( u128 ) ]
701
+ unsuffixed_numbers ! {
702
+ u128_unsuffixed => u128 ,
703
+ i128_unsuffixed => i128 ,
704
+ }
705
+
694
706
pub fn f32_unsuffixed ( f : f32 ) -> Literal {
695
707
let mut s = f. to_string ( ) ;
696
708
if !s. contains ( "." ) {
Original file line number Diff line number Diff line change @@ -819,6 +819,12 @@ impl Literal {
819
819
f64_suffixed => f64 ,
820
820
}
821
821
822
+ #[ cfg( u128 ) ]
823
+ suffixed_numbers ! {
824
+ i128_suffixed => i128 ,
825
+ u128_suffixed => u128 ,
826
+ }
827
+
822
828
unsuffixed_integers ! {
823
829
u8_unsuffixed => u8 ,
824
830
u16_unsuffixed => u16 ,
@@ -832,6 +838,12 @@ impl Literal {
832
838
isize_unsuffixed => isize ,
833
839
}
834
840
841
+ #[ cfg( u128 ) ]
842
+ unsuffixed_integers ! {
843
+ i128_unsuffixed => i128 ,
844
+ u128_unsuffixed => u128 ,
845
+ }
846
+
835
847
pub fn f32_unsuffixed ( f : f32 ) -> Literal {
836
848
if nightly_works ( ) {
837
849
Literal :: Nightly ( proc_macro:: Literal :: f32_unsuffixed ( f) )
You can’t perform that action at this time.
0 commit comments