Annotate some bugs
This commit is contained in:
parent
96df494340
commit
70b9dad3dc
34 changed files with 295 additions and 197 deletions
|
@ -103,15 +103,19 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
}
|
||||
|
||||
// We don't expect `TyVar` or `Fresh*` vars at this point with lazy norm.
|
||||
(
|
||||
ty::Alias(..),
|
||||
ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)),
|
||||
)
|
||||
| (
|
||||
ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)),
|
||||
ty::Alias(..),
|
||||
) if self.next_trait_solver() => {
|
||||
bug!()
|
||||
(ty::Alias(..), ty::Infer(ty::TyVar(_))) | (ty::Infer(ty::TyVar(_)), ty::Alias(..))
|
||||
if self.next_trait_solver() =>
|
||||
{
|
||||
bug!(
|
||||
"We do not expect to encounter `TyVar` this late in combine \
|
||||
-- they should have been handled earlier"
|
||||
)
|
||||
}
|
||||
(_, ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)))
|
||||
| (ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)), _)
|
||||
if self.next_trait_solver() =>
|
||||
{
|
||||
bug!("We do not expect to encounter `Fresh` variables in the new solver")
|
||||
}
|
||||
|
||||
(_, ty::Alias(..)) | (ty::Alias(..), _) if self.next_trait_solver() => {
|
||||
|
|
|
@ -232,7 +232,9 @@ fn ty_to_string<'tcx>(
|
|||
/// something users are familiar with. Directly printing the `fn_sig` of closures also
|
||||
/// doesn't work as they actually use the "rust-call" API.
|
||||
fn closure_as_fn_str<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
||||
let ty::Closure(_, args) = ty.kind() else { unreachable!() };
|
||||
let ty::Closure(_, args) = ty.kind() else {
|
||||
bug!("cannot convert non-closure to fn str in `closure_as_fn_str`")
|
||||
};
|
||||
let fn_sig = args.as_closure().sig();
|
||||
let args = fn_sig
|
||||
.inputs()
|
||||
|
|
|
@ -375,7 +375,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
err.span_note(span, "the lifetime requirement is introduced here");
|
||||
err
|
||||
} else {
|
||||
unreachable!()
|
||||
unreachable!(
|
||||
"control flow ensures we have a `BindingObligation` or `ExprBindingObligation` here..."
|
||||
)
|
||||
}
|
||||
}
|
||||
infer::Subtype(box trace) => {
|
||||
|
|
|
@ -247,7 +247,9 @@ where
|
|||
let (a, b) = match (a.kind(), b.kind()) {
|
||||
(&ty::Alias(ty::Opaque, ..), _) => (a, generalize(b, false)?),
|
||||
(_, &ty::Alias(ty::Opaque, ..)) => (generalize(a, true)?, b),
|
||||
_ => unreachable!(),
|
||||
_ => unreachable!(
|
||||
"expected at least one opaque type in `relate_opaques`, got {a} and {b}."
|
||||
),
|
||||
};
|
||||
let cause = ObligationCause::dummy_with_span(self.delegate.span());
|
||||
let obligations = self
|
||||
|
@ -707,7 +709,9 @@ where
|
|||
),
|
||||
// FIXME(deferred_projection_equality): Implement this when we trigger it.
|
||||
// Probably just need to do nothing here.
|
||||
ty::Variance::Bivariant => unreachable!(),
|
||||
ty::Variance::Bivariant => {
|
||||
unreachable!("cannot defer an alias-relate goal with Bivariant variance (yet?)")
|
||||
}
|
||||
})]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,7 +203,9 @@ pub(super) fn compute_alias_components_recursive<'tcx>(
|
|||
out: &mut SmallVec<[Component<'tcx>; 4]>,
|
||||
visited: &mut SsoHashSet<GenericArg<'tcx>>,
|
||||
) {
|
||||
let ty::Alias(kind, alias_ty) = alias_ty.kind() else { bug!() };
|
||||
let ty::Alias(kind, alias_ty) = alias_ty.kind() else {
|
||||
unreachable!("can only call `compute_alias_components_recursive` on an alias type")
|
||||
};
|
||||
let opt_variances = if *kind == ty::Opaque { tcx.variances_of(alias_ty.def_id) } else { &[] };
|
||||
for (index, child) in alias_ty.args.iter().enumerate() {
|
||||
if opt_variances.get(index) == Some(&ty::Bivariant) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue