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

stop replacing bivariant args with 'static when computing closure requirements #133798

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Dec 3, 2024

It is unnecessary, these get constrained when checking that the opaque type is well-formed.

It also results in the opaque type no longer being well formed. If you've got fn foo<'a>() -> impl Sized + 'a the opaque is type Opaque<'a, 'aDummy> where 'a: 'aDummy, 'aDummy: 'a where 'aDummy is bivariant. If we call foo::<'b>() inside of a closure and its return type ends up in a type test, we start out with the WF Opaque<'b, 'b>, and then replace the bivariant 'b with 'static. Opaque<'b, 'static> is no longer well-formed. Given how these type tests are used, I don't think this caused any practical issues.

r? types

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 3, 2024
@lcnr lcnr added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Dec 3, 2024
lcnr added 2 commits December 3, 2024 14:07
It is unnecessary, these get constrained when checking that the
opaque type is well-formed.

It also results in the opaque type no longer being well formed.
If you've got `fn foo<'a>() -> impl Sized + 'a` the opaque is
`type Opaque<'a, 'aDummy> where 'a: 'aDummy, 'aDummy: 'a` where
`'aDummy`  is bivariant. If we call `foo::<'b>()`  inside of a closure
and its return type ends up in a type test, we start out with the WF
`Opaque<'b, 'b>`, and then replace the bivariant `'b` with `'static`.
`Opaque<'b, 'static>`  is no longer well-formed. Given how these type
tests are used, I don't think this caused any practical issues.
@lcnr lcnr force-pushed the nested-bodies-opaques branch from 8770c77 to 65d0b5d Compare December 3, 2024 13:07
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the nested-bodies-opaques branch from 79f9f89 to 1c96ddd Compare December 3, 2024 16:26
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 3, 2024

📌 Commit 1c96ddd has been approved by compiler-errors

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 Dec 3, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#133651 (Update `NonZero` and `NonNull` to not field-project (per MCP#807))
 - rust-lang#133764 (rustdoc: Rename `set_back_info` to `restore_module_data`.)
 - rust-lang#133784 (Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans)
 - rust-lang#133798 (stop replacing bivariant args with `'static` when computing closure requirements)
 - rust-lang#133804 (Improve code for FileName retrieval in rustdoc)
 - rust-lang#133817 (Use `eprintln` instead of `println` in bootstrap/compiletest/tidy)

Failed merges:

 - rust-lang#133810 (remove unnecessary `eval_verify_bound`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9fd0972 into rust-lang:master Dec 4, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2024
Rollup merge of rust-lang#133798 - lcnr:nested-bodies-opaques, r=compiler-errors

stop replacing bivariant args with `'static` when computing closure requirements

It is unnecessary, these get constrained when checking that the opaque type is well-formed.

It also results in the opaque type no longer being well formed. If you've got `fn foo<'a>() -> impl Sized + 'a` the opaque is `type Opaque<'a, 'aDummy> where 'a: 'aDummy, 'aDummy: 'a` where `'aDummy`  is bivariant. If we call `foo::<'b>()`  inside of a closure and its return type ends up in a type test, we start out with the WF `Opaque<'b, 'b>`, and then replace the bivariant `'b` with `'static`. `Opaque<'b, 'static>` is no longer well-formed. Given how these type tests are used, I don't think this caused any practical issues.

r? types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants