Add Steal::is_stolen()

This commit is contained in:
Nadrieril 2024-08-08 10:20:26 +02:00
parent 9337f7afa6
commit 09ae438eb0

View File

@ -51,6 +51,12 @@ impl<T> Steal<T> {
let value = value_ref.take();
value.expect("attempt to steal from stolen value")
}
/// Writers of rustc drivers often encounter stealing issues. This function makes it possible to
/// handle these errors gracefully. This is not used within rustc as the time of writing.
pub fn is_stolen(&self) -> bool {
self.value.borrow().is_none()
}
}
impl<CTX, T: HashStable<CTX>> HashStable<CTX> for Steal<T> {