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

Do not store return values in locals so that holders benefit from lifetime extension for temporaries. #3142

Merged
merged 2 commits into from May 9, 2023

Conversation

adamreichold
Copy link
Member

@adamreichold adamreichold commented May 6, 2023

Closes #3138

@adamreichold adamreichold force-pushed the extend-holder-lifetime-the-giant-tail-expression-edition branch from 6a5e7eb to a60945f Compare May 6, 2023 14:26
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks, as discussed on #3140, let's move ahead with this solution. I won't merge just in case you want to play with refactoring the OkWrap pattern into a function or struct as suggested on that thread. (I am also fine with leaving that for the future, the macro code will be simpler once we ditch the deprecated #[args] and also I have a refactoring or two in my mind which maybe I'll get to one day.)

@adamreichold
Copy link
Member Author

I am also fine with leaving that for the future

I'd like to limit ourselves to the fix for now as I am seeing an obvious simplification by trying to extract the ok wrapping ATM.

bors r=davidhewitt

bors bot added a commit that referenced this pull request May 9, 2023
3142: Do not store return values in locals so that holders benefit from lifetime extension for temporaries. r=davidhewitt a=adamreichold

Closes #3138

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
@adamreichold
Copy link
Member Author

bors retry

@bors
Copy link
Contributor

bors bot commented May 9, 2023

Already running a review

@bors
Copy link
Contributor

bors bot commented May 9, 2023

Build failed:

@adamreichold
Copy link
Member Author

bors retry

@bors
Copy link
Contributor

bors bot commented May 9, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

  • conclusion

@bors bors bot merged commit c9f383a into main May 9, 2023
33 checks passed
@bors bors bot deleted the extend-holder-lifetime-the-giant-tail-expression-edition branch May 9, 2023 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E0716 "temporary value dropped while borrowed" in #[pyfunction]
2 participants