Rename and move ty_param_substs_and_ty

This commit is contained in:
Niko Matsakis 2014-05-06 09:52:04 -04:00
parent 4c39962d32
commit 7ead6bed48
6 changed files with 18 additions and 14 deletions

View File

@ -1054,11 +1054,6 @@ pub struct ItemSubsts {
pub substs: Substs,
}
pub struct ty_param_substs_and_ty {
pub substs: Substs,
pub ty: ty::t
}
pub type type_cache = RefCell<DefIdMap<ty_param_bounds_and_ty>>;
pub type node_type_table = RefCell<HashMap<uint,t>>;

View File

@ -54,9 +54,10 @@ use middle::def;
use middle::lang_items::FnMutTraitLangItem;
use rl = middle::resolve_lifetime;
use middle::subst::{Subst, Substs};
use middle::subst;
use middle::ty::ty_param_substs_and_ty;
use middle::ty;
use middle::typeck::TypeAndSubsts;
use middle::typeck::rscope;
use middle::typeck::rscope::{RegionScope};
use middle::typeck::lookup_def_tcx;
use middle::typeck::rscope::RegionScope;
use middle::typeck::rscope;
@ -289,7 +290,7 @@ pub fn ast_path_to_ty<AC:AstConv,RS:RegionScope>(
rscope: &RS,
did: ast::DefId,
path: &ast::Path)
-> ty_param_substs_and_ty
-> TypeAndSubsts
{
let tcx = this.tcx();
let ty::ty_param_bounds_and_ty {
@ -299,7 +300,7 @@ pub fn ast_path_to_ty<AC:AstConv,RS:RegionScope>(
let substs = ast_path_substs(this, rscope, &generics, None, path);
let ty = decl_ty.subst(tcx, &substs);
ty_param_substs_and_ty { substs: substs, ty: ty }
TypeAndSubsts { substs: substs, ty: ty }
}
pub static NO_REGIONS: uint = 1;

View File

@ -93,6 +93,7 @@ use middle::typeck::{MethodOrigin, MethodParam};
use middle::typeck::{MethodStatic, MethodObject};
use middle::typeck::{param_index};
use middle::typeck::check::regionmanip::replace_late_bound_regions_in_fn_sig;
use middle::typeck::TypeAndSubsts;
use util::common::indenter;
use util::ppaux;
use util::ppaux::Repr;
@ -688,7 +689,7 @@ impl<'a> LookupContext<'a> {
// variables for each parameter:
let span = self.self_expr.map_or(self.span, |e| e.span);
let vcx = self.fcx.vtable_context();
let ty::ty_param_substs_and_ty {
let TypeAndSubsts {
substs: impl_substs,
ty: impl_ty
} = impl_self_ty(&vcx, span, impl_did);

View File

@ -85,7 +85,7 @@ use middle::pat_util;
use middle::subst;
use middle::subst::{Subst, Substs, VecPerParamSpace, ParamSpace};
use middle::ty::{FnSig, VariantInfo};
use middle::ty::{ty_param_bounds_and_ty, ty_param_substs_and_ty};
use middle::ty::{ty_param_bounds_and_ty};
use middle::ty::{ParamTy, Disr, ExprTyProvider};
use middle::ty;
use middle::ty_fold::TypeFolder;
@ -109,6 +109,7 @@ use middle::typeck::{lookup_def_ccx};
use middle::typeck::no_params;
use middle::typeck::{require_same_types, vtable_map};
use middle::typeck::{MethodCall, MethodMap};
use middle::typeck::{TypeAndSubsts};
use middle::lang_items::TypeIdLangItem;
use util::common::{block_query, indenter, loop_query};
use util::ppaux;
@ -1791,7 +1792,7 @@ fn check_expr_with_lvalue_pref(fcx: &FnCtxt, expr: &ast::Expr,
pub fn impl_self_ty(vcx: &VtableContext,
span: Span, // (potential) receiver for this impl
did: ast::DefId)
-> ty_param_substs_and_ty {
-> TypeAndSubsts {
let tcx = vcx.tcx();
let ity = ty::lookup_item_type(tcx, did);
@ -1805,7 +1806,7 @@ pub fn impl_self_ty(vcx: &VtableContext,
let substs = subst::Substs::new_type(tps, rps);
let substd_ty = raw_ty.subst(tcx, &substs);
ty_param_substs_and_ty { substs: substs, ty: substd_ty }
TypeAndSubsts { substs: substs, ty: substd_ty }
}
// Only for fields! Returns <none> for methods>

View File

@ -23,6 +23,7 @@ use middle::typeck::{vtable_origin, vtable_res, vtable_param_res};
use middle::typeck::{vtable_static, vtable_param, vtable_error};
use middle::typeck::{param_index};
use middle::typeck::MethodCall;
use middle::typeck::TypeAndSubsts;
use middle::subst;
use middle::subst::{Subst, VecPerParamSpace};
use util::common::indenter;
@ -353,7 +354,7 @@ fn search_for_vtable(vcx: &VtableContext,
// FIXME: document a bit more what this means
//
// FIXME(#5781) this should be mk_eqty not mk_subty
let ty::ty_param_substs_and_ty {
let TypeAndSubsts {
substs: substs,
ty: for_ty
} = impl_self_ty(vcx, span, impl_did);

View File

@ -176,6 +176,11 @@ pub enum ExprAdjustment {
AutoObject
}
pub struct TypeAndSubsts {
pub substs: subst::Substs,
pub ty: ty::t,
}
impl MethodCall {
pub fn expr(id: ast::NodeId) -> MethodCall {
MethodCall {