Skip to content

Commit c99c192

Browse files
committed
Work around crates.io feature name limits.
crates.io currently rejects features with a "." even though they are accepted by `cargo`/`rustc`. Change the `1.20.0` feature to `1_20_0`. rust-lang/crates.io#1395
1 parent 7c985e3 commit c99c192

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ matrix:
2525
- rust: nightly
2626

2727
before_script: |
28-
test "$TRAVIS_RUST_VERSION" != "stable" ||
28+
test "${TRAVIS_RUST_VERSION//./_}" != "stable" ||
2929
(test -x /home/travis/.cargo/bin/cargo-coveralls || cargo install cargo-travis) ||
3030
(test $(grep "cargo-travis" /home/travis/.cargo/.crates.toml | sed -r "s/\"cargo-travis ([^\ ]+).+/\1/") = $(cargo search cargo-travis --limit 1 | sed -r "s/cargo-travis \(([^\)]+)\).+/\1/") || cargoo install cargo-travis --force)
3131
3232
script: |
3333
cargo build --verbose --no-default-features --features "autoconvert usize u8 u16 u32 u64 isize i8 i16 i32 i64 bigint biguint rational rational32 rational64 bigrational f32 f64 si std use_serde" &&
34-
cargo test --verbose --no-run --no-default-features --features "autoconvert usize u8 u16 u32 u64 isize i8 i16 i32 i64 bigint biguint rational rational32 rational64 bigrational f32 f64 std use_serde $TRAVIS_RUST_VERSION" &&
35-
cargo test --verbose --features "use_serde $TRAVIS_RUST_VERSION" &&
36-
cargo test --manifest-path tests/feature_check/Cargo.toml --verbose --features "$TRAVIS_RUST_VERSION"
34+
cargo test --verbose --no-run --no-default-features --features "autoconvert usize u8 u16 u32 u64 isize i8 i16 i32 i64 bigint biguint rational rational32 rational64 bigrational f32 f64 std use_serde ${TRAVIS_RUST_VERSION//./_}" &&
35+
cargo test --verbose --features "use_serde ${TRAVIS_RUST_VERSION//./_}" &&
36+
cargo test --manifest-path tests/feature_check/Cargo.toml --verbose --features "${TRAVIS_RUST_VERSION//./_}"
3737
3838
after_success: |
39-
test "$TRAVIS_RUST_VERSION" != "stable" || cargo coveralls
39+
test "${TRAVIS_RUST_VERSION//./_}" != "stable" || cargo coveralls
4040
4141
notifications:
4242
email:

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ use_serde = ["serde"]
6565
# Internal features to support channel specific test logic. Note that a
6666
# channel's feature must be added to the `--features` list when compiling
6767
# manually as no channel detection is build into `cargo`/`rustc`.
68-
"1.20.0" = []
68+
1_20_0 = []
6969
stable = []
7070
beta = []
7171
nightly = []

src/system.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ macro_rules! system {
192192
///
193193
/// Using units for the wrong quantity will cause a compile error:
194194
///
195-
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1.20.0")), doc = " ```rust,compile_fail")]
196-
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1.20.0"))), doc = " ```rust,ignore")]
195+
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
196+
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
197197
/// # use uom::si::f32::*;
198198
/// # use uom::si::time::second;
199199
/// // error[E0277]: the trait bound `second: length::Unit` is not satisfied
@@ -202,17 +202,17 @@ macro_rules! system {
202202
///
203203
/// Mixing quantities will also cause a compile error:
204204
///
205-
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1.20.0")), doc = " ```rust,compile_fail")]
206-
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1.20.0"))), doc = " ```rust,ignore")]
205+
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
206+
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
207207
/// # use uom::si::f32::*;
208208
/// # use uom::si::length::meter;
209209
/// # use uom::si::time::second;
210210
/// // error[E0308]: mismatched types
211211
/// let r = Length::new::<meter>(1.0) + Time::new::<second>(1.0);
212212
/// ```
213213
///
214-
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1.20.0")), doc = " ```rust,compile_fail")]
215-
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1.20.0"))), doc = " ```rust,ignore")]
214+
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
215+
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
216216
/// # use uom::si::f32::*;
217217
/// # use uom::si::length::meter;
218218
/// # use uom::si::time::second;
@@ -576,8 +576,8 @@ macro_rules! system {
576576
///
577577
/// The input type must have dimensions divisible by three:
578578
///
579-
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1.20.0")), doc = " ```rust,compile_fail")]
580-
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1.20.0"))), doc = " ```rust,ignore")]
579+
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
580+
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
581581
/// # use uom::si::f32::*;
582582
/// # use uom::si::area::square_meter;
583583
/// // error[E0271]: type mismatch resolving ...
@@ -737,8 +737,8 @@ macro_rules! system {
737737
///
738738
/// The input type must have dimensions divisible by two:
739739
///
740-
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1.20.0")), doc = " ```rust,compile_fail")]
741-
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1.20.0"))), doc = " ```rust,ignore")]
740+
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
741+
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
742742
/// # use uom::si::f32::*;
743743
/// # use uom::si::length::meter;
744744
/// // error[E0271]: type mismatch resolving ...

tests/feature_check/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ default = []
1010
# Internal features to support channel specific test logic. Note that a
1111
# channel's feature must be added to the `--features` list when compiling
1212
# manually as no channel detection is build into `cargo`/`rustc`.
13-
"1.20.0" = []
13+
1_20_0 = []
1414
stable = []
1515
beta = []
1616
nightly = []

tests/feature_check/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
//!
2222
//! Validate that `storage_types!` does not generate code for the `i32` type.
2323
//!
24-
#![cfg_attr(not(feature = "1.20.0"), doc = " ```rust,compile_fail")]
25-
#![cfg_attr(feature = "1.20.0", doc = " ```rust,ignore")]
24+
#![cfg_attr(not(feature = "1_20_0"), doc = " ```rust,compile_fail")]
25+
#![cfg_attr(feature = "1_20_0", doc = " ```rust,ignore")]
2626
//! #[macro_use]
2727
//! extern crate uom;
2828
//!

0 commit comments

Comments
 (0)