Skip to content

std_detect has cfg(feature = "use_std") but no such feature exists. #909

@thomcc

Description

@thomcc
Member

In std_detect::detect, the non-x86{,_64} code for linux / freebsd is behind feature = "use_std":

} else if #[cfg(all(target_os = "linux", feature = "use_std"))] {
#[path = "os/linux/mod.rs"]
mod os;
} else if #[cfg(all(target_os = "freebsd", feature = "use_std"))] {

I believe this is intended to be feature = "std_detect_file_io"? Or maybe not, because the linux module further cordons off the cpuinfo reading under that, implying it expects that it may exist without this std_detect_file_io:

#[cfg(feature = "std_detect_file_io")]
mod cpuinfo;

AFAICT this code is just totally dead, and it's a bit of a large amount of dead code to have sitting in the tree... and I can't find an old commit that even had a use_std feature, so I'm probably just wrong and am unaware of some mode that this code is compiled in — I know about "as a module of libstd", but is there anything else I should be aware of?

If not, even if the code is not production ready, it seems like it should stay compiling.

Anyway, I was gonna submit a PR with this to see if the CI passed at least, but I became worried that if it landed, it would regress #850, which added one of these lines, so I figured I'd ask first.

Activity

Lokathor

Lokathor commented on Sep 14, 2020

@Lokathor
Contributor

It's possible that this gets set by somewhere else that builds this crate as a submodule.

bjorn3

bjorn3 commented on Sep 14, 2020

@bjorn3
Member
bjorn3

bjorn3 commented on Sep 14, 2020

@bjorn3
Member

It was introduced in 4c66d96, but even rust-lang/rust#58373, which is the first stdarch update since that commit doesn't enable it.

sayantn

sayantn commented on Jul 25, 2025

@sayantn
Contributor

This was removed, and now it is feature = "libc"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @thomcc@Lokathor@bjorn3@sayantn

        Issue actions

          std_detect has `cfg(feature = "use_std")` but no such feature exists. · Issue #909 · rust-lang/stdarch