Skip to content

Commit

Permalink
Rename and move ty_param_substs_and_ty
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Jun 22, 2014
1 parent 4c39962 commit 7ead6be
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/librustc/middle/ty.rs
Expand Up @@ -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>>;
Expand Down
9 changes: 5 additions & 4 deletions src/librustc/middle/typeck/astconv.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/typeck/check/method.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/librustc/middle/typeck/check/mod.rs
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/typeck/check/vtable.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/librustc/middle/typeck/mod.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 7ead6be

Please sign in to comment.