-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Added mGCA related tests #150886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added mGCA related tests #150886
Conversation
|
rustbot has assigned @JonathanBrouwer. Use |
9327183 to
5218021
Compare
|
r? BoxyUwU |
28c9775 to
51da0b7
Compare
| impl<T: Abc> A for T { | ||
| #[type_const] | ||
| const VALUE: usize = 0; | ||
| } | ||
|
|
||
| trait S<const K: usize> {} | ||
|
|
||
| trait Handler<T: Abc> | ||
| where | ||
| (): S<{ <T as A>::VALUE }>, | ||
| { | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICE was also reproduced in code like this.
|
Thanks for your quick check! I'll add more tests to address the resolved mGCA ICE issue. @rustbot author |
I can't reproduce it on playground |
If I pull the latest main locally and then run this test, I get an ICE. //! regression test for <https://github.com/rust-lang/rust/issues/138226>
//! and <https://github.com/rust-lang/rust/issues/138227>
#![expect(incomplete_features)]
#![feature(min_generic_const_args)]
#![feature(inherent_associated_types)]
#![allow(dead_code)]
struct Foo<A, B>(A, B);
impl<A, B> Foo<A, B> {
#[type_const]
const VALUE: usize = 4;
fn foo() {
let _ = [5; Self::VALUE];
}
}
struct Bar<const N: usize>;
impl<const N: usize> Bar<N> {
#[type_const]
const VALUE: usize = 4;
fn bar() {
let _ = [0; Self::VALUE];
}
}
fn main() {}Backtrace
|
|
It seems like it wasn't reflected in playground nightly because it was a very recent work. |
Seems like it, would be nice if you could bisect it (I would be able to do this myself, but only little bit later) |
Failed to find with bisect rustc, I'll wait a bit and try again. |
51da0b7 to
66c81b9
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. |
This comment has been minimized.
This comment has been minimized.
66c81b9 to
b88fa37
Compare
|
This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
|
I don't know why ICE occurred when the test code was in
|
b88fa37 to
73f03e6
Compare
This comment has been minimized.
This comment has been minimized.
73f03e6 to
0474916
Compare
|
Added tests for five resolved issues and four crash tests. @rustbot ready |
|
I guessed it was related to debug assert since ICE is reproduced in rustc 1.94.0-dev but not in rustc 1.94.0-nightly. So, to verify that the ICE currently occurring in rustc-dev was indeed eliminated in nightly-2025-05-05, I checked out the last commit from 2025-05-05 and ran |
| @@ -0,0 +1,14 @@ | |||
| //! regression test for <https://github.com/rust-lang/rust/issues/143506> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still ways to reproduce this ICE unfortunately, can you remove this test.
| #![feature(min_generic_const_args)] | ||
|
|
||
| fn foo<T>() { | ||
| [0; size_of::<*mut T>()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a second line for [0; const { size_of::<*mut T>() }]
| @@ -0,0 +1,11 @@ | |||
| //! regression test for <https://github.com/rust-lang/rust/issues/143358> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this bug was only ever reproducible via generic_const_exprs as it relied on anon consts inheriting generics from parent defs (and then those parent defs being broken defids from mGCA).
cc #148843
I would prefer to remove this test but still close the issue as I don't think we get much value from having more test coverage for generic_const_exprs
| @@ -0,0 +1,26 @@ | |||
| //! regression test for <https://github.com/rust-lang/rust/issues/139259> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still ICEs can you remove this test
0474916 to
6166b61
Compare
|
thank you for the review. I've deleted the tests you mentioned. |

Add regression tests for subsequent mGCA tasks
edit:
resolve: #147415
tests\ui\const-generics\mgca\size-of-generic-ptr-in-array-len.rsresolve: #141014
tests\ui\const-generics\mgca\assoc-const-projection-in-bound.rsand crashes: 138226, 138226-2, 149809, 150960