Skip to content

Commit 08d71a8

Browse files
authored
Unrolled build for rust-lang#128815
Rollup merge of rust-lang#128815 - Nadrieril:is_stolen, r=jieyouxu,lcnr Add `Steal::is_stolen()` Writers of rustc drivers (such as myself) often encounter stealing issues. It is currently impossible to gracefully handle them. This PR adds a `Steal::is_stolen()` function for that purpose.
2 parents 899eb03 + c966370 commit 08d71a8

File tree

1 file changed

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

1 file changed

+9
-0
lines changed

compiler/rustc_data_structures/src/steal.rs

+9
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ 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.
57+
///
58+
/// This should not be used within rustc as it leaks information not tracked
59+
/// by the query system, breaking incremental compilation.
60+
pub fn is_stolen(&self) -> bool {
61+
self.value.borrow().is_none()
62+
}
5463
}
5564

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

0 commit comments

Comments
 (0)