1
Fork 0

Move late-bound arg type checks to resolve_bound_vars

This commit is contained in:
Michael Goulet 2023-02-18 03:28:43 +00:00
parent fded2e95ab
commit cec7835d7a
10 changed files with 171 additions and 87 deletions

View file

@ -3,6 +3,7 @@
use crate::ty;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::def_id::DefId;
use rustc_hir::{ItemLocalId, OwnerId};
use rustc_macros::HashStable;
@ -13,6 +14,7 @@ pub enum ResolvedArg {
EarlyBound(/* decl */ DefId),
LateBound(ty::DebruijnIndex, /* late-bound index */ u32, /* decl */ DefId),
Free(DefId, /* lifetime decl */ DefId),
Error(ErrorGuaranteed),
}
/// A set containing, at most, one known element.

View file

@ -149,6 +149,9 @@ impl<'tcx> Const<'tcx> {
ty::ConstKind::Bound(debruijn, ty::BoundVar::from_u32(index)),
ty,
)),
Some(rbv::ResolvedArg::Error(guar)) => {
Some(tcx.const_error_with_guaranteed(ty, guar))
}
arg => bug!("unexpected bound var resolution for {:?}: {arg:?}", expr.hir_id),
}
}