borrowck: Keep returned path from best_blame_constraint() consistent#158877
Open
Enselic wants to merge 1 commit into
Open
borrowck: Keep returned path from best_blame_constraint() consistent#158877Enselic wants to merge 1 commit into
path from best_blame_constraint() consistent#158877Enselic wants to merge 1 commit into
Conversation
The function `fn best_blame_constraint()` returns a `Vec<OutlivesConstraint>` and a `BlameConstraint`. The `BlameConstraint` is really just a slimmed down version of an `OutlivesConstraint`. So we can remove `BlameConstraint` entirely and instead return `Vec<OutlivesConstraint>` and an index into that `Vec`. (Encapsulated in a struct for nice ergonomics.) To prepare for that, change the code to adjust `Vec<OutlivesConstraint>` in-place and return info about the adjusted element, rather than returning info for a newly created "fake" `OutlivesConstraint`.
Collaborator
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use Why was this reviewer chosen?The reviewer was selected based on:
|
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.
The function
fn best_blame_constraint()returns aVec<OutlivesConstraint>and aBlameConstraint. TheBlameConstraintis really just a slimmed down version of anOutlivesConstraint. So we can removeBlameConstraintentirely and instead returnVec<OutlivesConstraint>and an index into thatVec. (Encapsulated in a struct for nice ergonomics.)To prepare for that, change the code to adjust
Vec<OutlivesConstraint>in-place and return info about the adjusted element, rather than returning info for a newly created "fake"OutlivesConstraint.It is slightly sad that we make
pathmut, but I think we can live with that. Diagnostics tests will surely catch if someone messes up because of that.This takes us one step closer (this is commit 2 of 4) towards the end result illustrated in #158623.