Repository navigation
Raw handle macros for field projection experiments - #164627
dingxiangfei2009 wants to merge 2 commits into
Conversation
4cdb718 to
d5bad9f
Compare
This comment has been minimized.
This comment has been minimized.
d5bad9f to
a0c239f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a0c239f to
33785a7
Compare
|
@rustbot ready |
|
Some changes occurred in compiler/rustc_attr_ir cc @jdonszelmann, @JonathanBrouwer
cc @rust-lang/clippy HIR ty lowering was modified cc @fmease
cc @rust-lang/rustfmt The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
hey @oli-obk it would be great if we could get this merged before the cutoff for 1.102. we have some further additions that we'll want to make, but those can be done in separate PRs. I'd also really like to get to a more incremental dev cycle here. one note on this PR, Ding and I were in a meeting just now and we noticed that we don't yet have a |
33785a7 to
7815525
Compare
This comment has been minimized.
This comment has been minimized.
aeca9e4 to
fddb240
Compare
This comment has been minimized.
This comment has been minimized.
| let place_with_id = self.cat_res(opr.hir_id, opr.span, root_ty, res)?; | ||
| // NOTE(dingxiangfei2009,shaddydc): Technically we should capture the root | ||
| // local **via LocalHandle**, but upvar does not understand this yet. | ||
| // We shall come back and add a new upvar capture just for this. |
There was a problem hiding this comment.
what is the effect of the current capture system? overcapturing? document the current behaviour and what changing it would mean
There was a problem hiding this comment.
we're currently intending to overcapture. essentially we'll capture a "reference" to the local variable (this is the LocalHandle mentioned in the comment; op-sem wise it's a raw pointer).
this will mean that the closure cannot outlive the current function.
in the future, we intend to add a new trait that captures pure derefs, which will allow us to move the deref of the root outside of the closure (and then we'll be able to store the handle of the derefed pointer instead of a handle to the local).
combining this with lifetime tracking of the pointee will allow us to make closures live for 'a when they capture a &'a T.
| } | ||
| } | ||
|
|
||
| fn lower_raw_handle_step( |
There was a problem hiding this comment.
move these functions and everything else field projection related into a seprate module
| self.pclose(); | ||
| } | ||
| ast::ExprKind::RawHandle(expr) => { | ||
| self.word("k#raw_handle"); |
There was a problem hiding this comment.
may be better to print as the macro, and probably should add a rustfmt test now, too, otherwise you may get funny things like rustfmt changing your raw_handle!(...) call into k#raw_handle(...)
|
Reminder, once the PR becomes ready for a review, use |
Signed-off-by: Xiangfei Ding <dingxiangfei2009@protonmail.ch>
fddb240 to
fc290a3
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready |
Signed-off-by: Rasmus Piorr <piorr@google.com> Signed-off-by: Xiangfei Ding <dingxiangfei2009@protonmail.ch>
fc290a3 to
375f90d
Compare
|
☔ The latest upstream changes (presumably #166397) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
🐉 Highly experimental field projection primitive
raw_handle!r? @oli-obk
cc @ShaddyDC
cc @ojeda
cc @BennoLossin
We would like to submit this patch to start the experiment with the
LocalHandleandPlaceHandle. We intend to continue polishing it in a patch series following this initial patch.We know that the following items are not working.