Rollup merge of #142927 - compiler-errors:note-find-const, r=BoxyUwU

Add note to `find_const_ty_from_env`

Add a note to `find_const_ty_from_env` to explain why it has an `unwrap` which "often" causes ICEs.

Also, uplift it into the new trait solver. This avoids needing to go through the interner to call this method which is otherwise an inherent method in the compiler. I can remove this part if desired.

r? `@boxyuwu`
This commit is contained in:
Michael Goulet
2025-06-26 20:15:22 -04:00
committed by GitHub
10 changed files with 64 additions and 48 deletions

View File

@@ -37,7 +37,9 @@ pub(super) fn fulfillment_error_for_no_solution<'tcx>(
ty::ConstKind::Unevaluated(uv) => {
infcx.tcx.type_of(uv.def).instantiate(infcx.tcx, uv.args)
}
ty::ConstKind::Param(param_ct) => param_ct.find_ty_from_env(obligation.param_env),
ty::ConstKind::Param(param_ct) => {
param_ct.find_const_ty_from_env(obligation.param_env)
}
ty::ConstKind::Value(cv) => cv.ty,
kind => span_bug!(
obligation.cause.span,