stdarch icon indicating copy to clipboard operation
stdarch copied to clipboard

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

Open thomcc opened this issue 5 years ago • 3 comments

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

https://github.com/rust-lang/stdarch/blob/016eff932fcf30754decb934c89f99f261109c7b/crates/std_detect/src/detect/mod.rs#L101-L104

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:

https://github.com/rust-lang/stdarch/blob/e45171665985255c0c11f6088d0b80dfa7ea9182/crates/std_detect/src/detect/os/linux/mod.rs#L5-L6

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 https://github.com/rust-lang/stdarch/pull/850, which added one of these lines, so I figured I'd ask first.

thomcc avatar Sep 14 '20 16:09 thomcc

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

Lokathor avatar Sep 14 '20 16:09 Lokathor

It was introduced in https://github.com/rust-lang/stdarch/commit/4c66d966e803ddbde36ead7a56d3e4b863053e4c, but even https://github.com/rust-lang/rust/pull/58373, which is the first stdarch update since that commit doesn't enable it.

bjorn3 avatar Sep 14 '20 17:09 bjorn3