-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into arm64ec
- Loading branch information
Showing
24 changed files
with
2,971 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[package] | ||
name = "cc" | ||
version = "1.0.73" | ||
version = "1.0.84" | ||
authors = ["Alex Crichton <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/alexcrichton/cc-rs" | ||
homepage = "https://github.com/alexcrichton/cc-rs" | ||
repository = "https://github.com/rust-lang/cc-rs" | ||
homepage = "https://github.com/rust-lang/cc-rs" | ||
documentation = "https://docs.rs/cc" | ||
description = """ | ||
A build-time dependency for Cargo build scripts to assist in invoking the native | ||
|
@@ -16,12 +16,15 @@ readme = "README.md" | |
categories = ["development-tools::build-utils"] | ||
exclude = ["/.github"] | ||
edition = "2018" | ||
rust-version = "1.53" | ||
|
||
[dependencies] | ||
jobserver = { version = "0.1.16", optional = true } | ||
[target.'cfg(unix)'.dependencies] | ||
# Don't turn on the feature "std" for this, see https://github.com/rust-lang/cargo/issues/4866 | ||
# which is still an issue with `resolver = "1"`. | ||
libc = { version = "0.2.62", default-features = false } | ||
|
||
[features] | ||
parallel = ["jobserver"] | ||
parallel = [] | ||
|
||
[dev-dependencies] | ||
tempfile = "3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "gen-windows-sys-binding" | ||
version = "0.0.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
windows-bindgen = "0.49" | ||
|
||
# Prevent this from interfering with workspaces | ||
[workspace] | ||
members = ["."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//! Adapted from | ||
//! https://github.com/rust-lang/rust/blob/master/src/tools/generate-windows-sys/src/main.rs | ||
use std::{ | ||
fs, | ||
io::{self, Write}, | ||
}; | ||
|
||
/// This is printed to the file before the rest of the contents. | ||
const PRELUDE: &str = r#"// This file is autogenerated. | ||
// | ||
// To add bindings, edit windows_sys.lst then run: | ||
// | ||
// ``` | ||
// cd generate-windows-sys/ | ||
// cargo run | ||
// ``` | ||
"#; | ||
|
||
const POSTLUDE: &str = r#" | ||
/// Adapted from | ||
/// [`core::ptr::invalid_mut()`](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#600-607). | ||
/// | ||
/// This function should actually use `core::mem::transmute` but due to msrv | ||
/// we use `as` casting instead. | ||
/// | ||
/// Once msrv is bumped to 1.56, replace this with `core::mem::transmute` since | ||
/// it is const stablised in 1.56 | ||
/// | ||
/// NOTE that once supports `strict_provenance` we would also have to update | ||
/// this. | ||
const fn invalid_mut<T>(addr: usize) -> *mut T { | ||
addr as *mut T | ||
} | ||
"#; | ||
|
||
fn main() -> io::Result<()> { | ||
// Load the list of APIs | ||
let buffer = fs::read_to_string("windows_sys.list")?; | ||
let names: Vec<&str> = buffer | ||
.lines() | ||
.filter_map(|line| { | ||
let line = line.trim(); | ||
if line.is_empty() || line.starts_with("//") { | ||
None | ||
} else { | ||
Some(line) | ||
} | ||
}) | ||
.collect(); | ||
|
||
// Write the bindings to windows-sys.rs | ||
let bindings = | ||
windows_bindgen::standalone_std(&names).replace("::core::ptr::invalid_mut", "invalid_mut"); | ||
|
||
let mut f = fs::File::create("../src/windows_sys.rs")?; | ||
f.write_all(PRELUDE.as_bytes())?; | ||
f.write_all(bindings.as_bytes())?; | ||
f.write_all(POSTLUDE.as_bytes())?; | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.