rename prequery to try_fast_path

This commit is contained in:
Niko Matsakis 2018-06-27 15:39:20 -04:00
parent 0a0dae0964
commit 5fd3b26280
6 changed files with 7 additions and 7 deletions

View file

@ -27,7 +27,7 @@ impl<'tcx> Eq<'tcx> {
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> {
type QueryResult = ();
fn prequery(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Eq<'tcx>>) -> Option<Self::QueryResult> {
fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Eq<'tcx>>) -> Option<Self::QueryResult> {
if key.value.a == key.value.b {
Some(())
} else {

View file

@ -46,7 +46,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
/// Either converts `self` directly into a `QueryResult` (for
/// simple cases) or into a `QueryKey` (for more complex cases
/// where we actually have work to do).
fn prequery(
fn try_fast_path(
tcx: TyCtxt<'_, 'gcx, 'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResult>;
@ -83,7 +83,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>,
) -> Fallible<Self::QueryResult> {
if let Some(result) = QueryTypeOp::prequery(infcx.tcx, &query_key) {
if let Some(result) = QueryTypeOp::try_fast_path(infcx.tcx, &query_key) {
return Ok(result);
}

View file

@ -34,7 +34,7 @@ where
{
type QueryResult = T;
fn prequery(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
if !key.value.value.has_projections() {
Some(key.value.value)
} else {

View file

@ -31,7 +31,7 @@ where
{
type QueryResult = DropckOutlivesResult<'tcx>;
fn prequery(
fn try_fast_path(
tcx: TyCtxt<'_, 'gcx, 'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResult> {

View file

@ -28,7 +28,7 @@ impl<'tcx> ProvePredicate<'tcx> {
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> {
type QueryResult = ();
fn prequery(_tcx: TyCtxt<'_, 'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>) -> Option<Self::QueryResult> {
fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>) -> Option<Self::QueryResult> {
None
}

View file

@ -30,7 +30,7 @@ impl<'tcx> Subtype<'tcx> {
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> {
type QueryResult = ();
fn prequery(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> {
fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> {
if key.value.sub == key.value.sup {
Some(())
} else {