Rollup merge of #128815 - Nadrieril:is_stolen, r=jieyouxu,lcnr
Add `Steal::is_stolen()` Writers of rustc drivers (such as myself) often encounter stealing issues. It is currently impossible to gracefully handle them. This PR adds a `Steal::is_stolen()` function for that purpose.
This commit is contained in:
commit
55329cce76
@ -51,6 +51,15 @@ 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 should not be used within rustc as it leaks information not tracked
|
||||
/// by the query system, breaking incremental compilation.
|
||||
pub fn is_stolen(&self) -> bool {
|
||||
self.value.borrow().is_none()
|
||||
}
|
||||
}
|
||||
|
||||
impl<CTX, T: HashStable<CTX>> HashStable<CTX> for Steal<T> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user