-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: "encountered errors lowering pattern: [ConstEval(ConstEvalErr { ... kind: NonConstPath })]" #43250
Comments
One possible cause is #42886 . cc @durka @petrochenkov |
cc @rust-lang/compiler |
Also cc @eddyb specifically, looks CTFE related. |
What's surprising is that there's no name resolution error. Patterns shouldn't be able to refer to variables, even when there's macro treachery afoot. |
Why would there be a name-resolution error? You can reach this in stable with range patterns, but you get an error from const-checking which prevents the ICE. Maybe we should const-check literals too? fn main() {
let y: usize = 1;
let 0...y = 1; //~ ERROR constant evaluation error
} |
We solved this in name resolution in other situations, didn't we? Like, if you have an array length that's a variable in scope. |
@alexcrichton We don't agree on the solution. IMO name resolution should not see variables in scope from that position, only constant items. |
Hm ok, I guess in that sense this is a reminder that 1.20 is released in less than 3 weeks now, so the clock is ticking for getting some solution into the compiler. |
Since rust-lang#42886, macros can create "nonstandard" PatKind::Lit patterns, that contain path expressions instead of the usual literal expr. These can cause trouble, including ICEs. We *could* map these nonstandard patterns to PatKind::Path patterns during HIR lowering, but that would be much effort for little gain, and I think is too risky for beta. So let's just forbid them during AST validation. Fixes rust-lang#43250.
ast_validation: forbid "nonstandard" literal patterns Since #42886, macros can create "nonstandard" PatKind::Lit patterns, that contain path expressions instead of the usual literal expr. These can cause trouble, including ICEs. We *could* map these nonstandard patterns to PatKind::Path patterns during HIR lowering, but that would be much effort for little gain, and I think is too risky for beta. So let's just forbid them during AST validation. Fixes #43250. beta-nominating because regression. r? @eddyb
Since rust-lang#42886, macros can create "nonstandard" PatKind::Lit patterns, that contain path expressions instead of the usual literal expr. These can cause trouble, including ICEs. We *could* map these nonstandard patterns to PatKind::Path patterns during HIR lowering, but that would be much effort for little gain, and I think is too risky for beta. So let's just forbid them during AST validation. Fixes rust-lang#43250.
Following (wrong) code gives an error on beta 1.19 and stable 1.18, but ICEs on current nightly:
The error (expected behaviour):
The ICE message (new behaviour):
Nightly (soon beta) regression. Bisected using rust-bisect to #42964 (7acce37).
The text was updated successfully, but these errors were encountered: