Skip to content

Commit 0d8f716

Browse files
committed
Review feedback: expand comment and simplify some code.
1 parent 85d2e4d commit 0d8f716

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/librustc_typeck/check/dropck.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,9 @@ enum DropckKind<'tcx> {
520520

521521
/// Assume all borrowed data access by dtor occurs as if Self has the
522522
/// type carried by this variant. In practice this means that some
523-
/// of the type parameters are remapped to `()`, because the developer
524-
/// has asserted that the destructor will not access their contents.
523+
/// of the type parameters are remapped to `()` (and some lifetime
524+
/// parameters remapped to `'static`), because the developer has asserted
525+
/// that the destructor will not access their contents.
525526
RevisedSelf(Ty<'tcx>),
526527
}
527528

@@ -539,13 +540,8 @@ fn has_dtor_of_interest<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
539540

540541
// Find the `impl<..> Drop for _` to inspect any
541542
// attributes attached to the impl's generics.
542-
let opt_dtor_method = adt_def.destructor();
543-
let dtor_method = if let Some(dtor_method) = opt_dtor_method {
544-
dtor_method
545-
} else {
546-
return DropckKind::BorrowedDataMustStrictlyOutliveSelf;
547-
};
548-
543+
let dtor_method = adt_def.destructor()
544+
.expect("dtorck type without destructor impossible");
549545
let method = tcx.impl_or_trait_item(dtor_method);
550546
let impl_id: DefId = method.container().id();
551547
let revised_ty = revise_self_ty(tcx, adt_def, impl_id, substs);

0 commit comments

Comments
 (0)