[Migrated] We should consider using `#[rustc_on_unimplemented]` on `spirv-std` helper traits.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 3.4k
- Fork
- 125
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/983
Old labels: t: enhancement
Originally creatd by eddyb on 2023-01-05T12:44:08Z
I was reviewing this nightly bump PR:
And its diff shows some nightly diagnostic improvements of the form:
12 | *output = image.query_levels();
- | ^^^^^ ------------ required by a bound introduced by this call
- | |
- | the trait `HasQueryLevels` is not implemented for `Image<f32, 4, 2, 0, 0, 1, 0>`
+ | ^^^^^^^^^^^^ the trait `HasQueryLevels` is not implemented for `Image<f32, 4, 2, 0, 0, 1, 0>`
|
= help: the following other types implement trait `HasQueryLevels`:
Image<SampledType, 0, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>
That's definitely better, but the trait can't really explain itself and its connection to the types (i.e. "Image types support query_levels only if such and such parameters have these values" etc.).
Except, in core/std, traits can and very much do do this, using #[rustc_on_unimplemented]!
It's perma-unstable, and there might be efforts to stabilize a subset of it, but even ignoring that, we can still use it under #[cfg_attr(target_arch = "spirv", ...)], just like all the other rustc internals we rely on.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando le definizioni degli helper trait di spirv-std coinvolte in metodi come query_levels, quindi esamina le modifiche ai diagnostic di nightly nella PR 982 e il comportamento documentato di rustc_on_unimplemented. Il lavoro è completato quando le combinazioni di parametri Image non supportate producono diagnostic che spiegano il requisito del trait pertinente e le combinazioni valide, mentre l’attributo rimane gated per i target SPIR-V.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100