Attempt to normalize FnDef signature in InferCtxt::cmp#100473
Merged
bors merged 5 commits intorust-lang:masterfrom Aug 30, 2022
Merged
Attempt to normalize FnDef signature in InferCtxt::cmp#100473bors merged 5 commits intorust-lang:masterfrom
FnDef signature in InferCtxt::cmp#100473bors merged 5 commits intorust-lang:masterfrom
Conversation
Contributor
|
(rust-highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
r? diagnostics (or maybe @rust-lang/types?) |
3a5a285 to
818de76
Compare
Member
|
Here is a real world use case where this would have been enormously helpful: https://mobile.twitter.com/joshuayn514/status/1557913836337786880 |
lcnr
reviewed
Aug 13, 2022
Contributor
|
I'm r+ on this, but want to make sure another pair of eyes looks at this r? rust-lang/types |
818de76 to
7292a63
Compare
7292a63 to
e5602cb
Compare
Contributor
Author
|
Added @bors r=lcnr |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 30, 2022
Rollup of 5 pull requests Successful merges: - rust-lang#99517 (Display raw pointer as *{mut,const} T instead of *-ptr in errors) - rust-lang#99928 (Do not leak type variables from opaque type relation) - rust-lang#100473 (Attempt to normalize `FnDef` signature in `InferCtxt::cmp`) - rust-lang#100653 (Move the cast_float_to_int fallback code to GCC) - rust-lang#100941 (Point at the string inside literal and mention if we need string inte…) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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.
Stashes a normalization callback in
InferCtxtso that the signature we get fromtcx.fn_sig(..).subst(..)inInferCtxt::cmpcan be properly normalized, since we cannot expect for it to have normalized types since it comes straight from astconv.This is kind of a hack, but I will say that @jyn514 found the fact that we present unnormalized types to be very confusing in real life code, and I agree with that feeling. Though altogether I am still a bit unsure about whether this PR is worth the effort, so I'm open to alternatives and/or just closing it outright.
On the other hand, this isn't a ridiculously heavy implementation anyways -- it's less than a hundred lines of changes, and half of that is just miscellaneous cleanup.
This is stacked onto #100471 which is basically unrelated, and it can be rebased off of that when that lands or if needed.
The code:
Before:
After: