-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
fix(ty_utils): try normalize earsing regions #111259
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR description really needs more information about:
- Why it happens
- Why this fix is correct
Thanks for your advice, I will try to add more descriptions |
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
@@ -90,6 +90,7 @@ declare_lint_pass!(QueryStability => [POTENTIAL_QUERY_INSTABILITY]); | |||
impl LateLintPass<'_> for QueryStability { | |||
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { | |||
let Some((span, def_id, substs)) = typeck_results_of_method_fn(cx, expr) else { return }; | |||
let substs = cx.tcx.normalize_erasing_regions(cx.param_env, substs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for #105561
@@ -380,6 +381,7 @@ declare_lint_pass!(Diagnostics => [ UNTRANSLATABLE_DIAGNOSTIC, DIAGNOSTIC_OUTSID | |||
impl LateLintPass<'_> for Diagnostics { | |||
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { | |||
let Some((span, def_id, substs)) = typeck_results_of_method_fn(cx, expr) else { return }; | |||
let substs = cx.tcx.normalize_erasing_regions(cx.param_env, substs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for #105561
@rustbot ready |
generic_const_exprs currently evaluates constants without their where clauses holding, resulting in us attempting to do things like this on not-wf code. I do not think this PR is the correct solution to the linked issue, we really ought to be ensuring that Unfortunately it is not possible right now to "just" check |
☔ The latest upstream changes (presumably #113591) made this pull request unmergeable. Please resolve the merge conflicts. |
@bvanjoi any updates on this? thanks |
Closed this as it is invalid. |
close #110630
#105561 introduces
normalize_erasing_regions
for thesubsts
inresolve_instance
, this is quite general and can apply to any type. However, it poses a problem for issue #110630, whereI as Concat
will trigger a bug becauseConcat
is not implemented forI
.In order to solve #110630, this PR:
substs
when necessary.substs
before resolve duringconst_eval_resolve_for_typeck
, if it failed, we will returnTooGeneric
error