Annotate some more bugs
This commit is contained in:
parent
70b9dad3dc
commit
1cc0d7d56c
9 changed files with 24 additions and 26 deletions
|
@ -640,7 +640,9 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
|
|||
}
|
||||
DefKind::Closure if coroutine_kind.is_some() => {
|
||||
let coroutine_ty = tcx.type_of(def_id).instantiate_identity();
|
||||
let ty::Coroutine(_, args, _) = coroutine_ty.kind() else { bug!() };
|
||||
let ty::Coroutine(_, args, _) = coroutine_ty.kind() else {
|
||||
bug!("expected type of coroutine-like closure to be a coroutine")
|
||||
};
|
||||
let args = args.as_coroutine();
|
||||
let yield_ty = args.yield_ty();
|
||||
let return_ty = args.return_ty();
|
||||
|
@ -648,7 +650,9 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
|
|||
}
|
||||
DefKind::Closure => {
|
||||
let closure_ty = tcx.type_of(def_id).instantiate_identity();
|
||||
let ty::Closure(_, args) = closure_ty.kind() else { bug!() };
|
||||
let ty::Closure(_, args) = closure_ty.kind() else {
|
||||
bug!("expected type of closure to be a closure")
|
||||
};
|
||||
let args = args.as_closure();
|
||||
let sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), args.sig());
|
||||
let self_ty = match args.kind() {
|
||||
|
|
|
@ -782,7 +782,7 @@ impl<'tcx> Cx<'tcx> {
|
|||
hir::ExprKind::Tup(fields) => ExprKind::Tuple { fields: self.mirror_exprs(fields) },
|
||||
|
||||
hir::ExprKind::Yield(v, _) => ExprKind::Yield { value: self.mirror_expr(v) },
|
||||
hir::ExprKind::Err(_) => unreachable!(),
|
||||
hir::ExprKind::Err(_) => unreachable!("cannot lower a `hir::ExprKind::Err` to THIR"),
|
||||
};
|
||||
|
||||
Expr { temp_lifetime, ty: expr_ty, span: expr.span, kind }
|
||||
|
|
|
@ -492,8 +492,9 @@ impl<'tcx> ConstToPat<'tcx> {
|
|||
PatKind::Constant { value: mir::Const::Ty(ty::Const::new_value(tcx, cv, ty)) }
|
||||
}
|
||||
ty::FnPtr(..) => {
|
||||
// Valtree construction would never succeed for these, so this is unreachable.
|
||||
unreachable!()
|
||||
unreachable!(
|
||||
"Valtree construction would never succeed for FnPtr, so this is unreachable."
|
||||
)
|
||||
}
|
||||
_ => {
|
||||
let err = InvalidPattern { span, non_sm_ty: ty };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue