-
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
Const generic defaults ICE: No bound vars found #93647
Comments
Seems to also happen with closures: struct X<const N: usize = {
|| {}
}>; |
I got a fix for this one I think. @rustbot claim |
even worse, this compiles on beta but shouldn't struct Foo<'a, const N: usize = {
let x: &'a ();
3
}>(&'a ()); |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-critical |
… r=lcnr Resolve lifetimes for const generic defaults We weren't visiting the const generic default argument in `rustc_resolve::late::lifetimes`. This seems to fix the issue, and we deny any non-`'static` lifetimes anyways. Fixes rust-lang#93647
I think this needs to remain open until the fix is beta-backported 🤔 not 100% sure on procedure here |
You might be correct. At least that's what happened last time one of my PRs was backport nominated (here), though I'm not sure if that was due to that being a regression on stable. Regardless, thanks for reopening this. |
@compiler-errors that's my understading, too. I /think/ issues that are pending a beta/stable backport (like this one) will stay open until the corresponding backport PR has landed. For completeness, backports are discussed every Thursday during the compiler team weekly meeting (happening on Zulip). Anyway, thanks a lot for fixing this issue and also to @DutchGhost + @lcnr for reporting and debugging :) |
Copied from Zulip: Question/thought: Is this a case where tracking bound vars got in the way? Or did it actually help uncover a potential bug? |
Not sure what you mean. The bug was that we were just not doing lifetime name resolution at all on const generic defaults. Like this code compiles on beta: struct X<const N: usize = {
let x: &'a String; 1
}>; edit: ohhh, you mean |
I guess this example shows that this did help us uncover a bug, but kind of indirectly: #93647 (comment) This just didn't uncover a case where "lost" bound vars. |
this is now fixed on beta |
Const generic defaults are being stabilized, #90207.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: