never type is const Drop

This commit is contained in:
Michael Goulet 2022-01-19 00:40:05 -08:00
parent ba87be05cf
commit e3f01b2b6f
2 changed files with 5 additions and 3 deletions

View File

@ -932,7 +932,6 @@ fn assemble_const_drop_candidates(
| ty::Bound(..)
| ty::Param(_)
| ty::Placeholder(_)
| ty::Never
| ty::Foreign(_)
| ty::Projection(_) => {
// We don't know if these are `~const Drop`, at least
@ -951,6 +950,7 @@ fn assemble_const_drop_candidates(
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::Never
| ty::Array(..)
| ty::Slice(_)
| ty::Closure(..)

View File

@ -1103,6 +1103,7 @@ fn confirm_const_drop_candidate(
let tcx = self.tcx();
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
// Skip binder here (*)
let nested_tys = match *self_ty.skip_binder().kind() {
ty::Bool
| ty::Char
@ -1116,7 +1117,7 @@ fn confirm_const_drop_candidate(
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::Projection(_) => vec![],
| ty::Never => vec![],
ty::Adt(def, substs) => def.all_fields().map(|f| f.ty(tcx, substs)).collect(),
@ -1138,8 +1139,8 @@ fn confirm_const_drop_candidate(
| ty::Bound(_, _)
| ty::Param(_)
| ty::Placeholder(_)
| ty::Never
| ty::Foreign(_)
| ty::Projection(_)
| ty::Infer(_) => {
unreachable!();
}
@ -1165,6 +1166,7 @@ fn confirm_const_drop_candidate(
obligation.param_env,
cause.clone(),
obligation.recursion_depth + 1,
// Rebinding here (*)
self_ty
.rebind(ty::TraitPredicate {
trait_ref: ty::TraitRef {