-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE: type mismatch comparing repeat and repeat #45044
Comments
I think there is no one working on this issue yet, so can I work on this? |
@ysiraichi I agree nobody is working on this issue yet. =) I can try to leave a few tips. Maybe you can take some of these steps first. It'd be good to know where the type error arises, first off. I'd run the compiler with Second, the "unreachable pattern" message seems a bit strange. This no doubt arises -- in part -- because of the way that we handle constants in patterns. In short, the cc @oli-obk -- have you been looking at this code lately? have any tips? |
Yes I have touched this code very recently, it will be fixed by #46882 |
Replace all const evaluation with miri * error reporting in constants prints a stacktrace through all called const fns * Trivial constant propagation and folding in MIR (always active, irrelevant of the optimization level) * can now use floating constants in patterns (previously only floating point literals were allowed) * the future compat lint is still produced for both cases * can index into constant arrays during const eval (previously feature gated) * can create a constant union value with field `a` and read from field `b` * can dereference references into constants * can create references inside constants (`const X: &u32 = &22`) * Tuple struct constructors can be used in constants * regression in const eval errors spans (some of these need improvements in mir debug info) * can cast floats to ints and vice versa (in constants, and even nan/inf constants) * Mir dump prints false/true instead of 0u8/1u8 * `1i8 >> [8][0]` does not lint about exceeding bitshifts anymore. * Needs const propagation across projections * `foo[I]` produces a const eval lint if `foo: [T; N]` and `N < I` * Essentially all builtin panics produce lints if they can be statically proven to trigger at runtime. This is on a best effort basis, so there might be some complex cases that don't trigger. (The runtime panic stays there, irrelevant of whether the lint is produced or not) fixes #34997 (stack overflow with many constants) fixes #25574 (deref byte strings in patterns) fixes #27918 (broken mir ICE) fixes #46114 (ICE on struct constructors in patterns) fixes #37448 (`SomeStruct { foo } as SomeStruct`) fixes #43754 (`return` in const fn) fixes #41898 (tuple struct constructors) fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit) closes #29947 (const indexing stabilization) fixes #45044 (pattern matching repeat expressions) r? @eddyb
Replace all const evaluation with miri * error reporting in constants prints a stacktrace through all called const fns * Trivial constant propagation and folding in MIR (always active, irrelevant of the optimization level) * can now use floating constants in patterns (previously only floating point literals were allowed) * the future compat lint is still produced for both cases * can index into constant arrays during const eval (previously feature gated) * can create a constant union value with field `a` and read from field `b` * can dereference references into constants * can create references inside constants (`const X: &u32 = &22`) * Tuple struct constructors can be used in constants * regression in const eval errors spans (some of these need improvements in mir debug info) * can cast floats to ints and vice versa (in constants, and even nan/inf constants) * Mir dump prints false/true instead of 0u8/1u8 * `1i8 >> [8][0]` does not lint about exceeding bitshifts anymore. * Needs const propagation across projections * `foo[I]` produces a const eval lint if `foo: [T; N]` and `N < I` * Essentially all builtin panics produce lints if they can be statically proven to trigger at runtime. This is on a best effort basis, so there might be some complex cases that don't trigger. (The runtime panic stays there, irrelevant of whether the lint is produced or not) * can use `union`s to implement `transmute` for `Copy` types in constants without a feature gate. With all the greatness and nasal demons that come with this. fixes #34997 (stack overflow with many constants) fixes #25574 (deref byte strings in patterns) fixes #27918 (broken mir ICE) fixes #46114 (ICE on struct constructors in patterns) fixes #37448 (`SomeStruct { foo } as SomeStruct`) fixes #43754 (`return` in const fn) fixes #41898 (tuple struct constructors) fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit) closes #29947 (const indexing stabilization) fixes #45044 (pattern matching repeat expressions) fixes #47971 (ICE on const fn + references) r? @eddyb
Replace all const evaluation with miri * error reporting in constants prints a stacktrace through all called const fns * Trivial constant propagation and folding in MIR (always active, irrelevant of the optimization level) * can now use floating constants in patterns (previously only floating point literals were allowed) * the future compat lint is still produced for both cases * can index into constant arrays during const eval (previously feature gated) * can create a constant union value with field `a` and read from field `b` * can dereference references into constants * can create references inside constants (`const X: &u32 = &22`) * Tuple struct constructors can be used in constants * regression in const eval errors spans (some of these need improvements in mir debug info) * can cast floats to ints and vice versa (in constants, and even nan/inf constants) * Mir dump prints false/true instead of 0u8/1u8 * `1i8 >> [8][0]` does not lint about exceeding bitshifts anymore. * Needs const propagation across projections * `foo[I]` produces a const eval lint if `foo: [T; N]` and `N < I` * Essentially all builtin panics produce lints if they can be statically proven to trigger at runtime. This is on a best effort basis, so there might be some complex cases that don't trigger. (The runtime panic stays there, irrelevant of whether the lint is produced or not) * can use `union`s to implement `transmute` for `Copy` types in constants without a feature gate. With all the greatness and nasal demons that come with this. * can convert integers to `&'static T` in constants (useful for embedded) fixes #34997 (stack overflow with many constants) fixes #25574 (deref byte strings in patterns) fixes #27918 (broken mir ICE) fixes #46114 (ICE on struct constructors in patterns) fixes #37448 (`SomeStruct { foo } as SomeStruct`) fixes #43754 (`return` in const fn) fixes #41898 (tuple struct constructors) fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit) closes #29947 (const indexing stabilization) fixes #45044 (pattern matching repeat expressions) fixes #47971 (ICE on const fn + references) fixes #48081 (ICE on cyclic assoc const error) fixes #48746 (nonhelpful error message with unions) r? @eddyb even though 1k loc are added in tests, this PR reduces the loc in this repository by 700
Replace all const evaluation with miri * error reporting in constants prints a stacktrace through all called const fns * Trivial constant propagation and folding in MIR (always active, irrelevant of the optimization level) * can now use floating constants in patterns (previously only floating point literals were allowed) * the future compat lint is still produced for both cases * can index into constant arrays during const eval (previously feature gated) * can create a constant union value with field `a` and read from field `b` * can dereference references into constants * can create references inside constants (`const X: &u32 = &22`) * Tuple struct constructors can be used in constants * regression in const eval errors spans (some of these need improvements in mir debug info) * can cast floats to ints and vice versa (in constants, and even nan/inf constants) * Mir dump prints false/true instead of 0u8/1u8 * `1i8 >> [8][0]` does not lint about exceeding bitshifts anymore. * Needs const propagation across projections * `foo[I]` produces a const eval lint if `foo: [T; N]` and `N < I` * Essentially all builtin panics produce lints if they can be statically proven to trigger at runtime. This is on a best effort basis, so there might be some complex cases that don't trigger. (The runtime panic stays there, irrelevant of whether the lint is produced or not) * can use `union`s to implement `transmute` for `Copy` types in constants without a feature gate. With all the greatness and nasal demons that come with this. * can convert integers to `&'static T` in constants (useful for embedded) fixes #34997 (stack overflow with many constants) fixes #25574 (deref byte strings in patterns) fixes #27918 (broken mir ICE) fixes #46114 (ICE on struct constructors in patterns) fixes #37448 (`SomeStruct { foo } as SomeStruct`) fixes #43754 (`return` in const fn) fixes #41898 (tuple struct constructors) fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit) closes #29947 (const indexing stabilization) fixes #45044 (pattern matching repeat expressions) fixes #47971 (ICE on const fn + references) fixes #48081 (ICE on cyclic assoc const error) fixes #48746 (nonhelpful error message with unions) r? @eddyb even though 1k loc are added in tests, this PR reduces the loc in this repository by 700
STR
Expected Result
code compiles and runs
Actual Result
The text was updated successfully, but these errors were encountered: