Skip to content

Commit

Permalink
Fix workspace tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Oct 26, 2022
1 parent ab9d379 commit fd90267
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ include = [
"tests/**/*.rs", # debian packaging wants this
]

[workspace]
members = ["impl"]

[dependencies]
derive_more-impl = { version = "=0.99.17", path = "impl" }

[build-dependencies]
rustc_version = { version = "0.4", optional = true }

[workspace]
members = ["impl"]

[dev-dependencies]
rustversion = "1.0"
trybuild = "1.0.56"
Expand Down Expand Up @@ -64,7 +63,6 @@ mul = ["derive_more-impl/mul"]
not = ["derive_more-impl/not"]
sum = ["derive_more-impl/sum"]
try_into = ["derive_more-impl/try_into"]
testing-helpers = ["rustc_version"]
is_variant = ["derive_more-impl/is_variant"]
unwrap = ["derive_more-impl/unwrap"]

Expand Down Expand Up @@ -94,6 +92,8 @@ default = [
"unwrap"
]

testing-helpers = ["derive_more-impl/testing-helpers", "rustc_version"]

[[test]]
name = "add_assign"
path = "tests/add_assign.rs"
Expand Down
12 changes: 6 additions & 6 deletions impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "derive_more-impl"
version = "0.99.17"
version = "0.99.17" # should be the same as main crate version
edition = "2021"
rust-version = "1.56.0"
description = "Adds #[derive(x)] macros for more traits"
description = "Internal implementation of `derive_more` crate"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT"
repository = "https://github.com/JelteF/derive_more"
Expand Down Expand Up @@ -32,8 +32,7 @@ unicode-xid = { version = "0.2.2", optional = true }
rustc_version = { version = "0.4", optional = true }

[dev-dependencies]
rustversion = "1.0"
trybuild = "1.0.56"
derive_more = { path = ".." }

[badges]
github = { repository = "JelteF/derive_more", workflow = "CI" }
Expand Down Expand Up @@ -63,8 +62,9 @@ mul = ["syn/extra-traits"]
not = ["syn/extra-traits"]
sum = []
try_into = ["syn/extra-traits"]
testing-helpers = ["rustc_version"]
is_variant = ["convert_case"]
unwrap = ["convert_case", "rustc_version"]
unwrap = ["convert_case"]

default = []

testing-helpers = ["rustc_version"]
15 changes: 15 additions & 0 deletions impl/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#[cfg(not(feature = "testing-helpers"))]
fn detect_nightly() {}

#[cfg(feature = "testing-helpers")]
fn detect_nightly() {
use rustc_version::{version_meta, Channel};

if version_meta().unwrap().channel == Channel::Nightly {
println!("cargo:rustc-cfg=nightly");
}
}

fn main() {
detect_nightly();
}
6 changes: 3 additions & 3 deletions impl/doc/error.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ ignored for one of these methods by using `#[error(not(backtrace))]` or
## Example usage

```rust
# #![cfg_attr(feature = "nightly", feature(error_generic_member_access, provide_any))]
# #![cfg_attr(nightly, feature(error_generic_member_access, provide_any))]
// Nightly requires enabling this features:
// #![feature(error_generic_member_access, provide_any)]
# #[cfg(not(feature = "nightly"))] fn main() {}
# #[cfg(feature = "nightly")] fn main() {
# #[cfg(not(nightly))] fn main() {}
# #[cfg(nightly)] fn main() {
# use std::{any, error::Error as _, backtrace::Backtrace};
#
# use derive_more::{Display, Error, From};
Expand Down

0 comments on commit fd90267

Please sign in to comment.