-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Support FRU pattern with [feature(capture_disjoint_fields)]
#81291
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support FRU pattern with [feature(capture_disjoint_fields)]
#81291
Conversation
The job Click to see the possible cause of the failure (guessed by this bot)
|
…res when feature capture_disjoint_fields is enabled
42cf990
to
e94cf57
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.
This looks good. Approved but I think maybe we want one more test.
let c = || { | ||
let s2 = S { | ||
a: format!("New a"), | ||
..s |
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.
Should we add a test for something like ..s.a
?
@bors delegate+ You can feel free to r=nikomatsakis once the test is added. |
✌️ @null-sleep can now approve this pull request |
e6e342d
to
5e983d7
Compare
@bors r=nikomatsakis |
📌 Commit 5e983d7 has been approved by |
…ional-record-update-syntax-error, r=nikomatsakis Support FRU pattern with `[feature(capture_disjoint_fields)]` In case of a functional record update syntax for creating a structure, `ExprUseVisitor` to only detect the precise use of some of the field in the `..x` part of the syntax. However, when we start building MIR, we 1. First, build the place for `x` 2. and then, add precise field projections so that only some parts of `x` end up getting read. When `capture_disjoint_fields` is enabled, and FRU is used within a closure `x` won't be completely captured, and therefore the first step will fail. This PR updates `mir_build` to create a place builder in the first step and then create place from the builder only after applying the field projection. Closes rust-lang/project-rfc-2229#32 r? `@nikomatsakis`
Rollup of 16 pull requests Successful merges: - rust-lang#79023 (Add `core::stream::Stream`) - rust-lang#80562 (Consider Scalar to be a bool only if its unsigned) - rust-lang#80886 (Stabilize raw ref macros) - rust-lang#80959 (Stabilize `unsigned_abs`) - rust-lang#81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`) - rust-lang#81409 (Slight simplification of chars().count()) - rust-lang#81468 (cfg(version): treat nightlies as complete) - rust-lang#81473 (Warn write-only fields) - rust-lang#81495 (rustdoc: Remove unnecessary optional) - rust-lang#81499 (Updated Vec::splice documentation) - rust-lang#81501 (update rustfmt to v1.4.34) - rust-lang#81505 (`fn cold_path` doesn't need to be pub) - rust-lang#81512 (Add missing variants in match binding) - rust-lang#81515 (Fix typo in pat.rs) - rust-lang#81519 (Don't print error output from rustup when detecting default build triple) - rust-lang#81520 (Don't clone LLVM submodule when download-ci-llvm is set) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
In case of a functional record update syntax for creating a structure,
ExprUseVisitor
to only detect the precise use of some of the field in the..x
part of the syntax. However, when we start building MIR, wex
x
end up getting read.When
capture_disjoint_fields
is enabled, and FRU is used within a closurex
won't be completely captured, and therefore the first step will fail. This PR updatesmir_build
to create a place builder in the first step and then create place from the builder only after applying the field projection.Closes rust-lang/project-rfc-2229#32
r? @nikomatsakis