[Migrated] We should consider using `#[rustc_on_unimplemented]` on `spirv-std` helper traits.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 3.4k
- Forks
- 125
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die Definitionen der in Methoden wie query_levels verwendeten Hilfstraits in spirv-std zu finden. Überprüfe anschließend die Änderungen an den Nightly-Diagnosen in PR 982 sowie das dokumentierte Verhalten von rustc_on_unimplemented. Als erledigt gilt die Aufgabe, wenn nicht unterstützte Image-Parameter-Kombinationen Diagnosen erzeugen, die die relevante Trait-Anforderung und gültige Kombinationen erläutern, während das Attribut weiterhin für SPIR-V-Ziele gegatet bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100