1
Fork 0

Rollup merge of #125597 - compiler-errors:early-binder, r=jackh726

Uplift `EarlyBinder` into `rustc_type_ir`

We also need to give `EarlyBinder` a `'tcx` param, so that we can carry the `Interner` in the `EarlyBinder` too. This is necessary because otherwise we have an unconstrained `I: Interner` parameter in many of the `EarlyBinder`'s inherent impls.

I also generally think that this is desirable to have, in case we later want to track some state in the `EarlyBinder`.

r? lcnr
This commit is contained in:
Guillaume Gomez 2024-05-27 13:10:36 +02:00 committed by GitHub
commit a9c125f864
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 786 additions and 705 deletions

View file

@ -398,10 +398,10 @@ impl<'a, 'tcx> visit::Visitor<'a, 'tcx> for IsThirPolymorphic<'a, 'tcx> {
}
/// Builds an abstract const, do not use this directly, but use `AbstractConst::new` instead.
fn thir_abstract_const(
tcx: TyCtxt<'_>,
fn thir_abstract_const<'tcx>(
tcx: TyCtxt<'tcx>,
def: LocalDefId,
) -> Result<Option<ty::EarlyBinder<ty::Const<'_>>>, ErrorGuaranteed> {
) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
if !tcx.features().generic_const_exprs {
return Ok(None);
}

View file

@ -77,7 +77,7 @@ fn defaultness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Defaultness {
fn adt_sized_constraint<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: DefId,
) -> Option<ty::EarlyBinder<Ty<'tcx>>> {
) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
if let Some(def_id) = def_id.as_local() {
if let ty::Representability::Infinite(_) = tcx.representability(def_id) {
return None;
@ -253,7 +253,7 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
fn self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
tcx: TyCtxt<'_>,
def_id: DefId,
) -> Option<EarlyBinder<Ty<'_>>> {
) -> Option<EarlyBinder<'_, Ty<'_>>> {
let impl_ =
tcx.impl_trait_header(def_id).unwrap_or_else(|| bug!("called on inherent impl {def_id:?}"));