Misc fixes (pattern type lowering, cfi, pretty printing)
This commit is contained in:
parent
a454da3b1c
commit
56092a345b
4 changed files with 36 additions and 40 deletions
|
@ -2160,17 +2160,18 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
}
|
||||
_ => (expr, None),
|
||||
};
|
||||
let c = match &expr.kind {
|
||||
let (c, c_ty) = match &expr.kind {
|
||||
hir::ExprKind::Lit(lit) => {
|
||||
let lit_input =
|
||||
LitToConstInput { lit: &lit.node, ty, neg: neg.is_some() };
|
||||
match tcx.lit_to_const(lit_input) {
|
||||
let ct = match tcx.lit_to_const(lit_input) {
|
||||
Ok(c) => c,
|
||||
Err(LitToConstError::Reported(err)) => {
|
||||
ty::Const::new_error(tcx, err)
|
||||
}
|
||||
Err(LitToConstError::TypeError) => todo!(),
|
||||
}
|
||||
};
|
||||
(ct, ty)
|
||||
}
|
||||
|
||||
hir::ExprKind::Path(hir::QPath::Resolved(
|
||||
|
@ -2188,20 +2189,20 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
.type_of(def_id)
|
||||
.no_bound_vars()
|
||||
.expect("const parameter types cannot be generic");
|
||||
self.lower_const_param(expr.hir_id)
|
||||
let ct = self.lower_const_param(expr.hir_id);
|
||||
(ct, ty)
|
||||
}
|
||||
|
||||
_ => {
|
||||
let err = tcx
|
||||
.dcx()
|
||||
.emit_err(crate::errors::NonConstRange { span: expr.span });
|
||||
ty::Const::new_error(tcx, err)
|
||||
(ty::Const::new_error(tcx, err), Ty::new_error(tcx, err))
|
||||
}
|
||||
};
|
||||
// THISPR
|
||||
self.record_ty(expr.hir_id, todo!(), expr.span);
|
||||
self.record_ty(expr.hir_id, c_ty, expr.span);
|
||||
if let Some((id, span)) = neg {
|
||||
self.record_ty(id, todo!(), span);
|
||||
self.record_ty(id, c_ty, span);
|
||||
}
|
||||
c
|
||||
};
|
||||
|
|
|
@ -143,10 +143,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
// `trait_object_dummy_self`, so check for that.
|
||||
let references_self = match pred.skip_binder().term.unpack() {
|
||||
ty::TermKind::Ty(ty) => ty.walk().any(|arg| arg == dummy_self.into()),
|
||||
ty::TermKind::Const(c) => {
|
||||
// THISPR
|
||||
false
|
||||
}
|
||||
// FIXME(associated_const_equality): We should walk the const instead of not doing anything
|
||||
ty::TermKind::Const(_) => false,
|
||||
};
|
||||
|
||||
// If the projection output contains `Self`, force the user to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue