mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Add Steal::is_stolen()
This commit is contained in:
parent
9337f7afa6
commit
09ae438eb0
@ -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…
Reference in New Issue
Block a user