-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add Steal::is_stolen()
#128815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Steal::is_stolen()
#128815
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I didn't know that. I was in the process of adding an internal lint to warn about uses of functions like this as was suggested ^^. Do you think the lint would be worth it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are probably other methods which don't have the |
||
self.value.borrow().is_none() | ||
} | ||
} | ||
|
||
impl<CTX, T: HashStable<CTX>> HashStable<CTX> for Steal<T> { | ||
|
Uh oh!
There was an error while loading. Please reload this page.