Uh oh!
There was an error while loading. Please reload this page.
typeck: Fix const generic in repeat param ICE. - #61698
Conversation
Uh oh!
There was an error while loading. Please reload this page.
0efc78c to
cdcb7e6CompareUh oh!
There was an error while loading. Please reload this page.
cdcb7e6 to
2a3e004CompareUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Could we also have a test where we make sure that this does the right thing? E.g. pass in N explicitly and check the return value.
There was a problem hiding this comment.
I've added another test. It will error later in the compiler with a "array lengths can't depend on generic parameters" error, emitted when creating the HAIR. From a quick look, it appears that the MIR/HAIR data structures all contain a u64 for the count, so it isn't trivial to change one or two lines and make this work, probably best left for a follow-up (which I'd be interested in trying to tackle). It's an improvement over an ICE in any case.
There was a problem hiding this comment.
Ah, okay. Yes, this is certainly better than an ICE, and this gives us a good minimal example to fix. Let's open an issue for it after this is merged.
Uh oh!
There was an error while loading. Please reload this page.
This commit fixes an ICE that occured when a const generic was used in a repeat expression. This was due to the code expecting the length of the repeat expression to be const evaluatable to a constant, but a const generic parameter is not (however, it can be made into a constant).
2a3e004 to
9ed4674Comparevarkor
commented
Jun 10, 2019
@bors r+ |
bors
commented
Jun 10, 2019
📌 Commit 9ed4674 has been approved by |
… r=varkor typeck: Fix const generic in repeat param ICE. Fixesrust-lang#61336. Turns out this wasn't related to rust-lang#49147 after all. r? @varkor
… r=varkor typeck: Fix const generic in repeat param ICE. Fixesrust-lang#61336. Turns out this wasn't related to rust-lang#49147 after all. r? @varkor
… r=varkor typeck: Fix const generic in repeat param ICE. Fixesrust-lang#61336. Turns out this wasn't related to rust-lang#49147 after all. r? @varkor
Rollup of 11 pull requests Successful merges: - #61518 (Add loops to doc list of things not stable in const fn) - #61526 (move some tests into subfolders) - #61550 (Windows 10 SDK is also required now.) - #61606 (Remove some legacy proc macro flavors) - #61652 (Mention slice patterns in array) - #61686 (librustc_errors: Add some more documentation) - #61698 (typeck: Fix const generic in repeat param ICE.) - #61707 (Azure: retry failed awscli installs) - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone) - #61724 (core: use memcmp optimization for 128 bit integer slices) - #61726 (Use `for_each` in `Iterator::partition`) Failed merges: r? @ghost
Rollup of 11 pull requests Successful merges: - #61518 (Add loops to doc list of things not stable in const fn) - #61526 (move some tests into subfolders) - #61550 (Windows 10 SDK is also required now.) - #61606 (Remove some legacy proc macro flavors) - #61652 (Mention slice patterns in array) - #61686 (librustc_errors: Add some more documentation) - #61698 (typeck: Fix const generic in repeat param ICE.) - #61707 (Azure: retry failed awscli installs) - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone) - #61724 (core: use memcmp optimization for 128 bit integer slices) - #61726 (Use `for_each` in `Iterator::partition`) Failed merges: r? @ghost
This commit extends the work in rust-lang#61698 to get the `DefId` of const parameters from block that resolve to a const parameter (as well as const parameters directly, as it was previously).
Fixes#61336. Turns out this wasn't related to #49147 after all.
r? @varkor