-
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
Closure type error during const-eval (array len context) #66706
Comments
@jonas-schievink , I experimented a little further. Generators are not needed anymore, so that label can be removed :) |
Another version of this is: fn bug() {
[0; [|&_: _ &_| {}; 0 ].len()]
} A quick look in Godbolt gives that this ICE's since 1.24 |
You can omit that last
|
Posting here, since the code looks verry similar. However, the message from the ICE is different, but I guess they have the same cause? Feel free to move it to its own place if needed :) fn bug() {
[0; match [|f @ &ref _| () ] {} ]
} Backtrace:
|
Things changed slightly from 342c5f3: No longer ICEs: fn bug() {
[0; [|f @ &ref _| {} ; 0 ].len() ];
} fn bug() {
[0; [|_: _ &_| ()].len()]
} Still ICEs: fn bug() {
[0; [|&_: _ &_| {}; 0 ].len()]
} fn bug() {
[0; match [|f @ &ref _| () ] {} ]
} |
@Alexendoo Would you be game to add the two cases no longer ICEing as tests in a PR? |
Yeah no problem, I'll get on that tomorrow |
Add regression test for rust-lang#66706 Adds the two cases that no longer ICE (rust-lang#66706 (comment))
Rollup of 5 pull requests Successful merges: - rust-lang#69644 (Remove framework in `dataflow/mod.rs` in favor of "generic" one) - rust-lang#69936 (Fix cycle error when emitting suggestion for mismatched `fn` type) - rust-lang#70048 (Allow obtaining &mut OsStr) - rust-lang#70344 (Decouple `rustc_hir::print` into `rustc_hir_pretty`) - rust-lang#70435 (Add regression test for rust-lang#66706) Failed merges: r? @ghost
I think the reason these doesn't ICE anymore is a bug, the ICE itself wasn't fixed. I'm guessing what's happening is #69981 introduced a bug, hiding the ICEs, as some of these cases no longer fail during type-checking, but with my changes, they do again. I've just looked at the debug log and this is fascinating: I believe what's happening is, because there are inference variables, this gets hit, but the rust/src/librustc_typeck/check/writeback.rs Lines 639 to 646 in 6c19a10
So we end up with |
The following code ICE's on stable, beta and nightly
Backtrace:
The text was updated successfully, but these errors were encountered: