This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Drop order affected because of use order #42
Comments
wesleywiser
added a commit
to wesleywiser/rust
that referenced
this issue
Sep 23, 2021
Currently, with the new 2021 edition, if a closure captures all of the fields of an upvar, we'll drop those fields in the order they are used within the closure instead of the normal drop order (the definition order of the fields in the type). This changes that so we sort the captured fields by the definition order which causes them to drop in that same order as well. Fixes rust-lang/project-rfc-2229#42
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Sep 24, 2021
…ikomatsakis [rfc 2229] Drop fully captured upvars in the same order as the regular drop code Currently, with the new 2021 edition, if a closure captures all of the fields of an upvar, we'll drop those fields in the order they are used within the closure instead of the normal drop order (the definition order of the fields in the type). This changes that so we sort the captured fields by the definition order which causes them to drop in that same order as well. Fixes rust-lang/project-rfc-2229#42 r? `@nikomatsakis`
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Sep 24, 2021
…ikomatsakis [rfc 2229] Drop fully captured upvars in the same order as the regular drop code Currently, with the new 2021 edition, if a closure captures all of the fields of an upvar, we'll drop those fields in the order they are used within the closure instead of the normal drop order (the definition order of the fields in the type). This changes that so we sort the captured fields by the definition order which causes them to drop in that same order as well. Fixes rust-lang/project-rfc-2229#42 r? `@nikomatsakis`
Closing since the PR was merged. |
ehuss
pushed a commit
to ehuss/rust
that referenced
this issue
Oct 4, 2021
…ikomatsakis [rfc 2229] Drop fully captured upvars in the same order as the regular drop code Currently, with the new 2021 edition, if a closure captures all of the fields of an upvar, we'll drop those fields in the order they are used within the closure instead of the normal drop order (the definition order of the fields in the type). This changes that so we sort the captured fields by the definition order which causes them to drop in that same order as well. Fixes rust-lang/project-rfc-2229#42 r? `@nikomatsakis`
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Consider the following example
Even though the closure captures all paths starting from
p
, without the feature the fields are dropped in order, sop.x
and thenp.y
. However, with the feature enabled, we would dropp.y
, and thenp.x
because that's the order (use within the closure) in which we would place them in the desugared closure structure.The text was updated successfully, but these errors were encountered: