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

dropck: track order of destruction for r-value temporaries #22323

Closed
pnkfelix opened this issue Feb 14, 2015 · 10 comments · Fixed by #59114
Closed

dropck: track order of destruction for r-value temporaries #22323

pnkfelix opened this issue Feb 14, 2015 · 10 comments · Fixed by #59114
Labels
A-lifetimes Area: lifetime related A-NLL Area: Non Lexical Lifetimes (NLL) C-feature-request Category: A feature request, i.e: not implemented / a PR. NLL-fixed-by-NLL Bugs fixed, but only when NLL is enabled.

Comments

@pnkfelix
Copy link
Member

Spawned off of #21022, #21972; see also #21657.

Tracking order of destruction for r-value temporaries would (probably) allow us to resume writing code like this from RFC 769:

for line in old_io::stdin().lock().lines() {
    ...
}

which is currently disallowed because the region inference system does not know that the temporary yielded by stdin() will outlive the temporary from stdin().lock().

(But note that it might also have fallout, potentially worse than that of #21657)

@pnkfelix pnkfelix added A-lifetimes Area: lifetime related I-wishlist labels Feb 14, 2015
@pnkfelix
Copy link
Member Author

cc #22321

@steveklabnik
Copy link
Member

Triage: not aware of any changes here, but it's also not an area I'm super familiar with.

@pnkfelix
Copy link
Member Author

I assume MIR and non lexical lifetimes will likely resolve this directly

@Mark-Simulacrum Mark-Simulacrum added C-feature-request Category: A feature request, i.e: not implemented / a PR. and removed I-wishlist labels Jul 22, 2017
@pnkfelix
Copy link
Member Author

pnkfelix commented Jul 30, 2018

According to

error[E0597]: `y` does not live long enough
this does not appear to be fixed by NLL.

Update (circa September 2018): Oh, that test is an instance of #46413, not this.

@pnkfelix
Copy link
Member Author

(which is ... okay, but a little surprising, and perhaps worth investigation after we've taken care of the other bigger problems in NLL.)

@pnkfelix
Copy link
Member Author

I'm just going to throw in a reference to the NLL tracking issue #43234 in the hopes that we remember to look at this again later.

@pnkfelix
Copy link
Member Author

I just want to make two quick notes:

@pnkfelix
Copy link
Member Author

Putting onto the Release milestone in the hopes that this forces me to take action here.

@pnkfelix pnkfelix added this to the Rust 2018 Release milestone Sep 13, 2018
pnkfelix added a commit to pnkfelix/rust that referenced this issue Sep 19, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Sep 19, 2018

I investigated. NLL does fix the problem described in this issue.

My earlier comments regarding cases that don't work are instances of misclassification on my part; they should have been associated with #46413 and perhaps #21114

@pnkfelix pnkfelix added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Sep 19, 2018
@pnkfelix pnkfelix added NLL-fixed-by-NLL Bugs fixed, but only when NLL is enabled. and removed NLL-deferred labels Sep 19, 2018
bors added a commit that referenced this issue Sep 27, 2018
NLL: regression test for "dropck: track order of destruction for r-value temporaries"

Once this lands, we can remove the E-needstest from #22323.

(We shouldn't close the bug itself, however, because we are leaving the NLL-fixed-by-NLL bugs open until NLL is turned on by default.)
@KiChjang KiChjang removed the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Sep 27, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Nov 8, 2018

Visited for T-compiler triage. Removing NLL-fixed-by-NLL issues from the Release milestone, but continue to leave them open as issues themselves.

@pnkfelix pnkfelix removed this from the Rust 2018 Release milestone Nov 8, 2018
@pnkfelix pnkfelix removed their assignment Nov 9, 2018
bors added a commit that referenced this issue Mar 11, 2019
Enable NLL migrate mode on the 2015 edition

Blocked on #58739

## What is in this PR?

* Remove the `-Zborrowck=ast` flag option from rustc.
* The default in the 2015 edition is now `-Zborrowck=migrate`.
* The 2018 edition default is unchanged: it's still `-Zborrowck=migrate`.
* Enable the `-Ztwo-phase-borrows` flag on all editions.
* Remove most dead code that handled these options.
* Update tests for the above changes.

## What is *not* in this PR?

These are left for future PRs

* Use `-Zborrowck=mir` in NLL compare mode tests
* Remove the `-Zborrowck=compare` option
* Remove the `-Ztwo-phase-borrows` flag. It's kept so that perf.rlo has time to stop using it (cc @Mark-Simulacrum)
* Remove MIR typeck as its own MIR pass - it's now run by NLL.
* Enabling `-Zborrowck=mir` by default

Soundness issues that are fixed by NLL will stay open until full NLL is emitting hard errors. However, these diagnostics and completeness issues can now be closed:

Closes #18330
Closes #22323
Closes #23591
Closes #26736
Closes #27487
Closes #28092
Closes #28970
Closes #29733
Closes #30104
Closes #38915
Closes #39908
Closes #43407
Closes #47524
Closes #48540
Closes #49073
Closes #52614
Closes #55085
Closes #56093
Closes #56496
Closes #57804

cc #43234

r? @pnkfelix
cc @rust-lang/lang
cc @rust-lang/wg-compiler-nll
bors added a commit that referenced this issue Apr 22, 2019
Enable NLL migrate mode on the 2015 edition

## What is in this PR?

* Remove the `-Zborrowck=ast` flag option from rustc.
* The default in the 2015 edition is now `-Zborrowck=migrate`.
* The 2018 edition default is unchanged: it's still `-Zborrowck=migrate`.
* Enable two-phase borrows (currently toggled via the `-Ztwo-phase-borrows` flag) on all editions.
* Remove most dead code that handled these options.
* Update tests for the above changes.

## What is *not* in this PR?

These are left for future PRs

* Use `-Zborrowck=mir` in NLL compare mode tests (#56993)
* Remove the `-Zborrowck=compare` option (#59193)
* Remove the `-Ztwo-phase-borrows` flag. It's kept, as a flag that does nothing so that perf.rlo has time to stop using it (cc @Mark-Simulacrum)
* Remove MIR typeck as its own MIR pass - it's now run by NLL.
* Enabling `-Zborrowck=mir` by default (#58781)
* Replace `allow_bind_by_move_patterns_with_guards` and `check_for_mutation_in_guard_via_ast_walk` with just using the feature gate. (#59192)

Soundness issues that are fixed by NLL will stay open until full NLL is emitting hard errors. However, these diagnostics and completeness issues can now be closed:

Closes #18330
Closes #22323
Closes #23591
Closes #26736
Closes #27487
Closes #28092
Closes #28970
Closes #29733
Closes #30104
Closes #38915
Closes #39908
Closes #43407
Closes #47524
Closes #48540
Closes #49073
Closes #52614
Closes #55085
Closes #56093
Closes #56496
Closes #57804

cc #43234

r? @pnkfelix
cc @rust-lang/lang
cc @rust-lang/wg-compiler-nll
bors added a commit that referenced this issue Apr 22, 2019
Enable NLL migrate mode on the 2015 edition

## What is in this PR?

* Remove the `-Zborrowck=ast` flag option from rustc.
* The default in the 2015 edition is now `-Zborrowck=migrate`.
* The 2018 edition default is unchanged: it's still `-Zborrowck=migrate`.
* Enable two-phase borrows (currently toggled via the `-Ztwo-phase-borrows` flag) on all editions.
* Remove most dead code that handled these options.
* Update tests for the above changes.

## What is *not* in this PR?

These are left for future PRs

* Use `-Zborrowck=mir` in NLL compare mode tests (#56993)
* Remove the `-Zborrowck=compare` option (#59193)
* Remove the `-Ztwo-phase-borrows` flag. It's kept, as a flag that does nothing so that perf.rlo has time to stop using it (cc @Mark-Simulacrum)
* Remove MIR typeck as its own MIR pass - it's now run by NLL.
* Enabling `-Zborrowck=mir` by default (#58781)
* Replace `allow_bind_by_move_patterns_with_guards` and `check_for_mutation_in_guard_via_ast_walk` with just using the feature gate. (#59192)

Soundness issues that are fixed by NLL will stay open until full NLL is emitting hard errors. However, these diagnostics and completeness issues can now be closed:

Closes #18330
Closes #22323
Closes #23591
Closes #26736
Closes #27487
Closes #28092
Closes #28970
Closes #29733
Closes #30104
Closes #38915
Closes #39908
Closes #43407
Closes #47524
Closes #48540
Closes #49073
Closes #52614
Closes #55085
Closes #56093
Closes #56496
Closes #57804

cc #43234

r? @pnkfelix
cc @rust-lang/lang
cc @rust-lang/wg-compiler-nll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related A-NLL Area: Non Lexical Lifetimes (NLL) C-feature-request Category: A feature request, i.e: not implemented / a PR. NLL-fixed-by-NLL Bugs fixed, but only when NLL is enabled.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants