Skip to content

Commit fe42c46

Browse files
committed
compile_codegen: fix watch feature
1 parent 1c0baee commit fe42c46

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/spirv-builder/src/watch.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ impl SpirvBuilder {
1212
/// Returns the result of the first successful compilation, then calls
1313
/// `on_compilation_finishes` for each subsequent compilation.
1414
pub fn watch(
15-
mut self,
15+
self,
1616
mut on_compilation_finishes: impl FnMut(CompileResult) + Send + 'static,
1717
) -> Result<CompileResult, SpirvBuilderError> {
18-
self.validate_running_conditions()?;
18+
let path_to_crate = self
19+
.path_to_crate
20+
.as_ref()
21+
.ok_or(SpirvBuilderError::MissingCratePath)?;
1922
if !matches!(self.print_metadata, crate::MetadataPrintout::None) {
2023
return Err(SpirvBuilderError::WatchWithPrintMetadata);
2124
}
@@ -43,7 +46,7 @@ impl SpirvBuilder {
4346
.expect("Could create watcher");
4447
// This is likely to notice changes in the `target` dir, however, given that `cargo watch` doesn't seem to handle that,
4548
watcher
46-
.watch(&self.path_to_crate, RecursiveMode::Recursive)
49+
.watch(&path_to_crate, RecursiveMode::Recursive)
4750
.expect("Could watch crate root");
4851
loop {
4952
rx.recv().expect("Watcher still alive");

0 commit comments

Comments
 (0)