bytecodealliance / bytecodealliance/rustix
Next libc version will break musl targets
- Lingua principale
- Rust
- Stelle
- 2.1k
- Fork
- 294
- Merge medio
- 6g 22h
- PR unite (30g)
- 4
Descrizione
We currently import `STATX_TYPE` and related constants from `linux_raw_sys` because the `libc` crate does not expose `statx` constants for non-glibc targets:
https://github.com/bytecodealliance/rustix/blob/9640071aef0dfd65d21bf01c1dd1baa0a1b13310/src/backend/libc/c.rs#L477
However, the next version of the `libc` crate will expose these constants as well (see https://github.com/rust-lang/libc/pull/5448). This will result in ambiguous imports and build failures on musl targets:
```console
$ cargo check -q --workspace --features=use-libc,all-apis --all-targets --target=x86_64-unknown-linux-musl
error[E0659]: `STATX_TYPE` is ambiguous
--> src/fs/statx.rs:75:25
|
75 | const TYPE = c::STATX_TYPE;
| ^^^^^^^^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `STATX_TYPE` could refer to the constant imported here
--> src/backend/libc/c.rs:7:16
|
7 | pub(crate) use libc::*;
| ^^^^^^^
= help: consider adding an explicit import of `STATX_TYPE` to disambiguate
note: `STATX_TYPE` could also refer to the constant imported here
--> src/backend/libc/c.rs:512:16
|
512 | pub(crate) use statx_flags::*;
| ^^^^^^^^^^^^^^
= help: consider adding an explicit import of `STATX_TYPE` to disambiguate
```
We should update the imports before the next `libc` release to avoid breaking musl builds.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in src/backend/libc/c.rs, intorno agli import di libc e statx_flags, poi esamina l’uso di STATX_TYPE in src/fs/statx.rs. Esegui cargo check -q --workspace --features=use-libc,all-apis --all-targets --target=x86_64-unknown-linux-musl; il completamento indica che la build musl termina senza errori di import ambigui quando le prossime costanti libc sono disponibili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- linux, rust
- Ambito
- operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 84/100