Skip to content
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

rustc: Run destructors when dest=Ignore #13390

Merged
merged 1 commit into from
Apr 16, 2014

Conversation

alexcrichton
Copy link
Member

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 #4734
Closes #6892

// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind adding a small description about what's being tested? (for future readers of this test)

@alexcrichton
Copy link
Member Author

If this does indeed turn out to be the right solution, I'm curious if this closes #10488? I've lost track of the discussion there, but this seems applicable to that.

@lilyball
Copy link
Contributor

lilyball commented Apr 7, 2014

Can we get a test that ensures that let _a = ... doesn't Drop immediately but instead Drops at the end of scope (as expected)?

@lilyball
Copy link
Contributor

lilyball commented Apr 7, 2014

Ah hah, ok then, sounds good.

@huonw
Copy link
Member

huonw commented Apr 8, 2014

Previously, if statements of the form "Foo;" or "let _ = Foo;" were encountered
where Foo didn't have a destructor, the destructors were not run

Is this a typo? It seems that Foo not having a destructor is a very sensible reason to not run any destructors?

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
@alexcrichton
Copy link
Member Author

@huonw, indeed! Thanks for pointing that out.

bors added a commit that referenced this pull request Apr 16, 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 #4734
Closes #6892
@bors bors closed this Apr 16, 2014
@bors bors merged commit 0cc257e into rust-lang:master Apr 16, 2014
@alexcrichton alexcrichton deleted the run-some-destructors branch April 21, 2014 16:42
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 18, 2022
Cast runnableEnv items to string

fix rust-lang#13390

An alternative approach could be raising an error if there is non string values.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 24, 2024
…rednet

Make it clearer that the suggestion is an alternative one

`needless_pass_by_value` sometimes suggest marking the concerned type as `Copy`. Adding a `or` before this suggestion makes it clearer that this is not the second part of the original suggestion, but an alternative one.

Inspired by a misunderstanding in rust-lang#13321

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants