NLL: User type annotations refactor, associated constant patterns and ref bindings.#55937
Merged
bors merged 11 commits intorust-lang:masterfrom Jan 1, 2019
Merged
NLL: User type annotations refactor, associated constant patterns and ref bindings.#55937bors merged 11 commits intorust-lang:masterfrom
bors merged 11 commits intorust-lang:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
861c01e to
711599a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
052aedc to
c3a9f4d
Compare
This comment has been minimized.
This comment has been minimized.
nikomatsakis
approved these changes
Nov 20, 2018
Contributor
nikomatsakis
left a comment
There was a problem hiding this comment.
Looks great! Left one nit.
r=me once tests passed and comment is added
ef8f048 to
5069d62
Compare
Member
Author
|
Pushed the first version of this that does what it says on the tin. Will need a fresh review as a lot has changed. |
This comment has been minimized.
This comment has been minimized.
5069d62 to
d27f344
Compare
This comment has been minimized.
This comment has been minimized.
Member
Author
|
Added a fix for #55511 to this PR. Still seeing an ICE on three tests for the original fix, worked out that is due to this addition: But without that addition, the test change in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bde1f0d to
874ebbe
Compare
Member
Author
|
Added a fix for #55401 too. Yet to look into the failures for the original PR issue. |
e73bf75 to
9cacc0c
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
|
I filed #57280, as this seems like a bug (and a regression). |
Xanewok
added a commit
to rust-lang/rls
that referenced
this pull request
Jan 2, 2019
Xanewok
added a commit
to Xanewok/rust
that referenced
this pull request
Jan 2, 2019
Breakage was due to rust-lang#55937, which seemed to introduce a regression (tracked over at rust-lang#57280).
Closed
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 5, 2019
Changes: ```` Update Clippy Move TestFailures when collecting failures Update languageserver-types to 0.51.1 update clippy hash and rustc_tools_util and use rustc_tools_util from crates.io Work around rust-lang#55937 Update Clippy... again Update Clippy Update clippy ````
bors
added a commit
that referenced
this pull request
Jan 5, 2019
submodules: update clippy and rls Fixes clippy toolstate Changes: ```` Update to latest compiletest-rs release add testcase for #3462 deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case... rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version UI test cleanup: Extract ifs_same_cond tests UI test cleanup: Extract for_kv_map lint tests Fix test for #57250 Limit infinite_iter collect() check to known types Some improvements to util documentation Use hashset for name blacklist Reformat random_state tests Use node_id_to_type_opt instead of node_it_to_type in random_state Check pattern equality while checking declaration equality random_state lint Use an FxHashSet for valid idents in documentation lint Fix suggestion for unnecessary_ref lint Update CONTRIBUTING.md for rustfix tests Update .fixed files via update-references.sh Run rustfix on first UI test Use WIP branch for compiletest_rs ```` Also updates RLS and removes the patching of rustc_tool_utils from cargo.toml RLS changes: ```` update clippy hash and rustc_tools_util and use rustc_tools_util from crates.io Work around #55937 Update Clippy... again Update Clippy Update clippy ```` r? @oli-obk
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 7, 2019
Changes: ```` Update Clippy Move TestFailures when collecting failures Update languageserver-types to 0.51.1 update clippy hash and rustc_tools_util and use rustc_tools_util from crates.io Work around rust-lang#55937 Update Clippy... again Update Clippy Update clippy ````
bors
added a commit
that referenced
this pull request
Jan 7, 2019
submodules: update clippy and rls Fixes clippy toolstate Changes: ```` Update to latest compiletest-rs release add testcase for #3462 deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case... rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version UI test cleanup: Extract ifs_same_cond tests UI test cleanup: Extract for_kv_map lint tests Fix test for #57250 Limit infinite_iter collect() check to known types Some improvements to util documentation Use hashset for name blacklist Reformat random_state tests Use node_id_to_type_opt instead of node_it_to_type in random_state Check pattern equality while checking declaration equality random_state lint Use an FxHashSet for valid idents in documentation lint Fix suggestion for unnecessary_ref lint Update CONTRIBUTING.md for rustfix tests Update .fixed files via update-references.sh Run rustfix on first UI test Use WIP branch for compiletest_rs ```` Also updates RLS and removes the patching of rustc_tool_utils from cargo.toml RLS changes: ```` update clippy hash and rustc_tools_util and use rustc_tools_util from crates.io Work around #55937 Update Clippy... again Update Clippy Update clippy ```` r? @oli-obk
davidtwco
added a commit
to davidtwco/rust
that referenced
this pull request
Feb 6, 2019
This commit fixes a bug introduced by rust-lang#55937 which started checking user type annotations for associated type patterns. Where lowering a associated constant expression would previously return a `PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType` with a `PatternKind::Constant` inside, this commit unwraps that to access the constant pattern inside and behaves as before.
bors
added a commit
that referenced
this pull request
Feb 8, 2019
Lower constant patterns with ascribed types. Fixes #57960. This PR fixes a bug introduced by #55937 which started checking user type annotations for associated type patterns. Where lowering a associated constant expression would previously return a `PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType` with a `PatternKind::Constant` inside, this PR unwraps that to access the constant pattern inside and behaves as before. r? @pnkfelix
emilyalbini
pushed a commit
to emilyalbini/rust
that referenced
this pull request
Feb 17, 2019
This commit fixes a bug introduced by rust-lang#55937 which started checking user type annotations for associated type patterns. Where lowering a associated constant expression would previously return a `PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType` with a `PatternKind::Constant` inside, this commit unwraps that to access the constant pattern inside and behaves as before.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 23, 2025
mir_build: Avoid some useless work when visiting "primary" bindings While looking over `visit_primary_bindings`, I noticed that it does a bunch of extra work to build up a collection of “user-type projections”, even though 2/3 of its call sites don't even use them. Those callers can get the same result via `thir::Pat::walk_always`. (And it turns out that doing so also avoids creating some redundant user-type entries in MIR for some binding constructs.) I also noticed that even when the user-type projections *are* used, the process of building them ends up eagerly cloning some nested vectors at every recursion step, even in cases where they won't be used because the current subpattern has no bindings. To avoid this, the visit method now assembles a linked list on the stack containing the information that *would* be needed to create projections, and only creates the concrete projections as needed when a primary binding is encountered. Some relevant prior PRs: - rust-lang#55274 - rust-lang@0bfe184 in rust-lang#55937
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Mar 17, 2025
mir_build: Avoid some useless work when visiting "primary" bindings While looking over `visit_primary_bindings`, I noticed that it does a bunch of extra work to build up a collection of “user-type projections”, even though 2/3 of its call sites don't even use them. Those callers can get the same result via `thir::Pat::walk_always`. (And it turns out that doing so also avoids creating some redundant user-type entries in MIR for some binding constructs.) I also noticed that even when the user-type projections *are* used, the process of building them ends up eagerly cloning some nested vectors at every recursion step, even in cases where they won't be used because the current subpattern has no bindings. To avoid this, the visit method now assembles a linked list on the stack containing the information that *would* be needed to create projections, and only creates the concrete projections as needed when a primary binding is encountered. Some relevant prior PRs: - rust-lang#55274 - rust-lang@0bfe184 in rust-lang#55937 --- There should be no user-visible change in compiler output.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 17, 2025
Rollup merge of rust-lang#137465 - Zalathar:visit-primary, r=oli-obk mir_build: Avoid some useless work when visiting "primary" bindings While looking over `visit_primary_bindings`, I noticed that it does a bunch of extra work to build up a collection of “user-type projections”, even though 2/3 of its call sites don't even use them. Those callers can get the same result via `thir::Pat::walk_always`. (And it turns out that doing so also avoids creating some redundant user-type entries in MIR for some binding constructs.) I also noticed that even when the user-type projections *are* used, the process of building them ends up eagerly cloning some nested vectors at every recursion step, even in cases where they won't be used because the current subpattern has no bindings. To avoid this, the visit method now assembles a linked list on the stack containing the information that *would* be needed to create projections, and only creates the concrete projections as needed when a primary binding is encountered. Some relevant prior PRs: - rust-lang#55274 - rust-lang@0bfe184 in rust-lang#55937 --- There should be no user-visible change in compiler output.
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.
Fixes #55511 and Fixes #55401. Contributes to #54943.
This PR performs a large refactoring on user type annotations, checks user type annotations for associated constants in patterns and that user type annotations for
refbindings are respected.r? @nikomatsakis