-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Some struct destructors not run when Dest = Ignore. #6892
Labels
A-destructors
Area: Destructors (`Drop`, …)
A-trait-system
Area: Trait system
A-type-system
Area: Type system
P-medium
Medium priority
Milestone
Comments
possibly related to #3181 though obviously this is more severe. |
Reproduces with: struct Foo;
struct Bar { x: int }
struct Baz(int);
impl Drop for Foo {
fn drop(&self) {
println("finalize Foo");
}
}
impl Drop for Bar {
fn drop(&self) {
println("finalize Bar");
}
}
impl Drop for Baz {
fn drop(&self) {
println("finalize Baz");
}
}
fn main() {
{ let _x = Foo; }
{ let _x = Bar { x: 21 }; }
{ let _x = Baz(21); }
println("------------");
{ let _ = Foo; }
{ let _ = Bar { x: 21 }; }
{ let _ = Baz(21); }
} |
This still exhibits the same behaviour, though |
I think we should just remove "dest=ignore" |
Accepted for "first major rel" milestone, assigning P-high. |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Apr 8, 2014
Previously, if statements of the form "Foo;" or "let _ = Foo;" were encountered where Foo had a destructor, the destructors were not run. This changes the relevant locations in trans to check for ty::type_needs_drop and invokes trans_to_lvalue instead of trans_into. Closes rust-lang#4734 Closes rust-lang#6892
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Mar 25, 2021
inconsistent_struct_constructor: try to make message and lint description a bit clearer changelog: inconsistent_struct_constructor: try to make message and lint description a bit clearer r? `@ghost`
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-destructors
Area: Destructors (`Drop`, …)
A-trait-system
Area: Trait system
A-type-system
Area: Type system
P-medium
Medium priority
While the destructor for newtypes always seems to run the same is not true for regular or unit-like structs.
I'm not sure which is the right behaviour.
The text was updated successfully, but these errors were encountered: