Skip to content

Commit

Permalink
welp, no safety for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Jul 23, 2024
1 parent c6b0aff commit 98c503b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
26 changes: 1 addition & 25 deletions rubicon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,31 +683,7 @@ macro_rules! compatibility_check {
panic!("{}", error_message);
}

#[cfg(windows)]
#[ctor]
fn check_compatibility() {
// on Windows we cannot allocate at all from a DLL initializer,

let imported: &[(&str, &str)] = &[
("rustc-version", $crate::RUBICON_RUSTC_VERSION),
("target-triple", $crate::RUBICON_TARGET_TRIPLE),
$($feature)*
];
let exported = unsafe { COMPATIBILITY_INFO };

for item in imported.iter() {
if !exported.contains(item) {
eprintln!("Compatibility mismatch detected: {} (imported) != {} (exported)", item.0, item.1);
std::process::exit(1);
}
}
for item in exported.iter() {
if !imported.contains(item) {
eprintln!("Compatibility mismatch detected: {} (exported) != {} (imported)", item.0, item.1);
std::process::exit(1);
}
}
}
/// compatibility checks are not supported on Windows
};
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ fn run_tests() -> io::Result<()> {
}
("fail", false) if test.check_feature_mismatch => {
eprintln!("❌ \x1b[1;31mTest failed, but not with the expected feature mismatch error.\x1b[0m");
if test.allowed_to_fail {
if test.allowed_to_fail || cfg!(windows) {
println!("⚠️ \x1b[1;33mTest was allowed to fail.\x1b[0m");
} else {
std::process::exit(1);
Expand Down

0 comments on commit 98c503b

Please sign in to comment.