Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows-core incorrectly propagates the std feature to subcrates #3163

Closed
Intege-rs opened this issue Jul 16, 2024 · 3 comments · Fixed by #3180
Closed

Windows-core incorrectly propagates the std feature to subcrates #3163

Intege-rs opened this issue Jul 16, 2024 · 3 comments · Fixed by #3180
Labels
bug Something isn't working

Comments

@Intege-rs
Copy link

Summary

Windows-core always enables the std feature on Windows-strings and Windows-results

Crate manifest

[package]
name = "scratch"
version = "0.1.0"
edition = "2021"

[dependencies.windows]
version = "0.58.0"
default-features = false
features = []

Crate code

# build.rs
fn main() {
    println!("cargo:rustc-link-arg=/SubSystem:Console");
    println!("cargo:rustc-link-arg=/ENTRY:main");
}

# main.rs
#![no_std] #![no_main]

#[no_mangle]
extern "C" fn main() {
    // result incorrectly re-imports std into a no-std project
    let _ = windows::core::HRESULT(0);
}

// found duplicate lang item `panic_impl`
#[cfg_attr(not(test), panic_handler)]
fn _panic(_: &core::panic::PanicInfo) -> ! {
    loop {}
}
@kennykerr
Copy link
Collaborator

This repro does not appear to be resolved by #3164

@kennykerr
Copy link
Collaborator

I think I figured out how to test this - PR coming soon.

@kennykerr
Copy link
Collaborator

Thanks for reporting this issue! Testing revealed that there was a bit more involved in fixing this problem. #3180 provides the fix as well as the test repro and verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants