Skip to content
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 track_caller to .steal() #81125

Merged
merged 1 commit into from
Jan 18, 2021
Merged

Add track_caller to .steal() #81125

merged 1 commit into from
Jan 18, 2021

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jan 17, 2021

Before:

thread 'rustc' panicked at 'attempt to read from stolen value', /home/joshua/rustc/compiler/rustc_data_structures/src/steal.rs:43:15

After:

thread 'rustc' panicked at 'attempt to steal from stolen value', compiler/rustc_mir/src/transform/mod.rs:423:25

r? @lcnr

Before:

```
thread 'rustc' panicked at 'attempt to read from stolen value', /home/joshua/rustc/compiler/rustc_data_structures/src/steal.rs:43:15
```

After:

```
thread 'rustc' panicked at 'attempt to steal from stolen value', compiler/rustc_mir/src/transform/mod.rs:423:25
```
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 17, 2021
@jyn514 jyn514 added A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 17, 2021
@lcnr
Copy link
Contributor

lcnr commented Jan 17, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 17, 2021

📌 Commit 394d701 has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 18, 2021
Rollup of 12 pull requests

Successful merges:

 - rust-lang#81038 (Update Clippy)
 - rust-lang#81071 (rustc_parse_format: Fix character indices in find_skips)
 - rust-lang#81100 (prevent potential bug in `encode_with_shorthand`.)
 - rust-lang#81105 (Initialize a few variables directly)
 - rust-lang#81116 (ConstProp: Copy body span instead of querying it)
 - rust-lang#81121 (Avoid logging the whole MIR body in SimplifyCfg)
 - rust-lang#81123 (Update cmp.rs)
 - rust-lang#81125 (Add track_caller to .steal())
 - rust-lang#81128 (validation test: turn some const_err back into validation failures)
 - rust-lang#81131 (Edit rustc_middle::ty::cast docs)
 - rust-lang#81142 (Replace let Some(..) = with .is_some())
 - rust-lang#81153 (Remove unused linkcheck exceptions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f82100e into rust-lang:master Jan 18, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 18, 2021
@jyn514 jyn514 deleted the track-caller branch January 18, 2021 18:50
Comment on lines +33 to 36
#[track_caller]
pub fn borrow(&self) -> MappedReadGuard<'_, T> {
ReadGuard::map(self.value.borrow(), |opt| match *opt {
None => panic!("attempted to read from stolen value"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR only fixed .steal(), .borrow() has no effect because the panic! is in a closure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants