File tree Expand file tree Collapse file tree 6 files changed +57
-11
lines changed Expand file tree Collapse file tree 6 files changed +57
-11
lines changed Original file line number Diff line number Diff line change 8
8
matrix :
9
9
- # no features
10
10
- FEATURES="full-syntax"
11
+
12
+ matrix :
13
+ include :
14
+ # try a no-std target
15
+ - rust : stable
16
+ env : TARGET=thumbv6m-none-eabi
17
+ before_script :
18
+ - rustup target add "$TARGET"
19
+ script :
20
+ # This test crate is intentionally separate, because we need
21
+ # independent features for no-std. (rust-lang/cargo#2589)
22
+ - cd check && cargo check --target "$TARGET"
23
+
11
24
sudo : false
12
25
script :
13
26
- cargo build --verbose --features="$FEATURES"
Original file line number Diff line number Diff line change @@ -8,18 +8,18 @@ categories = [ "science" ]
8
8
license = " MIT/Apache-2.0"
9
9
name = " num-derive"
10
10
repository = " https://github.com/rust-num/num-derive"
11
- version = " 0.2.3 "
11
+ version = " 0.2.4 "
12
12
readme = " README.md"
13
13
build = " build.rs"
14
14
15
15
[dependencies ]
16
- num-traits = " 0.2"
17
16
proc-macro2 = " 0.4.2"
18
17
quote = " 0.6"
19
18
syn = " 0.15"
20
19
21
20
[dev-dependencies ]
22
21
num = " 0.2"
22
+ num-traits = " 0.2"
23
23
24
24
[features ]
25
25
full-syntax = [" syn/full" ]
Original file line number Diff line number Diff line change
1
+ # Release 0.2.4 (2019-01-25)
2
+
3
+ - [ Adjusted dependencies to allow no-std targets] [ 22 ] .
4
+
5
+ [ 22 ] : https://github.com/rust-num/num-derive/pull/22
6
+
1
7
# Release 0.2.3 (2018-10-03)
2
8
3
9
- [ Added newtype deriving] [ 17 ] for ` FromPrimitive ` , ` ToPrimitive ` ,
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " check"
3
+ version = " 0.1.0"
4
+ authors = [" Josh Stone <cuviper@gmail.com>" ]
5
+ edition = " 2018"
6
+
7
+ [dependencies .num-derive ]
8
+ path = " .."
9
+
10
+ [dependencies .num-traits ]
11
+ version = " 0.2"
12
+ default-features = false
Original file line number Diff line number Diff line change
1
+ #![ no_std]
2
+
3
+ #[ derive( num_derive:: FromPrimitive ) ]
4
+ pub enum ABC {
5
+ A ,
6
+ B ,
7
+ C ,
8
+ }
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
178
178
}
179
179
}
180
180
} else {
181
- quote ! { }
181
+ quote ! { }
182
182
} ;
183
183
184
184
quote ! {
@@ -251,7 +251,8 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
251
251
Some ( #name:: #ident)
252
252
}
253
253
}
254
- } ) . collect ( ) ;
254
+ } )
255
+ . collect ( ) ;
255
256
256
257
let from_i64_var = if clauses. is_empty ( ) {
257
258
quote ! ( _)
@@ -345,7 +346,7 @@ pub fn to_primitive(input: TokenStream) -> TokenStream {
345
346
}
346
347
}
347
348
} else {
348
- quote ! { }
349
+ quote ! { }
349
350
} ;
350
351
351
352
quote ! {
@@ -500,7 +501,8 @@ pub fn num_ops(input: TokenStream) -> TokenStream {
500
501
}
501
502
}
502
503
} ,
503
- ) . into ( )
504
+ )
505
+ . into ( )
504
506
}
505
507
506
508
/// Derives [`num_traits::NumCast`][num_cast] for newtypes. The inner type must already implement
@@ -523,7 +525,8 @@ pub fn num_cast(input: TokenStream) -> TokenStream {
523
525
}
524
526
}
525
527
} ,
526
- ) . into ( )
528
+ )
529
+ . into ( )
527
530
}
528
531
529
532
/// Derives [`num_traits::Zero`][zero] for newtypes. The inner type must already implement `Zero`.
@@ -548,7 +551,8 @@ pub fn zero(input: TokenStream) -> TokenStream {
548
551
}
549
552
}
550
553
} ,
551
- ) . into ( )
554
+ )
555
+ . into ( )
552
556
}
553
557
554
558
/// Derives [`num_traits::One`][one] for newtypes. The inner type must already implement `One`.
@@ -573,7 +577,8 @@ pub fn one(input: TokenStream) -> TokenStream {
573
577
}
574
578
}
575
579
} ,
576
- ) . into ( )
580
+ )
581
+ . into ( )
577
582
}
578
583
579
584
/// Derives [`num_traits::Num`][num] for newtypes. The inner type must already implement `Num`.
@@ -596,7 +601,8 @@ pub fn num(input: TokenStream) -> TokenStream {
596
601
}
597
602
}
598
603
} ,
599
- ) . into ( )
604
+ )
605
+ . into ( )
600
606
}
601
607
602
608
/// Derives [`num_traits::Float`][float] for newtypes. The inner type must already implement
@@ -788,5 +794,6 @@ pub fn float(input: TokenStream) -> TokenStream {
788
794
}
789
795
}
790
796
} ,
791
- ) . into ( )
797
+ )
798
+ . into ( )
792
799
}
You can’t perform that action at this time.
0 commit comments