Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e3f01b2

Browse files
never type is const Drop
1 parent ba87be0 commit e3f01b2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
932932
| ty::Bound(..)
933933
| ty::Param(_)
934934
| ty::Placeholder(_)
935-
| ty::Never
936935
| ty::Foreign(_)
937936
| ty::Projection(_) => {
938937
// We don't know if these are `~const Drop`, at least
@@ -951,6 +950,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
951950
| ty::Ref(..)
952951
| ty::FnDef(..)
953952
| ty::FnPtr(_)
953+
| ty::Never
954954
| ty::Array(..)
955955
| ty::Slice(_)
956956
| ty::Closure(..)

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11031103
let tcx = self.tcx();
11041104
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
11051105

1106+
// Skip binder here (*)
11061107
let nested_tys = match *self_ty.skip_binder().kind() {
11071108
ty::Bool
11081109
| ty::Char
@@ -1116,7 +1117,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11161117
| ty::Ref(..)
11171118
| ty::FnDef(..)
11181119
| ty::FnPtr(_)
1119-
| ty::Projection(_) => vec![],
1120+
| ty::Never => vec![],
11201121

11211122
ty::Adt(def, substs) => def.all_fields().map(|f| f.ty(tcx, substs)).collect(),
11221123

@@ -1138,8 +1139,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11381139
| ty::Bound(_, _)
11391140
| ty::Param(_)
11401141
| ty::Placeholder(_)
1141-
| ty::Never
11421142
| ty::Foreign(_)
1143+
| ty::Projection(_)
11431144
| ty::Infer(_) => {
11441145
unreachable!();
11451146
}
@@ -1165,6 +1166,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11651166
obligation.param_env,
11661167
cause.clone(),
11671168
obligation.recursion_depth + 1,
1169+
// Rebinding here (*)
11681170
self_ty
11691171
.rebind(ty::TraitPredicate {
11701172
trait_ref: ty::TraitRef {

0 commit comments

Comments
 (0)