Skip to content

FSU doesn't run destructors of temporaries #17302

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

Closed
alexcrichton opened this issue Sep 16, 2014 · 2 comments · Fixed by #17311
Closed

FSU doesn't run destructors of temporaries #17302

alexcrichton opened this issue Sep 16, 2014 · 2 comments · Fixed by #17311
Labels
A-destructors Area: Destructors (`Drop`, …)

Comments

@alexcrichton
Copy link
Member

struct A(int);
struct Foo { _a: A, _b: int }

impl Drop for A {
    fn drop(&mut self) {
        let A(i) = *self;
        println!("dropping {}", i);
    }
}

fn main() {
    Foo {
        _a: A(1),
        ..Foo { _a: A(2), _b: 2 }
    };
}
$ rustc foo.rs && ./foo 
dropping 1
@alexcrichton
Copy link
Member Author

Note that dropping 2 is never printed.

@alexcrichton alexcrichton added the A-destructors Area: Destructors (`Drop`, …) label Sep 16, 2014
@alexcrichton alexcrichton changed the title FSU doesn't run destructors FSU doesn't run destructors of temporaries Sep 16, 2014
@alexcrichton
Copy link
Member Author

Nominating, we're just flat out not running destructors as opposed to running them at odd times.

lnicola pushed a commit to lnicola/rust that referenced this issue Jun 2, 2024
fix diagnostics clearing when flychecks run per-workspace

This might be causing rust-lang#17300 or it's a different bug with the same functionality.

I wonder if the decision to clear diagnostics should stay in the main loop or maybe the flycheck itself should track it and tell the mainloop?

I have used a hash map but we could just as well use a vector since the IDs are `usizes` in some given range starting at 0. It would be probably faster but this just felt a bit cleaner and it allows us to change the ID to newtype later and we can just use a hasher that returns the underlying integer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-destructors Area: Destructors (`Drop`, …)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant