Skip to content

[DO NOT MERGE] Forbid closures that outlive their signature #60332

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

Conversation

matthewjasper
Copy link
Contributor

  • This prevents the AST borrow checker from incorrectly accepting
    closures that return references to local variables and that are never
    called. Note: NLL already fixes this.
  • This also ensures that existential types don't end up containing
    any ReScopes. This is the principled solution to Nightly rustc crashes with "unexpected region in query response" #57464.

Opening this for a crater run to see how much code this affects.

The second issue occurs twice in this repo:

  • src/librustc_metadata/decoder.rs
  • src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs

* This prevents the AST borrow checker from incorrectly accepting
closures that return references to local variables and that are never
called.
* This also ensures that existential types don't end up containing
any `ReScope`s
@rust-highfive
Copy link
Contributor

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 27, 2019
@matthewjasper
Copy link
Contributor Author

r? @ghost

@matthewjasper
Copy link
Contributor Author

@bors try

@bors
Copy link
Collaborator

bors commented Apr 27, 2019

⌛ Trying commit 054ffe1 with merge 6f91e1b...

bors added a commit that referenced this pull request Apr 27, 2019
[DO NOT MERGE] Forbid closures that outlive their signature

* This prevents the AST borrow checker from incorrectly accepting
closures that return references to local variables and that are never
called. Note: NLL already fixes this.
* This also ensures that existential types don't end up containing
any `ReScope`s. This is the principled solution to #57464.

Opening this for a crater run to see how much code this affects.

The second issue occurs twice in this repo:
* `src/librustc_metadata/decoder.rs`
*  `src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs`
@bors
Copy link
Collaborator

bors commented Apr 27, 2019

☀️ Try build successful - checks-travis
Build commit: 6f91e1b

@matthewjasper
Copy link
Contributor Author

@craterbot run start=master#d4a32d504a5aa49b951bfc70602a9615cb772acf end=try#6f91e1b1f1477b82616e3cd142d5d528acf8518c mode=check-only

@craterbot
Copy link
Collaborator

👌 Experiment pr-60332 created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 27, 2019
@craterbot
Copy link
Collaborator

🚧 Experiment pr-60332 is now running on agent aws-3-tmp.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-60332 is completed!
📊 2495 regressed and 1 fixed (60951 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 29, 2019
@matthewjasper
Copy link
Contributor Author

Ok, looks like this isn't a viable change.

@matthewjasper matthewjasper deleted the closure-outlive-signature branch May 1, 2019 19:44
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants