Skip to content

Building autocfg won't generate the has_std cfg #431

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

Closed
antoyo opened this issue Feb 13, 2024 · 1 comment
Closed

Building autocfg won't generate the has_std cfg #431

antoyo opened this issue Feb 13, 2024 · 1 comment
Labels
good first issue Good for newcomers

Comments

@antoyo
Copy link
Contributor

antoyo commented Feb 13, 2024

For example, this build.rs:

fn main() {
    autocfg::new().emit_sysroot_crate("std");
}

with this main.rs:

#[cfg(has_std)]
fn print() {
    println!("Has std");
}

#[cfg(not(has_std))]
fn print() {
    println!("Doesn't have std");
}

fn main() {
    print();
}

Cargo.toml:

[build-dependencies.autocfg]
version = "1"

Will print "Doesn't have std" when compiled with cg_gcc.

Replacing the code for emit_ir in cg_gcc with:

            let out = cgcx.output_filenames.temp_path(OutputType::LlvmAssembly, module_name);
            std::fs::write(out, "").expect("write file");

doesn't seem enough to fix this issue.

I'm not sure how to get logs from autocfg.

@antoyo antoyo added the good first issue Good for newcomers label Feb 13, 2024
@antoyo
Copy link
Contributor Author

antoyo commented Feb 14, 2024

Fixed by #437.

@antoyo antoyo closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant