Skip to content

Commit

Permalink
Add Steal::is_stolen()
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Aug 8, 2024
1 parent 9337f7a commit 09ae438
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_data_structures/src/steal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 09ae438

Please sign in to comment.