Skip to content

Commit 30c6502

Browse files
committed
compile_codegen: add compile_codegen feature
1 parent 1e4e468 commit 30c6502

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

crates/spirv-builder/Cargo.toml

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ no-default-features = true
1818
# that optional dependency, from being automatically created by Cargo, see:
1919
# https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies
2020
[features]
21-
# See `rustc_codegen_spirv/Cargo.toml` for details on these features.
2221
default = ["use-compiled-tools"]
23-
use-installed-tools = ["dep:rustc_codegen_spirv", "rustc_codegen_spirv?/use-installed-tools"]
24-
use-compiled-tools = ["dep:rustc_codegen_spirv", "rustc_codegen_spirv?/use-compiled-tools"]
22+
# Compile `rustc_codegen_spirv`, allows constructing SpirvBuilder without
23+
# explicitly passing in a path to a compiled `rustc_codegen_spirv.so` (or dll)
24+
compile_codegen = ["dep:rustc_codegen_spirv"]
25+
# See `rustc_codegen_spirv/Cargo.toml` for details on these features.
26+
use-installed-tools = ["compile_codegen", "rustc_codegen_spirv?/use-installed-tools"]
27+
use-compiled-tools = ["compile_codegen", "rustc_codegen_spirv?/use-compiled-tools"]
2528
skip-toolchain-check = ["rustc_codegen_spirv?/skip-toolchain-check"]
2629

2730
watch = ["dep:notify"]

crates/spirv-builder/src/lib.rs

-25
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,6 @@
7272
// #![allow()]
7373
#![doc = include_str!("../README.md")]
7474

75-
// HACK(eddyb) try to catch misuse of Cargo package features very early on
76-
// (see `spirv-builder/Cargo.toml` for why we go through all of this).
77-
#[cfg(all(
78-
not(any(feature = "use-compiled-tools", feature = "use-installed-tools")),
79-
not(doc)
80-
))]
81-
compile_error!(
82-
"at least one of `use-compiled-tools` or `use-installed-tools` features must be enabled
83-
(outside of documentation builds, which require disabling both to build on stable)"
84-
);
85-
86-
#[cfg(doc)]
87-
fn _ensure_cfg_doc_means_rustdoc() {
88-
// HACK(eddyb) this relies on specific `rustdoc` behavior (i.e. it skips
89-
// type-checking function bodies, so we trigger a compile-time `panic! from
90-
// a type) to check that we're in fact under `rustdoc`, not just `--cfg doc`.
91-
#[rustfmt::skip]
92-
let _: [(); panic!("
93-
94-
`--cfg doc` was set outside of `rustdoc`
95-
(if you are running `rustdoc` or `cargo doc`, please file an issue)
96-
97-
")];
98-
}
99-
10075
mod depfile;
10176
#[cfg(feature = "watch")]
10277
mod watch;

0 commit comments

Comments
 (0)