Skip to content

Commit

Permalink
Merge #35
Browse files Browse the repository at this point in the history
35: Add `num_traits` proc_macro helper for explicit import r=cuviper a=jean-airoldie

This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macros can directly depend in it.

This is usefull when reexporting `num-derive` and using `num-trait` as
a transitive import.

Fixes #34.

CC. @vglavnyy

Co-authored-by: jean-airoldie <25088801+jean-airoldie@users.noreply.github.com>
Co-authored-by: Josh Stone <cuviper@gmail.com>
  • Loading branch information
3 people committed Jun 27, 2020
2 parents bafa54c + 90c8ad8 commit ed849ab
Show file tree
Hide file tree
Showing 8 changed files with 414 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
command: build
# This test crate is intentionally separate, because we need
# independent features for no-std. (rust-lang/cargo#2589)
args: --target thumbv6m-none-eabi --manifest-path check/Cargo.toml
args: --target thumbv6m-none-eabi --manifest-path ci/check/Cargo.toml

fmt:
name: Format
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ quote = "1"
syn = "1"

[dev-dependencies]
num = "0.2"
num = "0.3"
num-traits = "0.2"

[features]
Expand Down
2 changes: 1 addition & 1 deletion check/Cargo.toml → ci/check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Josh Stone <cuviper@gmail.com>"]
edition = "2018"

[dependencies.num-derive]
path = ".."
path = "../.."

[dependencies.num-traits]
version = "0.2"
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions ci/import/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "import"
version = "0.0.1"
authors = ["jean-airoldie <25088801+jean-airoldie@users.noreply.github.com>"]
edition = "2018"
publish = false

[dependencies]
num-derive = { path = "../.." }
num = { version = "0.3", default-features = false }
19 changes: 19 additions & 0 deletions ci/import/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#[macro_use]
extern crate num_derive;

#[derive(
Debug,
Clone,
Copy,
PartialEq,
PartialOrd,
ToPrimitive,
FromPrimitive,
)]
#[num_traits = "num"]
#[repr(u8)]
enum Rgb {
Red = 0,
Green = 1,
Black = 2,
}
4 changes: 4 additions & 0 deletions ci/test_full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ done
# test all supported features
cargo build --features="${FEATURES[*]}"
cargo test --features="${FEATURES[*]}"

# these CI crates keep tighter control over dependencies
cargo check --verbose --manifest-path ci/check/Cargo.toml
cargo check --verbose --manifest-path ci/import/Cargo.toml
Loading

0 comments on commit ed849ab

Please sign in to comment.