error on unsized AnonConsts#151874
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Implementation looks good, just being nitpicky about the tests :3
Putting issue numbers in the test names tends to be unidiomatic as it isn't useful information when reading the test anme (same with ice). Can you rename the tests something like unsized-anon-consts-err-1, unsized-anon-consts-err-2 etc.
Can you then add a comment to each test saying "regression test for issue #137582, where XYZ would happen resulting in ICEs". Also can you move the tests to tests/ui/const-generics/adt-const-params that'll make it easier to find them again when approaching stabilization :3
|
@rustbot author |
|
oh also the rebase thing from rustbot 😌 |
|
Reminder, once the PR becomes ready for a review, use |
e96f2f1 to
c7c3266
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
From my days working on Roslyn and Spidermonkey, compiler development is 90% tests - feels good to be back working on compilers ✨ @rustbot ready |
|
@bors r+ rollup thanks :3 |
…r=BoxyUwU error on unsized AnonConsts The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE. Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in rust-lang#137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented. That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry! There are three relevant github issues to this ICE that I could find: - fixes rust-lang#137582 - fixes rust-lang#151591 The similar issue rust-lang#104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much) r? @BoxyUwU
…r=BoxyUwU error on unsized AnonConsts The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE. Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in rust-lang#137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented. That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry! There are three relevant github issues to this ICE that I could find: - fixes rust-lang#137582 - fixes rust-lang#151591 The similar issue rust-lang#104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much) r? @BoxyUwU
…r=BoxyUwU error on unsized AnonConsts The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE. Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in rust-lang#137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented. That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry! There are three relevant github issues to this ICE that I could find: - fixes rust-lang#137582 - fixes rust-lang#151591 The similar issue rust-lang#104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much) r? @BoxyUwU
…r=BoxyUwU error on unsized AnonConsts The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE. Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in rust-lang#137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented. That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry! There are three relevant github issues to this ICE that I could find: - fixes rust-lang#137582 - fixes rust-lang#151591 The similar issue rust-lang#104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much) r? @BoxyUwU
…uwer Rollup of 13 pull requests Successful merges: - #152034 (Show largest job duration changes in hours and minutes in the post-merge report) - #152039 (coverage: Add a test case for a previously-unknown span mismatch) - #152045 (Convert to inline diagnostics in `rustc_infer`) - #149263 (Forbid manual `Unpin` impls for structurally pinned types) - #151754 (Check proj's parent is trait or not when checking dyn compatibility) - #151848 (Port `rustc_mir` to attribute parser) - #151874 (error on unsized AnonConsts) - #151944 (Convert to inline diagnostics in `rustc_attr_parsing`) - #152012 (Use `DEVELOPER_DIR` instead of a custom `xcode-select` script) - #152019 (`NativeLib` cleanups) - #152029 (disable socket tests in Miri) - #152041 (Convert to inline diagnostics in `rustc_query_system`) - #152050 (Try to fix `rustdoc-gui/globals.goml` flakyness) Failed merges: - #152046 (Use glob imports for attribute parsers)
…uwer Rollup of 12 pull requests Successful merges: - #152034 (Show largest job duration changes in hours and minutes in the post-merge report) - #152039 (coverage: Add a test case for a previously-unknown span mismatch) - #152045 (Convert to inline diagnostics in `rustc_infer`) - #149263 (Forbid manual `Unpin` impls for structurally pinned types) - #151754 (Check proj's parent is trait or not when checking dyn compatibility) - #151848 (Port `rustc_mir` to attribute parser) - #151874 (error on unsized AnonConsts) - #151944 (Convert to inline diagnostics in `rustc_attr_parsing`) - #152019 (`NativeLib` cleanups) - #152029 (disable socket tests in Miri) - #152041 (Convert to inline diagnostics in `rustc_query_system`) - #152050 (Try to fix `rustdoc-gui/globals.goml` flakyness) Failed merges: - #152046 (Use glob imports for attribute parsers)
…uwer Rollup of 12 pull requests Successful merges: - #152034 (Show largest job duration changes in hours and minutes in the post-merge report) - #152039 (coverage: Add a test case for a previously-unknown span mismatch) - #152045 (Convert to inline diagnostics in `rustc_infer`) - #149263 (Forbid manual `Unpin` impls for structurally pinned types) - #151754 (Check proj's parent is trait or not when checking dyn compatibility) - #151848 (Port `rustc_mir` to attribute parser) - #151874 (error on unsized AnonConsts) - #151944 (Convert to inline diagnostics in `rustc_attr_parsing`) - #152019 (`NativeLib` cleanups) - #152029 (disable socket tests in Miri) - #152041 (Convert to inline diagnostics in `rustc_query_system`) - #152050 (Try to fix `rustdoc-gui/globals.goml` flakyness) Failed merges: - #152046 (Use glob imports for attribute parsers)
Rollup merge of #151874 - khyperia:error-unsized-anonconst, r=BoxyUwU error on unsized AnonConsts The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE. Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in #137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented. That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry! There are three relevant github issues to this ICE that I could find: - fixes #137582 - fixes #151591 The similar issue #104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much) r? @BoxyUwU
The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE.
Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in #137582. There is no checking for
#![feature(unsized_const_params)]which should eventually revert this check when the feature becomes more implemented.That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry!
There are three relevant github issues to this ICE that I could find:
assertion failed: layout.is_sized()withfeature(adt_const_params)#137582The similar issue #104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much)
r? @BoxyUwU