-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
91 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: no_std | ||
|
||
on: | ||
pull_request: | ||
push: | ||
paths-ignore: | ||
- '.github/ISSUE_TEMPLATE/**' | ||
branches: | ||
- master | ||
|
||
env: | ||
RUSTFLAGS: -Dwarnings | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
matrix: | ||
rust: [stable, nightly] | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Prepare | ||
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} | ||
- name: Check | ||
run: cargo check -p test_no_std |
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
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
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,21 +1,30 @@ | ||
//! Test for `#![no_std]` crates. | ||
//! | ||
//! Compiling this crate verifies that the Windows crates can be compiled with their "std" | ||
//! feature disabled. | ||
//! feature disabled. The tricky part is that `cargo test` depends on `std` so testing | ||
//! `no_std` requires using `cargo check` instead. That's what the `no_std.yml` is for. | ||
#![no_std] | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use windows::core::{implement, ComObject}; | ||
#[windows::core::implement] | ||
struct App; | ||
|
||
#[implement] | ||
struct App {} | ||
#[cfg(not(test))] | ||
fn _test() { | ||
// Pull in something from each library crate that supports `no_std` to ensure they don't | ||
// accidentally depend on `std`. | ||
let _ = windows_core::ComObject::new(App); | ||
let _ = windows_registry::CURRENT_USER.create("software\\windows-rs"); | ||
let _ = windows_result::HRESULT(0); | ||
let _ = windows_strings::BSTR::new(); | ||
let _ = windows_sys::core::GUID::from_u128(0); | ||
let _ = windows_version::OsVersion::current(); | ||
let _ = windows::core::ComObject::new(App); | ||
} | ||
|
||
// Compilation is sufficient to test. | ||
#[test] | ||
fn basic() { | ||
let object = ComObject::new(App {}); | ||
drop(object); | ||
} | ||
// This panic handler will cause a build error if an indirect `std` dependency exists as `std` | ||
// will include its own panic handler and conflict with this one. | ||
#[cfg_attr(not(test), panic_handler)] | ||
fn _panic(_: &core::panic::PanicInfo<'_>) -> ! { | ||
loop {} | ||
} |