Equate fn outputs when inferring RPITIT hidden types#101614
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 10, 2022
Merged
Equate fn outputs when inferring RPITIT hidden types#101614bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Member
|
It's interesting. This is a place where a higher-ranked for<'a> &'a str probably makes sense. I'm trying to imagine what else we could expect this to be. 'static str obviously "works", but could be limiting if there are multiple hidden types. But maybe it's right because it's in the function signature, i.e. we're saying exactly what this signature is. Anyways, this hack is fine for now. r=me with this issue linked in the comment |
b969cd9 to
022e3fe
Compare
Contributor
Author
|
@bors r=jackh726 |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 10, 2022
Rollup of 6 pull requests Successful merges: - rust-lang#101578 (remove bound var hack in `resolve`) - rust-lang#101606 (doc: fix minor typo) - rust-lang#101614 (Equate fn outputs when inferring RPITIT hidden types) - rust-lang#101631 (rustdoc: avoid cleaning modules with duplicate names) - rust-lang#101635 (Move `Queries::new` out of the macro) - rust-lang#101641 (Update browser-ui-test version to 0.9.8) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Merged
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When we are trying to infer the hidden types for RPITITs, we need to equate the output tys instead of just subtyping them. For example:
If we just subtype the signatures
fn() -> &'static str <: fn() -> _#1t(where_#1tis the variable we've used to inferimpl Sized), we'll end up&'static str <: _#1t, which causes us to infer_#1t = #'_#2r str, where'_#2ris unconstrained, which gets fixed up toReEmpty, and which is certainly not what we want.I can't actually think of a way to make this fail to compile, because during borrowck we've already done the method probe, and so we just look at the
implmethod signature and see the&'static strany time we call<() as Foo>::bar(). But this does cause the ICE here in @jackh726's "Remove ReEmpty" PR (#98559) to stop ICEing, because after that PR we were leaking unconstrained region variables into the typeck results.r? types