mGCA: error on region vars lowering #157188
Conversation
|
HIR ty lowering was modified cc @fmease |
|
Failed to set assignee to
|
|
@rustbot reroll |
This comment has been minimized.
This comment has been minimized.
985d72e to
f946610
Compare
This comment has been minimized.
This comment has been minimized.
f946610 to
f81a763
Compare
|
r? BoxyUwU |
|
I expect that a similar case should be possible without |
60f92d8 to
e52b714
Compare
|
Is that what you meant? I found a case with |
|
it seems that EDIT: ofc there is. Removed the gcpt case |
e52b714 to
fa51726
Compare
|
I actually am somewhat confused here, I thought that the #![feature(generic_const_parameter_types, adt_const_params, const_param_ty_unchecked)]
fn evil<T, const R: T>() {}
fn foo<const N: usize>() {
evil::<&u32, { &1_u32 }>();
}what's the difference in expected types of the |
|
@rustbot author |
Your example is correct in terms of it containing region var, but it being caught by existing check: rust/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Lines 2313 to 2314 in 4f8ea98 , because gcpt enabled and const having free regions. Does that make sense? @rustbot ready |
|
hmm, what I meant is why does the ICEing example not get caught by that existing check. it too should have free regions in the type. i got confused before though and I realise now it's jsut because the check for this stuff only happens under gcpt but mgca also allows for gcpts implicitly. I also realise now there's operator precedence jank at play in this diff 😅 : if tcx.features().generic_const_parameter_types()
&& (ty.has_free_regions() || ty.has_erased_regions())
|| ty.has_infer_regions()
{is actually if (tcx.features().generic_const_parameter_types()
&& (ty.has_free_regions() || ty.has_erased_regions()))
|| ty.has_infer_regions()
{I think your original diff was fine- making it be ``if (mgca || gcpt) && (has_free_regions || has_erased_regions)` seems correct enough to me 🤔 |
This also needs to error on
min_generic_const_argsfeaturecc @BoxyUwU (didn't r her as she is unavailable rn)
Fixes #157147