diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-08-08 10:20:26 +0200 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-08-08 12:11:05 +0200 |
| commit | 09ae438eb095e6e2a94e1516cb962e66bfc6d747 (patch) | |
| tree | 855de449e589591ab86f09babb397063a801919b | |
| parent | 9337f7afa6fda07e60d6aa5ee88e692878446782 (diff) | |
| download | rust-09ae438eb095e6e2a94e1516cb962e66bfc6d747.tar.gz rust-09ae438eb095e6e2a94e1516cb962e66bfc6d747.zip | |
Add `Steal::is_stolen()`
| -rw-r--r-- | compiler/rustc_data_structures/src/steal.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/steal.rs b/compiler/rustc_data_structures/src/steal.rs index 9a0fd52677d..f305a8ad120 100644 --- a/compiler/rustc_data_structures/src/steal.rs +++ b/compiler/rustc_data_structures/src/steal.rs @@ -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> { |
