Skip to content

promote placeholder bounds to 'static obligations #98713

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

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Jun 30, 2022

In NLL, when we are promoting a bound out from a closure, if we have a requirement that T: 'a where 'a is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to 'static, since universes are not expressible across closure boundaries.

Fixes #98693

(Marking as WIP because I'm still running tests, haven't add the new test, etc)

r? @jackh726

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 30, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 30, 2022
In NLL, when we are promoting a bound out from a closure,
if we have a requirement that `T: 'a` where `'a` is in a
higher universe, we were previously ignoring that, which is
totally wrong. We should be promoting those constraints to `'static`,
since universes are not expressible across closure boundaries.
@nikomatsakis nikomatsakis changed the title WIP: promote placeholder bounds to 'static obligations promote placeholder bounds to 'static obligations Jun 30, 2022
@jackh726
Copy link
Member

I do somewhat worried that by explicitly "promoting" these types of bounds to T: 'static, we run into problems if we later want to make these bounds behave like for<'a> where<T: 'a> T: 'a. But I think if we are going to, this change wouldn't be the one, or the only, problem.

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 10, 2022

📌 Commit 7fda862 has been approved by jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2022
@jackh726
Copy link
Member

Nominating for beta backport. Small change that fixes an unsound issue.

@jackh726 jackh726 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 10, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 10, 2022
promote placeholder bounds to 'static obligations

In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries.

Fixes rust-lang#98693

~~(Marking as WIP because I'm still running tests, haven't add the new test, etc)~~

r? `@jackh726`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 10, 2022
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#98713 (promote placeholder bounds to 'static obligations)
 - rust-lang#99094 (Remove extra space in AtomicPtr::new docs)
 - rust-lang#99095 (Remove duplicate notes from error on inter-crate ambiguous impl of traits)
 - rust-lang#99114 (Group .test-arrow CSS rules and fix rgb/rgba property)
 - rust-lang#99128 (Fix `download-ci-llvm` NixOS patching for binaries)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2cb7d1c into rust-lang:master Jul 11, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 11, 2022
@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jul 14, 2022
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.64.0, 1.63.0 Jul 15, 2022
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 15, 2022
@Mark-Simulacrum Mark-Simulacrum mentioned this pull request Jul 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 16, 2022
…ulacrum

[beta] rollup

*  Fix sized check ICE in asm check rust-lang#99124
*  Windows: Fallback for overlapped I/O rust-lang#98950
*  promote placeholder bounds to 'static obligations rust-lang#98713
*  Create fresh lifetime parameters for bare fn trait too rust-lang#98637

r? `@Mark-Simulacrum`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NLL and closures: higher-ranked lifetime bounds are not enforced in type tests
7 participants