-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
refactor(core): make borrow_mut
more explicit in the ops macro
#16025
Conversation
b628b94
to
5d59fd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Maybe std::cell::RefCell::borrow_mut(&ctx.state)
is better / more explicit?
Fair, let me change that |
5d59fd3
to
46829dc
Compare
b9a0e92
to
e9f86f1
Compare
@littledivy please take a look |
e9f86f1
to
0414aa8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
borrow_mut
more explicit in the ops macroborrow_mut
more explicit in the ops macro
This PR fixes a potentially hard to debug compilation failure in the case where
std::borrow::BorrowMut
is in scope when ops are defined:This will refuse to compile because
Rc::borrow_mut
gets called instead ofRefCell::borrow_mut
onRc<RefCell<OpState>>
in the generated macro code.see also: rust-lang/rust#39232