Skip to content

Commit

Permalink
Remove warnings due to new lint on unknown cfgs
Browse files Browse the repository at this point in the history
  • Loading branch information
tea committed Jun 30, 2024
1 parent a29dd3d commit e8c2f67
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ redox_syscall = "0.5"
[target.'cfg(windows)'.dependencies]
windows-targets = "0.52.0"

[build-dependencies]
autocfg = "1.1.0"

[features]
nightly = []
deadlock_detection = ["petgraph", "thread-id", "backtrace"]
5 changes: 5 additions & 0 deletions core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// doesn't support sanitizers) and nightly (which does). Works because build
// scripts gets `cfg` info, even if the cfg is unstable.
fn main() {
let cfg = autocfg::new();

println!("cargo:rerun-if-changed=build.rs");
if cfg.probe_rustc_version(1, 79) {
println!("cargo:rustc-check-cfg=cfg(tsan_enabled)");
}
let santizer_list = std::env::var("CARGO_CFG_SANITIZE").unwrap_or_default();
if santizer_list.contains("thread") {
println!("cargo:rustc-cfg=tsan_enabled");
Expand Down
2 changes: 1 addition & 1 deletion core/src/thread_parker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ cfg_if! {
}
}

pub use self::imp::{thread_yield, ThreadParker, UnparkHandle};
pub use self::imp::{thread_yield, ThreadParker};
4 changes: 4 additions & 0 deletions lock_api/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
fn main() {
let cfg = autocfg::new();

println!("cargo:rerun-if-changed=build.rs");
if cfg.probe_rustc_version(1, 79) {
println!("cargo:rustc-check-cfg=cfg(has_const_fn_trait_bound)");
}
if cfg.probe_rustc_version(1, 61) {
println!("cargo:rustc-cfg=has_const_fn_trait_bound");
}
Expand Down
1 change: 1 addition & 0 deletions lock_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ extern crate alloc;
pub struct GuardSend(());

/// Marker type which indicates that the Guard type for a lock is not `Send`.
#[allow(dead_code)]
pub struct GuardNoSend(*mut ());

unsafe impl Sync for GuardNoSend {}
Expand Down

0 comments on commit e8c2f67

Please sign in to comment.