Conversation
Changes the ad-hoc closure adjustment into using adjustment info instead of being separately driven from types, and likewise for autoderef. Also takes care of autoref (the cases we should be seeing in consts, at least, since we can't be doing method calls which would need the ref-to-vec mode), which didn't quite work right previously. However, "dereference" of a newtype isn't handled yet....
const-autoderef.rs is based on an example from jdm in IRC (but the quadruple-pointer part is entirely my fault).
bors
added a commit
that referenced
this pull request
Mar 12, 2013
These changes make const translation use adjustments (autodereference, autoreference, bare-fn-to-closure), like normal code does, replacing some ad-hoc logic that wasn't always right. As a convenient side-effect, explicit dereference (both of pointers and of newtypes) is also supported in const expressions. There is also a “bonus fix” for a bug in the pretty-printer exposed by one of the added tests.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 2, 2020
…=flip1995 Extend `redundant_clone` to the case that cloned value is not consumed Fixes rust-lang#5303. --- changelog: Extend `redundant_clone` to the case that cloned value is not consumed
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.
These changes make const translation use adjustments (autodereference, autoreference, bare-fn-to-closure), like normal code does, replacing some ad-hoc logic that wasn't always right.
As a convenient side-effect, explicit dereference (both of pointers and of newtypes) is also supported in const expressions.
There is also a “bonus fix” for a bug in the pretty-printer exposed by one of the added tests.