Skip to content

Commit 90bb418

Browse files
committed
Auto merge of rust-lang#114170 - lcnr:add-commmentz, r=compiler-errors
add `dropck_outlives` comments
2 parents aa8462b + fc98c5a commit 90bb418

File tree

2 files changed

+6
-12
lines changed
  • compiler
    • rustc_borrowck/src/type_check/liveness
    • rustc_trait_selection/src/traits/query/type_op

2 files changed

+6
-12
lines changed

Diff for: compiler/rustc_borrowck/src/type_check/liveness/trace.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,12 @@ impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> {
161161
}
162162
}
163163

164-
// Runs dropck for locals whose liveness isn't relevant. This is
165-
// necessary to eagerly detect unbound recursion during drop glue computation.
164+
/// Runs dropck for locals whose liveness isn't relevant. This is
165+
/// necessary to eagerly detect unbound recursion during drop glue computation.
166+
///
167+
/// These are all the locals which do not potentially reference a region local
168+
/// to this body. Locals which only reference free regions are always drop-live
169+
/// and can therefore safely be dropped.
166170
fn dropck_boring_locals(&mut self, boring_locals: Vec<Local>) {
167171
for local in boring_locals {
168172
let local_ty = self.cx.body.local_decls[local].ty;

Diff for: compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs

-10
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
3131
tcx: TyCtxt<'tcx>,
3232
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
3333
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
34-
// Subtle: note that we are not invoking
35-
// `infcx.at(...).dropck_outlives(...)` here, but rather the
36-
// underlying `dropck_outlives` query. This same underlying
37-
// query is also used by the
38-
// `infcx.at(...).dropck_outlives(...)` fn. Avoiding the
39-
// wrapper means we don't need an infcx in this code, which is
40-
// good because the interface doesn't give us one (so that we
41-
// know we are not registering any subregion relations or
42-
// other things).
43-
4434
// FIXME convert to the type expected by the `dropck_outlives`
4535
// query. This should eventually be fixed by changing the
4636
// *underlying query*.

0 commit comments

Comments
 (0)