diff options
| -rw-r--r-- | src/librustc/traits/README.md | 20 | ||||
| -rw-r--r-- | src/librustc/ty/util.rs | 9 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/librustc/traits/README.md b/src/librustc/traits/README.md index 2e941902031..c49df4b1ad9 100644 --- a/src/librustc/traits/README.md +++ b/src/librustc/traits/README.md @@ -418,16 +418,16 @@ before, and hence the cache lookup would succeed, yielding One subtle interaction is that the results of trait lookup will vary depending on what where clauses are in scope. Therefore, we actually have *two* caches, a local and a global cache. The local cache is -attached to ParamEnv` and the global cache attached -to the `tcx`. We use the local cache whenever the result might depend -on the where clauses that are in scope. The determination of which -cache to use is done by the method `pick_candidate_cache` in -`select.rs`. At the moment, we use a very simple, conservative rule: -if there are any where-clauses in scope, then we use the local cache. -We used to try and draw finer-grained distinctions, but that led to a -serious of annoying and weird bugs like #22019 and #18290. This simple -rule seems to be pretty clearly safe and also still retains a very -high hit rate (~95% when compiling rustc). +attached to the `ParamEnv` and the global cache attached to the +`tcx`. We use the local cache whenever the result might depend on the +where clauses that are in scope. The determination of which cache to +use is done by the method `pick_candidate_cache` in `select.rs`. At +the moment, we use a very simple, conservative rule: if there are any +where-clauses in scope, then we use the local cache. We used to try +and draw finer-grained distinctions, but that led to a serious of +annoying and weird bugs like #22019 and #18290. This simple rule seems +to be pretty clearly safe and also still retains a very high hit rate +(~95% when compiling rustc). # Specialization diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index d18b0a69ade..01fed11fc97 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -16,7 +16,6 @@ use infer::InferCtxt; use ich::{StableHashingContext, NodeIdHashingMode}; use traits::{self, Reveal}; use ty::{self, Ty, TyCtxt, TypeFoldable}; -use ty::ParamEnv; use ty::fold::TypeVisitor; use ty::layout::{Layout, LayoutError}; use ty::subst::{Subst, Kind}; @@ -148,7 +147,7 @@ pub enum Representability { SelfRecursive(Vec<Span>), } -impl<'tcx> ParamEnv<'tcx> { +impl<'tcx> ty::ParamEnv<'tcx> { /// Construct a trait environment suitable for contexts where /// there are no where clauses in scope. pub fn empty() -> Self { @@ -720,7 +719,7 @@ impl<'a, 'gcx, 'tcx, W> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx, W> impl<'a, 'tcx> ty::TyS<'tcx> { pub fn moves_by_default(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParamEnv<'tcx>, + param_env: ty::ParamEnv<'tcx>, span: Span) -> bool { !tcx.at(span).is_copy_raw(param_env.and(self)) @@ -728,7 +727,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { pub fn is_sized(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParamEnv<'tcx>, + param_env: ty::ParamEnv<'tcx>, span: Span)-> bool { tcx.at(span).is_sized_raw(param_env.and(self)) @@ -736,7 +735,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { pub fn is_freeze(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParamEnv<'tcx>, + param_env: ty::ParamEnv<'tcx>, span: Span)-> bool { tcx.at(span).is_freeze_raw(param_env.and(self)) |
