1
Fork 0

Deal with fallout

This commit is contained in:
Boxy 2023-07-04 15:41:45 +01:00
parent 8ac3ffe834
commit 62174bfe72
17 changed files with 47 additions and 29 deletions

View file

@ -278,7 +278,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
// Arrays give us `[]`, `[{ty}; _]` and `[{ty}; N]`
if let ty::Array(aty, len) = self_ty.kind() {
flags.push((sym::_Self, Some("[]".to_string())));
let len = len.kind().try_to_value().and_then(|v| v.try_to_target_usize(self.tcx));
let len = len.try_to_value().and_then(|v| v.try_to_target_usize(self.tcx));
flags.push((sym::_Self, Some(format!("[{}; _]", aty))));
if let Some(n) = len {
flags.push((sym::_Self, Some(format!("[{}; {}]", aty, n))));

View file

@ -528,7 +528,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
debug!("equating consts:\nc1= {:?}\nc2= {:?}", c1, c2);
use rustc_hir::def::DefKind;
use ty::ConstKind::Unevaluated;
use ty::Unevaluated;
match (c1.kind(), c2.kind()) {
(Unevaluated(a), Unevaluated(b))
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>

View file

@ -897,7 +897,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
);
use rustc_hir::def::DefKind;
use ty::ConstKind::Unevaluated;
use ty::Unevaluated;
match (c1.kind(), c2.kind()) {
(Unevaluated(a), Unevaluated(b))
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>