improve comments on dropck_outlives

This commit is contained in:
Niko Matsakis 2018-06-27 07:26:29 -04:00
parent 1be4fffc24
commit c6a7c6fc68
2 changed files with 15 additions and 0 deletions

View File

@ -49,6 +49,12 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: fmt::Debug + Sized {
fn param_env(key: &Self::QueryKey) -> ParamEnv<'tcx>;
/// Performs the actual query with the canonicalized key -- the
/// real work happens here. This method is not given an `infcx`
/// because it shouldn't need one -- and if it had access to one,
/// it might do things like invoke `sub_regions`, which would be
/// bad, because it would create subregion relationships that are
/// not captured in the return value.
fn perform_query(
tcx: TyCtxt<'_, 'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, Self::QueryKey>,

View File

@ -52,6 +52,15 @@ where
tcx: TyCtxt<'_, 'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, Self::QueryKey>,
) -> Fallible<CanonicalizedQueryResult<'gcx, Self::QueryResult>> {
// Subtle: note that we are not invoking
// `infcx.at(...).dropck_outlives(...)` here, but rather the
// underlying `dropck_outlives` query. This same underlying
// query is also used by the
// `infcx.at(...).dropck_outlives(...)` fn. Avoiding the
// wrapper means we don't need an infcx in this code, which is
// good because the interface doesn't give us one (so that we
// know we are not registering any subregion relations or
// other things).
tcx.dropck_outlives(canonicalized)
}