Add Steal::is_stolen()
This commit is contained in:
parent
9337f7afa6
commit
09ae438eb0
1 changed files with 6 additions and 0 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue