diff --git a/Cargo.toml b/Cargo.toml index 146349b..672b4c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,4 +22,3 @@ features = ["std"] default = ["std"] std = [] i128 = [] -associated_consts = [] diff --git a/README.md b/README.md index d0cbeca..99d85d1 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,8 @@ Implementations for `i128` and `u128` are only available with Rust 1.26 and later. The build script automatically detects this, but you can make it mandatory by enabling the `i128` crate feature. -Similarly, additional traits making use of associated constants are available -with Rust 1.22 and later. Again, the build script automatically detects this, -but you can make it mandatory by enabling the `associated_consts` crate feature. +Traits making use of associated constants are available with Rust 1.22 and +later. This is automatically detected by the build script. ## Releases diff --git a/build.rs b/build.rs index 3d399d1..ce0d88b 100644 --- a/build.rs +++ b/build.rs @@ -9,14 +9,16 @@ fn main() { panic!("i128 support was not detected!"); } + // Verbose probe to ensure we can blanket impl associated const traits. + // Early versions of associated consts prohibited this due to a restriction + // of const expressions to non-Drop types. if probe("fn main() { - struct TestDrop(); impl Drop for TestDrop { fn drop(&mut self) {} } - trait TestConst { const TEST: Self; } - impl TestConst for TestDrop { const TEST: TestDrop = TestDrop(); } + trait Const { const CONST: Self; } + impl Const for Option { + const CONST: Option = Some(T::CONST); + } }") { println!("cargo:rustc-cfg=has_associated_consts"); - } else if env::var_os("CARGO_FEATURE_ASSOCIATED_CONSTS").is_some() { - panic!("associated constant support was not detected!"); } }