Add regression test for closure in array-length const generic - #159850
Conversation
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @tiif (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
why edition 2021 was chosed for this test? |
2021 was an arbitrary decision, it seems 2018 edition is the min edition that the test can use, thanks for the catch. |
8cd5fd4 to
51fb937
Compare
| async fn foo<const N: usize>() { | ||
| let _data = &mut [0u8; { N + (|| 42)() }]; | ||
| //~^ ERROR overly complex generic constant | ||
| //~| ERROR cannot call non-const closure in constants | ||
| } |
There was a problem hiding this comment.
The ICE can only be reproduced when it is async fn foo<'a>(), we will need to use the test written in the issue.
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
async fn foo<'a>() {
let _data = &mut [0u8; { N + (|| 42)() }];
}
fn main() {}There was a problem hiding this comment.
Thanks, switched to the async fn foo<'a>() from the issue, now errors with E0425
A closure inside an array-length constant in a generic async function used to ICE with "expected type of closure to be a closure"; it now emits ordinary errors. Add a regression test locking that in.
51fb937 to
e62c86f
Compare
|
Thanks! @bors r+ rollup |
…uwer Rollup of 11 pull requests Successful merges: - #158460 (Remove llvm_enzyme feature outside of bootstrap) - #159509 (Generate `valid_range`s for enums sign-agnostically) - #159632 (CFI: Add support for the adt_const_params feature) - #159671 (Add semver check test command for checking API compatibility of stdlib) - #157058 (Rustdoc label badge for notable traits) - #159717 (Add `-Zimplicit-sysroot-deps`) - #159850 (Add regression test for closure in array-length const generic) - #159994 (Show jobs where a given test was executed in `test-dashboard`) - #160110 (convert rustc_hir::Target inherent methods to From impls) - #160123 (add additional license option for third-party dependencies) - #160131 (bootstrap: remove temporary bors email lookup)
…uwer Rollup of 11 pull requests Successful merges: - #158460 (Remove llvm_enzyme feature outside of bootstrap) - #159509 (Generate `valid_range`s for enums sign-agnostically) - #159632 (CFI: Add support for the adt_const_params feature) - #159671 (Add semver check test command for checking API compatibility of stdlib) - #157058 (Rustdoc label badge for notable traits) - #159717 (Add `-Zimplicit-sysroot-deps`) - #159850 (Add regression test for closure in array-length const generic) - #159994 (Show jobs where a given test was executed in `test-dashboard`) - #160110 (convert rustc_hir::Target inherent methods to From impls) - #160123 (add additional license option for third-party dependencies) - #160131 (bootstrap: remove temporary bors email lookup)
Rollup merge of #159850 - zakrad:regr-test-closure-array-len, r=tiif Add regression test for closure in array-length const generic Adds a regression test for #119316 The MCVE (a closure inside an array-length const in a generic async fn) used to ICE with "expected type of closure to be a closure". It's since been fixed and just emits ordinary errors now, so this adds a UI test to lock that in. Closes #119316
Adds a regression test for #119316
The MCVE (a closure inside an array-length const in a generic async fn)
used to ICE with "expected type of closure to be a closure". It's since
been fixed and just emits ordinary errors now, so this adds a UI test to
lock that in.
Closes #119316