|
1 |
| -//! Legacy target specs are spec jsons for versions before `rustc_codegen_spirv-target-specs` |
2 |
| -//! came bundled with them. Instead, cargo gpu needs to bundle these legacy spec files. Luckily, |
3 |
| -//! they are the same for all versions, as bundling target specs with the codegen backend was |
4 |
| -//! introduced before the first target spec update. |
| 1 | +//! There are 4 version ranges of `rustc_codegen_spirv` and they all need different handling on |
| 2 | +//! their target specs: |
| 3 | +//! * "ancient" versions such as 0.9.0 or earlier do not need target specs, just passing the target |
| 4 | +//! string (`spirv-unknown-vulkan1.2`) directly is sufficient. We still prep target-specs for them |
| 5 | +//! like the "legacy" variant below, spirv-builder |
| 6 | +//! [will just ignore it](https://github.com/Rust-GPU/rust-gpu/blob/369122e1703c0c32d3d46f46fa11ccf12667af03/crates/spirv-builder/src/lib.rs#L987) |
| 7 | +//! * "legacy" versions require target specs to compile, which is a requirement introduced by some |
| 8 | +//! rustc version. Back then it was decided that cargo gpu would ship them, as they'd probably |
| 9 | +//! never change, right? So now we're stuck with having to ship these "legacy" target specs with |
| 10 | +//! cargo gpu *forever*. These are the symbol `legacy_target_specs::TARGET_SPECS`, with |
| 11 | +//! `legacy_target_specs` being a **fixed** version of `rustc_codegen_spirv-target-specs`, |
| 12 | +//! which must **never** update. |
| 13 | +//! * As of [PR 256](https://github.com/Rust-GPU/rust-gpu/pull/256), `rustc_codegen_spirv` now has |
| 14 | +//! a direct dependency on `rustc_codegen_spirv-target-specs`, allowing cargo gpu to pull the |
| 15 | +//! required target specs directly from that dependency. At this point, the target specs are |
| 16 | +//! still the same as the legacy target specs. |
| 17 | +//! * The [edition 2024 PR](https://github.com/Rust-GPU/rust-gpu/pull/249) must update the |
| 18 | +//! target specs to comply with newly added validation within rustc. This is why the new system |
| 19 | +//! was implemented, so we can support both old and new target specs without having to worry |
| 20 | +//! which version of cargo gpu you are using. It'll "just work". |
| 21 | +//! |
| 22 | +//! This module deals with these "legacy" target specs. |
5 | 23 |
|
6 | 24 | use anyhow::Context as _;
|
7 | 25 | use std::path::Path;
|
|
0 commit comments