Add Steal::is_stolen()
This commit is contained in:
parent
9337f7afa6
commit
09ae438eb0
@ -51,6 +51,12 @@ pub fn steal(&self) -> T {
|
|||||||
let value = value_ref.take();
|
let value = value_ref.take();
|
||||||
value.expect("attempt to steal from stolen value")
|
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> {
|
impl<CTX, T: HashStable<CTX>> HashStable<CTX> for Steal<T> {
|
||||||
|
Loading…
Reference in New Issue
Block a user