Skip to content

Commit 09ae438

Browse files
committed
Add Steal::is_stolen()
1 parent 9337f7a commit 09ae438

File tree

1 file changed

+6
-0
lines changed
  • compiler/rustc_data_structures/src

1 file changed

+6
-0
lines changed

compiler/rustc_data_structures/src/steal.rs

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ impl<T> Steal<T> {
5151
let value = value_ref.take();
5252
value.expect("attempt to steal from stolen value")
5353
}
54+
55+
/// Writers of rustc drivers often encounter stealing issues. This function makes it possible to
56+
/// handle these errors gracefully. This is not used within rustc as the time of writing.
57+
pub fn is_stolen(&self) -> bool {
58+
self.value.borrow().is_none()
59+
}
5460
}
5561

5662
impl<CTX, T: HashStable<CTX>> HashStable<CTX> for Steal<T> {

0 commit comments

Comments
 (0)