Skip to content

Commit 7dce50f

Browse files
committed
Resolve watch situation
1 parent 4ab9dea commit 7dce50f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

crates/cargo-gpu-cache/src/build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl Build {
105105
self.build()
106106
}
107107

108-
/// Builds shader crate locally using [`SpirvBuilder`].
108+
/// Builds shader crate using [`SpirvBuilder`].
109109
fn build(&self) -> anyhow::Result<()> {
110110
crate::user_output!(
111111
"Compiling shaders at {}...\n",
@@ -117,7 +117,7 @@ impl Build {
117117
}
118118

119119
/// Watches shader crate for changes using [`SpirvBuilder`]
120-
/// or panics depending on presence of `watch` feature.
120+
/// or returns an error depending on presence of `watch` feature.
121121
fn watch(&self) -> anyhow::Result<()> {
122122
#[cfg(feature = "watch")]
123123
{
@@ -130,13 +130,13 @@ impl Build {
130130
accept.submit(parse_result);
131131
}
132132
})?
133-
.context("unreachable")??;
134-
std::thread::park();
135-
Ok(())
133+
.context("should always return the first compile result")
134+
.flatten()?;
135+
anyhow::bail!("unexpected end of watch")
136136
}
137137

138138
#[cfg(not(feature = "watch"))]
139-
unreachable!("cannot watch without the `watch` feature")
139+
anyhow::bail!("cannot watch for changes without the `watch` feature")
140140
}
141141

142142
/// Parses compilation result from [`SpirvBuilder`] and writes it out to a file

0 commit comments

Comments
 (0)