diff options
| author | Michael Goulet <michael@errs.io> | 2022-01-19 00:40:05 -0800 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-01-19 00:40:05 -0800 |
| commit | e3f01b2b6ff177359504e42a99665a8abc388cb7 (patch) | |
| tree | 29dd9880b1c500e979dafad45fe26818e92662d0 | |
| parent | ba87be05cfa8f9a02d673a64aa2ee83976d80e60 (diff) | |
| download | rust-e3f01b2b6ff177359504e42a99665a8abc388cb7.tar.gz rust-e3f01b2b6ff177359504e42a99665a8abc388cb7.zip | |
never type is const Drop
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/confirmation.rs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 20297518a59..77db3bd2692 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -932,7 +932,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | 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 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | ty::Ref(..) | ty::FnDef(..) | ty::FnPtr(_) + | ty::Never | ty::Array(..) | ty::Slice(_) | ty::Closure(..) diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 9d62614031c..35aebd9900f 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -1103,6 +1103,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { 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 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | 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 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | ty::Bound(_, _) | ty::Param(_) | ty::Placeholder(_) - | ty::Never | ty::Foreign(_) + | ty::Projection(_) | ty::Infer(_) => { unreachable!(); } @@ -1165,6 +1166,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { obligation.param_env, cause.clone(), obligation.recursion_depth + 1, + // Rebinding here (*) self_ty .rebind(ty::TraitPredicate { trait_ref: ty::TraitRef { |
