mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-23 14:05:27 +00:00
expose ParamEnv as a param
This commit is contained in:
parent
77d3ca1bad
commit
c900abf42d
@ -19,7 +19,7 @@ use std::cell::RefCell;
|
||||
use std::marker::PhantomData;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use traits::{FulfillmentContext, Obligation, ObligationCause, Reveal, SelectionContext, Vtable};
|
||||
use traits::{FulfillmentContext, Obligation, ObligationCause, SelectionContext, Vtable};
|
||||
use ty::{self, Ty, TyCtxt};
|
||||
use ty::subst::{Subst, Substs};
|
||||
use ty::fold::{TypeFoldable, TypeFolder};
|
||||
@ -33,12 +33,12 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
|
||||
/// obligations *could be* resolved if we wanted to.
|
||||
pub fn trans_fulfill_obligation(self,
|
||||
span: Span,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>)
|
||||
-> Vtable<'tcx, ()>
|
||||
{
|
||||
// Remove any references to regions; this helps improve caching.
|
||||
let trait_ref = self.erase_regions(&trait_ref);
|
||||
let param_env = ty::ParamEnv::empty(Reveal::All);
|
||||
|
||||
self.trans_trait_caches.trait_cache.memoize((param_env, trait_ref), || {
|
||||
debug!("trans::fulfill_obligation(trait_ref={:?}, def_id={:?})",
|
||||
|
@ -112,7 +112,7 @@ fn resolve_associated_item<'a, 'tcx>(
|
||||
def_id, trait_id, rcvr_substs);
|
||||
|
||||
let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
|
||||
let vtbl = tcx.trans_fulfill_obligation(DUMMY_SP, ty::Binder(trait_ref));
|
||||
let vtbl = tcx.trans_fulfill_obligation(DUMMY_SP, ty::ParamEnv::empty(traits::Reveal::All), ty::Binder(trait_ref));
|
||||
|
||||
// Now that we know which impl is being used, we can dispatch to
|
||||
// the actual function:
|
||||
@ -226,7 +226,7 @@ pub fn custom_coerce_unsize_info<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
substs: tcx.mk_substs_trait(source_ty, &[target_ty])
|
||||
});
|
||||
|
||||
match tcx.trans_fulfill_obligation(DUMMY_SP, trait_ref) {
|
||||
match tcx.trans_fulfill_obligation(DUMMY_SP, ty::ParamEnv::empty(traits::Reveal::All), trait_ref) {
|
||||
traits::VtableImpl(traits::VtableImplData { impl_def_id, .. }) => {
|
||||
tcx.coerce_unsized_info(impl_def_id).custom_kind.unwrap()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user