diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-09-13 21:09:25 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-11-19 06:24:34 +0200 |
| commit | 9706d8f6022d3e4f4e2a247a10c3408d4fcb844c (patch) | |
| tree | de640fdcab8c447f7ae2b54de732fde29998a29c | |
| parent | 21da75066340bc36ac5086f849e959df9ae67dba (diff) | |
| download | rust-9706d8f6022d3e4f4e2a247a10c3408d4fcb844c.tar.gz rust-9706d8f6022d3e4f4e2a247a10c3408d4fcb844c.zip | |
rustc: middle: rename `ty::t` to `Ty` and use it unqualified everywhere.
79 files changed, 1108 insertions, 1112 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index df014eb1206..126d4c00f28 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -28,9 +28,10 @@ use self::MethodContext::*; use metadata::csearch; use middle::def::*; +use middle::ty::{mod, Ty}; use middle::typeck::astconv::ast_ty_to_ty; -use middle::typeck::infer; -use middle::{typeck, ty, def, pat_util, stability}; +use middle::typeck::{mod, infer}; +use middle::{def, pat_util, stability}; use middle::const_eval::{eval_const_expr_partial, const_int, const_uint}; use util::ppaux::{ty_to_string}; use util::nodemap::{FnvHashMap, NodeSet}; @@ -473,7 +474,7 @@ declare_lint!(BOX_POINTERS, Allow, pub struct BoxPointers; impl BoxPointers { - fn check_heap_type(&self, cx: &Context, span: Span, ty: ty::t) { + fn check_heap_type(&self, cx: &Context, span: Span, ty: Ty) { let mut n_uniq = 0i; ty::fold_ty(cx.tcx, ty, |t| { match ty::get(t).sty { diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index e9b235a2fe3..a519683b351 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -27,7 +27,7 @@ use self::TargetLint::*; use middle::privacy::ExportedItems; use middle::subst; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::astconv::AstConv; use middle::typeck::infer; use session::{early_error, Session}; @@ -554,11 +554,11 @@ impl<'a, 'tcx> AstConv<'tcx> for Context<'a, 'tcx>{ ty::lookup_trait_def(self.tcx, id) } - fn ty_infer(&self, _span: Span) -> ty::t { + fn ty_infer(&self, _span: Span) -> Ty { infer::new_infer_ctxt(self.tcx).next_ty_var() } - fn associated_types_of_trait_are_valid(&self, _: ty::t, _: ast::DefId) + fn associated_types_of_trait_are_valid(&self, _: Ty, _: ast::DefId) -> bool { // FIXME(pcwalton): This is wrong. true @@ -566,10 +566,10 @@ impl<'a, 'tcx> AstConv<'tcx> for Context<'a, 'tcx>{ fn associated_type_binding(&self, _: Span, - _: Option<ty::t>, + _: Option<Ty>, trait_id: ast::DefId, associated_type_id: ast::DefId) - -> ty::t { + -> Ty { // FIXME(pcwalton): This is wrong. let trait_def = self.get_trait_def(trait_id); let index = ty::associated_type_parameter_index(self.tcx, diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index e0110a81c17..b45f57eae96 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -29,7 +29,7 @@ use middle::lang_items; use middle::resolve::{TraitItemKind, TypeTraitItemKind}; use middle::subst; use middle::ty::{ImplContainer, TraitContainer}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck; use middle::astencode::vtable_decoder_helpers; @@ -224,7 +224,7 @@ fn variant_disr_val(d: rbml::Doc) -> Option<ty::Disr> { }) } -fn doc_type(doc: rbml::Doc, tcx: &ty::ctxt, cdata: Cmd) -> ty::t { +fn doc_type(doc: rbml::Doc, tcx: &ty::ctxt, cdata: Cmd) -> Ty { let tp = reader::get_doc(doc, tag_items_data_item_type); parse_ty_data(tp.data, cdata.cnum, tp.start, tcx, |_, did| translate_def_id(cdata, did)) @@ -237,7 +237,7 @@ fn doc_method_fty(doc: rbml::Doc, tcx: &ty::ctxt, cdata: Cmd) -> ty::BareFnTy { } pub fn item_type(_item_id: ast::DefId, item: rbml::Doc, - tcx: &ty::ctxt, cdata: Cmd) -> ty::t { + tcx: &ty::ctxt, cdata: Cmd) -> Ty { doc_type(item, tcx, cdata) } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index f4df55fa5ca..a1e4cd97dac 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -22,7 +22,7 @@ use metadata::cstore; use metadata::decoder; use metadata::tyencode; use middle::ty::{lookup_item_type}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::stability; use middle; use util::nodemap::{FnvHashMap, NodeMap, NodeSet}; @@ -172,7 +172,7 @@ pub fn write_closure_type(ecx: &EncodeContext, pub fn write_type(ecx: &EncodeContext, rbml_w: &mut Encoder, - typ: ty::t) { + typ: Ty) { let ty_str_ctxt = &tyencode::ctxt { diag: ecx.diag, ds: def_to_string, @@ -223,7 +223,7 @@ fn encode_bounds(rbml_w: &mut Encoder, fn encode_type(ecx: &EncodeContext, rbml_w: &mut Encoder, - typ: ty::t) { + typ: Ty) { rbml_w.start_tag(tag_items_data_item_type); write_type(ecx, rbml_w, typ); rbml_w.end_tag(); @@ -2167,7 +2167,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter, } // Get the encoded string for a type -pub fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> String { +pub fn encoded_ty(tcx: &ty::ctxt, t: Ty) -> String { let mut wr = SeekableMemWriter::new(); tyencode::enc_ty(&mut wr, &tyencode::ctxt { diag: tcx.sess.diagnostic(), diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index a3be480bf92..6215f7ea774 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -20,7 +20,7 @@ pub use self::DefIdSource::*; use middle::subst; use middle::subst::VecPerParamSpace; -use middle::ty; +use middle::ty::{mod, Ty}; use std::rc::Rc; use std::str; @@ -29,7 +29,7 @@ use syntax::abi; use syntax::ast; use syntax::parse::token; -// Compact string representation for ty::t values. API ty_str & +// Compact string representation for Ty values. API ty_str & // parse_from_str. Extra parameters are for converting to/from def_ids in the // data buffer. Whatever format you choose should not contain pipe characters. @@ -150,7 +150,7 @@ pub fn parse_ty_closure_data(data: &[u8], } pub fn parse_ty_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx: &ty::ctxt, - conv: conv_did) -> ty::t { + conv: conv_did) -> Ty { debug!("parse_ty_data {}", data_log_string(data, pos)); let mut st = parse_state_from_data(data, crate_num, pos, tcx); parse_ty(&mut st, conv) @@ -359,7 +359,7 @@ fn parse_trait_ref(st: &mut PState, conv: conv_did) -> ty::TraitRef { ty::TraitRef {def_id: def, substs: substs} } -fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t { +fn parse_ty(st: &mut PState, conv: conv_did) -> Ty { match next(st) { 'b' => return ty::mk_bool(), 'i' => return ty::mk_int(), diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index ebc953a56af..7c929a1fbcd 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -18,7 +18,7 @@ use std::cell::RefCell; use middle::subst; use middle::subst::VecPerParamSpace; use middle::ty::ParamTy; -use middle::ty; +use middle::ty::{mod, Ty}; use util::nodemap::FnvHashMap; use syntax::abi::Abi; @@ -46,9 +46,9 @@ pub struct ty_abbrev { s: String } -pub type abbrev_map = RefCell<FnvHashMap<ty::t, ty_abbrev>>; +pub type abbrev_map = RefCell<FnvHashMap<Ty, ty_abbrev>>; -pub fn enc_ty(w: &mut SeekableMemWriter, cx: &ctxt, t: ty::t) { +pub fn enc_ty(w: &mut SeekableMemWriter, cx: &ctxt, t: Ty) { match cx.abbrevs.borrow_mut().get(&t) { Some(a) => { w.write(a.s.as_bytes()); return; } None => {} diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index ff6965574be..cd65334d664 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -26,8 +26,8 @@ use metadata::tyencode; use middle::mem_categorization::Typer; use middle::subst; use middle::subst::VecPerParamSpace; -use middle::typeck::{MethodCall, MethodCallee, MethodOrigin}; -use middle::{ty, typeck}; +use middle::typeck::{mod, MethodCall, MethodCallee, MethodOrigin}; +use middle::ty::{mod, Ty}; use util::ppaux::ty_to_string; use syntax::{ast, ast_map, ast_util, codemap, fold}; @@ -831,8 +831,8 @@ trait rbml_writer_helpers { fn emit_method_origin(&mut self, ecx: &e::EncodeContext, method_origin: &typeck::MethodOrigin); - fn emit_ty(&mut self, ecx: &e::EncodeContext, ty: ty::t); - fn emit_tys(&mut self, ecx: &e::EncodeContext, tys: &[ty::t]); + fn emit_ty(&mut self, ecx: &e::EncodeContext, ty: Ty); + fn emit_tys(&mut self, ecx: &e::EncodeContext, tys: &[Ty]); fn emit_type_param_def(&mut self, ecx: &e::EncodeContext, type_param_def: &ty::TypeParameterDef); @@ -915,11 +915,11 @@ impl<'a> rbml_writer_helpers for Encoder<'a> { }); } - fn emit_ty(&mut self, ecx: &e::EncodeContext, ty: ty::t) { + fn emit_ty(&mut self, ecx: &e::EncodeContext, ty: Ty) { self.emit_opaque(|this| Ok(e::write_type(ecx, this, ty))); } - fn emit_tys(&mut self, ecx: &e::EncodeContext, tys: &[ty::t]) { + fn emit_tys(&mut self, ecx: &e::EncodeContext, tys: &[Ty]) { self.emit_from_vec(tys, |this, ty| Ok(this.emit_ty(ecx, *ty))); } @@ -1327,8 +1327,8 @@ impl<'a> doc_decoder_helpers for rbml::Doc<'a> { trait rbml_decoder_decoder_helpers { fn read_method_origin(&mut self, dcx: &DecodeContext) -> typeck::MethodOrigin; - fn read_ty(&mut self, dcx: &DecodeContext) -> ty::t; - fn read_tys(&mut self, dcx: &DecodeContext) -> Vec<ty::t>; + fn read_ty(&mut self, dcx: &DecodeContext) -> Ty; + fn read_tys(&mut self, dcx: &DecodeContext) -> Vec<Ty>; fn read_trait_ref(&mut self, dcx: &DecodeContext) -> Rc<ty::TraitRef>; fn read_type_param_def(&mut self, dcx: &DecodeContext) -> ty::TypeParameterDef; @@ -1351,10 +1351,10 @@ trait rbml_decoder_decoder_helpers { // Versions of the type reading functions that don't need the full // DecodeContext. fn read_ty_nodcx(&mut self, - tcx: &ty::ctxt, cdata: &cstore::crate_metadata) -> ty::t; + tcx: &ty::ctxt, cdata: &cstore::crate_metadata) -> Ty; fn read_tys_nodcx(&mut self, tcx: &ty::ctxt, - cdata: &cstore::crate_metadata) -> Vec<ty::t>; + cdata: &cstore::crate_metadata) -> Vec<Ty>; fn read_substs_nodcx(&mut self, tcx: &ty::ctxt, cdata: &cstore::crate_metadata) -> subst::Substs; @@ -1362,7 +1362,7 @@ trait rbml_decoder_decoder_helpers { impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { fn read_ty_nodcx(&mut self, - tcx: &ty::ctxt, cdata: &cstore::crate_metadata) -> ty::t { + tcx: &ty::ctxt, cdata: &cstore::crate_metadata) -> Ty { self.read_opaque(|_, doc| { Ok(tydecode::parse_ty_data( doc.data, @@ -1375,7 +1375,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { fn read_tys_nodcx(&mut self, tcx: &ty::ctxt, - cdata: &cstore::crate_metadata) -> Vec<ty::t> { + cdata: &cstore::crate_metadata) -> Vec<Ty> { self.read_to_vec(|this| Ok(this.read_ty_nodcx(tcx, cdata)) ) .unwrap() .into_iter() @@ -1468,7 +1468,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { } - fn read_ty(&mut self, dcx: &DecodeContext) -> ty::t { + fn read_ty(&mut self, dcx: &DecodeContext) -> Ty { // Note: regions types embed local node ids. In principle, we // should translate these node ids into the new decode // context. However, we do not bother, because region types @@ -1496,7 +1496,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { } } - fn read_tys(&mut self, dcx: &DecodeContext) -> Vec<ty::t> { + fn read_tys(&mut self, dcx: &DecodeContext) -> Vec<Ty> { self.read_to_vec(|this| Ok(this.read_ty(dcx))).unwrap().into_iter().collect() } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index d7925177c29..45bab842bca 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -24,7 +24,7 @@ use middle::dataflow::BitwiseOperator; use middle::dataflow::DataFlowOperator; use middle::expr_use_visitor as euv; use middle::mem_categorization as mc; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux::{note_and_explain_region, Repr, UserString}; use std::rc::Rc; @@ -586,7 +586,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } } - fn move_suggestion(tcx: &ty::ctxt, ty: ty::t, default_msgs: (&'static str, &'static str)) + fn move_suggestion(tcx: &ty::ctxt, ty: Ty, default_msgs: (&'static str, &'static str)) -> (&'static str, &'static str) { match ty::get(ty).sty { ty::ty_closure(box ty::ClosureTy { diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index d8618430db4..bb118dcb349 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -21,7 +21,7 @@ use middle::expr_use_visitor::{WriteAndRead}; use middle::mem_categorization::cmt; use middle::pat_util::*; use middle::ty::*; -use middle::ty; +use middle::ty::{mod, Ty}; use std::fmt; use std::iter::AdditiveIterator; use std::iter::range_inclusive; @@ -403,7 +403,7 @@ impl<'a, 'tcx> Folder for StaticInliner<'a, 'tcx> { /// left_ty: struct X { a: (bool, &'static str), b: uint} /// pats: [(false, "foo"), 42] => X { a: (false, "foo"), b: 42 } fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor, - pats: Vec<&Pat>, left_ty: ty::t) -> P<Pat> { + pats: Vec<&Pat>, left_ty: Ty) -> P<Pat> { let pats_len = pats.len(); let mut pats = pats.into_iter().map(|p| P((*p).clone())); let pat = match ty::get(left_ty).sty { @@ -483,7 +483,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor, } fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix, - left_ty: ty::t, max_slice_length: uint) -> Option<Constructor> { + left_ty: Ty, max_slice_length: uint) -> Option<Constructor> { let used_constructors: Vec<Constructor> = rows.iter() .flat_map(|row| pat_constructors(cx, row[0], left_ty, max_slice_length).into_iter()) .collect(); @@ -496,7 +496,7 @@ fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix, /// values of type `left_ty`. For vectors, this would normally be an infinite set /// but is instead bounded by the maximum fixed length of slice patterns in /// the column of patterns being analyzed. -fn all_constructors(cx: &MatchCheckCtxt, left_ty: ty::t, +fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty, max_slice_length: uint) -> Vec<Constructor> { match ty::get(left_ty).sty { ty::ty_bool => @@ -616,7 +616,7 @@ fn is_useful(cx: &MatchCheckCtxt, } fn is_useful_specialized(cx: &MatchCheckCtxt, &Matrix(ref m): &Matrix, - v: &[&Pat], ctor: Constructor, lty: ty::t, + v: &[&Pat], ctor: Constructor, lty: Ty, witness: WitnessPreference) -> Usefulness { let arity = constructor_arity(cx, &ctor, lty); let matrix = Matrix(m.iter().filter_map(|r| { @@ -638,7 +638,7 @@ fn is_useful_specialized(cx: &MatchCheckCtxt, &Matrix(ref m): &Matrix, /// On the other hand, a wild pattern and an identifier pattern cannot be /// specialized in any way. fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat, - left_ty: ty::t, max_slice_length: uint) -> Vec<Constructor> { + left_ty: Ty, max_slice_length: uint) -> Vec<Constructor> { let pat = raw_pat(p); match pat.node { ast::PatIdent(..) => @@ -695,7 +695,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat, /// /// For instance, a tuple pattern (_, 42u, Some([])) has the arity of 3. /// A struct pattern's arity is the number of fields it contains, etc. -pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) -> uint { +pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> uint { match ty::get(ty).sty { ty::ty_tup(ref fs) => fs.len(), ty::ty_uniq(_) => 1u, diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index c06044073ed..fe52e85142f 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -18,7 +18,7 @@ use metadata::csearch; use middle::astencode; use middle::def; use middle::pat_util::def_to_path; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::astconv; use middle::typeck::check; use util::nodemap::{DefIdMap}; diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index 41d35969f38..54dcc845fef 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -13,7 +13,7 @@ use self::UnsafeContext::*; use middle::def; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::MethodCall; use util::ppaux; @@ -30,7 +30,7 @@ enum UnsafeContext { UnsafeBlock(ast::NodeId), } -fn type_is_unsafe_function(ty: ty::t) -> bool { +fn type_is_unsafe_function(ty: Ty) -> bool { match ty::get(ty).sty { ty::ty_bare_fn(ref f) => f.fn_style == ast::UnsafeFn, ty::ty_closure(ref f) => f.fn_style == ast::UnsafeFn, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index a8ab4425f1d..494d678ea38 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -24,7 +24,7 @@ use middle::mem_categorization as mc; use middle::def; use middle::mem_categorization::Typer; use middle::pat_util; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::{MethodCall, MethodObject, MethodTraitObject}; use middle::typeck::{MethodOrigin, MethodParam, MethodTypeParam}; use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure}; @@ -999,7 +999,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> { } } -fn copy_or_move(tcx: &ty::ctxt, ty: ty::t, move_reason: MoveReason) -> ConsumeMode { +fn copy_or_move(tcx: &ty::ctxt, ty: Ty, move_reason: MoveReason) -> ConsumeMode { if ty::type_moves_by_default(tcx, ty) { Move(move_reason) } else { Copy } } diff --git a/src/librustc/middle/fast_reject.rs b/src/librustc/middle/fast_reject.rs index d2c58b2ceee..2f451bfa4e0 100644 --- a/src/librustc/middle/fast_reject.rs +++ b/src/librustc/middle/fast_reject.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use middle::ty; +use middle::ty::{mod, Ty}; use syntax::ast; use self::SimplifiedType::*; @@ -34,7 +34,7 @@ pub enum SimplifiedType { } pub fn simplify_type(tcx: &ty::ctxt, - ty: ty::t, + ty: Ty, can_simplify_params: bool) -> Option<SimplifiedType> { diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index 2c7c360bb1d..913995a3325 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -12,7 +12,7 @@ use metadata::csearch; use middle::def::DefFn; use middle::subst::Subst; use middle::ty::{TransmuteRestriction, ctxt, ty_bare_fn}; -use middle::ty; +use middle::ty::{mod, Ty}; use syntax::abi::RustIntrinsic; use syntax::ast::DefId; @@ -23,7 +23,7 @@ use syntax::parse::token; use syntax::visit::Visitor; use syntax::visit; -fn type_size_is_affected_by_type_parameters(tcx: &ty::ctxt, typ: ty::t) +fn type_size_is_affected_by_type_parameters(tcx: &ty::ctxt, typ: Ty) -> bool { let mut result = false; ty::maybe_walk_ty(typ, |typ| { @@ -96,7 +96,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> { } } - fn check_transmute(&self, span: Span, from: ty::t, to: ty::t, id: ast::NodeId) { + fn check_transmute(&self, span: Span, from: Ty, to: Ty, id: ast::NodeId) { if type_size_is_affected_by_type_parameters(self.tcx, from) { span_err!(self.tcx.sess, span, E0139, "cannot transmute from a type that contains type parameters"); diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index c9e5bbbc54e..572059e99fc 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -74,7 +74,7 @@ pub use self::deref_kind::*; pub use self::categorization::*; use middle::def; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck; use util::nodemap::{DefIdMap, NodeMap}; use util::ppaux::{ty_to_string, Repr}; @@ -180,7 +180,7 @@ pub struct cmt_ { pub span: Span, // span of same expr/pat pub cat: categorization, // categorization of expr pub mutbl: MutabilityCategory, // mutability of expr as lvalue - pub ty: ty::t, // type of the expr (*see WARNING above*) + pub ty: Ty, // type of the expr (*see WARNING above*) pub note: Note, // Note about the provenance of this cmt } @@ -196,7 +196,7 @@ pub enum deref_kind { // Categorizes a derefable type. Note that we include vectors and strings as // derefable (we model an index as the combination of a deref and then a // pointer adjustment). -pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> { +pub fn opt_deref_kind(t: Ty) -> Option<deref_kind> { match ty::get(t).sty { ty::ty_uniq(_) | ty::ty_closure(box ty::ClosureTy {store: ty::UniqTraitStore, ..}) => { @@ -232,7 +232,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> { } } -pub fn deref_kind(tcx: &ty::ctxt, t: ty::t) -> deref_kind { +pub fn deref_kind(tcx: &ty::ctxt, t: Ty) -> deref_kind { debug!("deref_kind {}", ty_to_string(tcx, t)); match opt_deref_kind(t) { Some(k) => k, @@ -285,8 +285,8 @@ pub type McResult<T> = Result<T, ()>; */ pub trait Typer<'tcx> { fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>; - fn node_ty(&self, id: ast::NodeId) -> McResult<ty::t>; - fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t>; + fn node_ty(&self, id: ast::NodeId) -> McResult<Ty>; + fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<Ty>; fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment>>; fn is_method_call(&self, id: ast::NodeId) -> bool; fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<ast::NodeId>; @@ -393,22 +393,22 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { self.typer.tcx() } - fn expr_ty(&self, expr: &ast::Expr) -> McResult<ty::t> { + fn expr_ty(&self, expr: &ast::Expr) -> McResult<Ty> { self.typer.node_ty(expr.id) } - fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<ty::t> { + fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<Ty> { let unadjusted_ty = if_ok!(self.expr_ty(expr)); Ok(ty::adjust_ty(self.tcx(), expr.span, expr.id, unadjusted_ty, self.typer.adjustments().borrow().get(&expr.id), |method_call| self.typer.node_method_ty(method_call))) } - fn node_ty(&self, id: ast::NodeId) -> McResult<ty::t> { + fn node_ty(&self, id: ast::NodeId) -> McResult<Ty> { self.typer.node_ty(id) } - fn pat_ty(&self, pat: &ast::Pat) -> McResult<ty::t> { + fn pat_ty(&self, pat: &ast::Pat) -> McResult<Ty> { self.typer.node_ty(pat.id) } @@ -546,7 +546,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { pub fn cat_def(&self, id: ast::NodeId, span: Span, - expr_ty: ty::t, + expr_ty: Ty, def: def::Def) -> McResult<cmt> { debug!("cat_def: id={} expr={} def={}", @@ -804,7 +804,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { pub fn cat_rvalue_node(&self, id: ast::NodeId, span: Span, - expr_ty: ty::t) + expr_ty: Ty) -> cmt { match self.typer.temporary_scope(id) { Some(scope) => { @@ -823,7 +823,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { cmt_id: ast::NodeId, span: Span, temp_scope: ty::Region, - expr_ty: ty::t) -> cmt { + expr_ty: Ty) -> cmt { Rc::new(cmt_ { id:cmt_id, span:span, @@ -838,7 +838,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { node: &N, base_cmt: cmt, f_name: ast::Name, - f_ty: ty::t) + f_ty: Ty) -> cmt { Rc::new(cmt_ { id: node.id(), @@ -854,7 +854,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { node: &N, base_cmt: cmt, f_idx: uint, - f_ty: ty::t) + f_ty: Ty) -> cmt { Rc::new(cmt_ { id: node.id(), @@ -909,7 +909,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { node: &N, base_cmt: cmt, deref_cnt: uint, - deref_ty: ty::t, + deref_ty: Ty, implicit: bool) -> cmt { let (m, cat) = match deref_kind(self.tcx(), base_cmt.ty) { @@ -990,9 +990,9 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { fn interior<N: ast_node>(elt: &N, of_cmt: cmt, - vec_ty: ty::t, + vec_ty: Ty, mutbl: MutabilityCategory, - element_ty: ty::t) -> cmt + element_ty: Ty) -> cmt { Rc::new(cmt_ { id:elt.id(), @@ -1060,7 +1060,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { fn vec_slice_info(tcx: &ty::ctxt, pat: &ast::Pat, - slice_ty: ty::t) + slice_ty: Ty) -> (ast::Mutability, ty::Region) { /*! * In a pattern like [a, b, ..c], normally `c` has slice type, @@ -1086,7 +1086,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { pub fn cat_imm_interior<N:ast_node>(&self, node: &N, base_cmt: cmt, - interior_ty: ty::t, + interior_ty: Ty, interior: InteriorKind) -> cmt { Rc::new(cmt_ { @@ -1102,7 +1102,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { pub fn cat_downcast<N:ast_node>(&self, node: &N, base_cmt: cmt, - downcast_ty: ty::t) + downcast_ty: Ty) -> cmt { Rc::new(cmt_ { id: node.id(), @@ -1531,7 +1531,7 @@ impl Repr for InteriorKind { } } -fn element_kind(t: ty::t) -> ElementKind { +fn element_kind(t: Ty) -> ElementKind { match ty::get(t).sty { ty::ty_rptr(_, ty::mt{ty, ..}) | ty::ty_uniq(ty) => match ty::get(ty).sty { diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 098108b25e5..0b097c63710 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -19,7 +19,7 @@ use std::mem::replace; use metadata::csearch; use middle::def; use middle::resolve; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam}; use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject}; use util::nodemap::{NodeMap, NodeSet}; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index f3d62988cc0..0c0861eda3e 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -23,7 +23,7 @@ Most of the documentation on regions can be found in use session::Session; use middle::ty::{FreeRegion}; -use middle::ty; +use middle::ty::{mod, Ty}; use util::nodemap::{FnvHashMap, NodeMap, NodeSet}; use util::common::can_reach; diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index 4fabdabf3db..7222806e484 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -13,7 +13,7 @@ pub use self::ParamSpace::*; pub use self::RegionSubsts::*; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold::{mod, TypeFoldable, TypeFolder}; use util::ppaux::Repr; @@ -32,7 +32,7 @@ use syntax::codemap::{Span, DUMMY_SP}; */ #[deriving(Clone, PartialEq, Eq, Hash, Show)] pub struct Substs { - pub types: VecPerParamSpace<ty::t>, + pub types: VecPerParamSpace<Ty>, pub regions: RegionSubsts, } @@ -47,14 +47,14 @@ pub enum RegionSubsts { } impl Substs { - pub fn new(t: VecPerParamSpace<ty::t>, + pub fn new(t: VecPerParamSpace<Ty>, r: VecPerParamSpace<ty::Region>) -> Substs { Substs { types: t, regions: NonerasedRegions(r) } } - pub fn new_type(t: Vec<ty::t>, + pub fn new_type(t: Vec<Ty>, r: Vec<ty::Region>) -> Substs { @@ -62,17 +62,17 @@ impl Substs { VecPerParamSpace::new(r, Vec::new(), Vec::new(), Vec::new())) } - pub fn new_trait(t: Vec<ty::t>, + pub fn new_trait(t: Vec<Ty>, r: Vec<ty::Region>, - a: Vec<ty::t>, - s: ty::t) + a: Vec<Ty>, + s: Ty) -> Substs { Substs::new(VecPerParamSpace::new(t, vec!(s), a, Vec::new()), VecPerParamSpace::new(r, Vec::new(), Vec::new(), Vec::new())) } - pub fn erased(t: VecPerParamSpace<ty::t>) -> Substs + pub fn erased(t: VecPerParamSpace<Ty>) -> Substs { Substs { types: t, regions: ErasedRegions } } @@ -111,11 +111,11 @@ impl Substs { } } - pub fn self_ty(&self) -> Option<ty::t> { + pub fn self_ty(&self) -> Option<Ty> { self.types.get_self().map(|&t| t) } - pub fn with_self_ty(&self, self_ty: ty::t) -> Substs { + pub fn with_self_ty(&self, self_ty: Ty) -> Substs { assert!(self.self_ty().is_none()); let mut s = (*self).clone(); s.types.push(SelfSpace, self_ty); @@ -154,7 +154,7 @@ impl Substs { } pub fn with_method(self, - m_types: Vec<ty::t>, + m_types: Vec<Ty>, m_regions: Vec<ty::Region>) -> Substs { @@ -575,7 +575,7 @@ struct SubstFolder<'a, 'tcx: 'a> { span: Option<Span>, // The root type that is being substituted, if available. - root_ty: Option<ty::t>, + root_ty: Option<Ty>, // Depth of type stack ty_stack_depth: uint, @@ -629,7 +629,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> { } } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { if !ty::type_needs_subst(t) { return t; } @@ -661,7 +661,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> { } impl<'a,'tcx> SubstFolder<'a,'tcx> { - fn ty_for_param(&self, p: ty::ParamTy, source_ty: ty::t) -> ty::t { + fn ty_for_param(&self, p: ty::ParamTy, source_ty: Ty) -> Ty { // Look up the type in the substitutions. It really should be in there. let opt_ty = self.substs.types.opt_get(p.space, p.idx); let ty = match opt_ty { @@ -684,7 +684,7 @@ impl<'a,'tcx> SubstFolder<'a,'tcx> { self.shift_regions_through_binders(ty) } - fn shift_regions_through_binders(&self, ty: ty::t) -> ty::t { + fn shift_regions_through_binders(&self, ty: Ty) -> Ty { /*! * It is sometimes necessary to adjust the debruijn indices * during substitution. This occurs when we are substituting a diff --git a/src/librustc/middle/traits/coherence.rs b/src/librustc/middle/traits/coherence.rs index 405f6509e59..fa469dc7347 100644 --- a/src/librustc/middle/traits/coherence.rs +++ b/src/librustc/middle/traits/coherence.rs @@ -16,7 +16,7 @@ use super::util; use middle::subst; use middle::subst::Subst; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::{mod, InferCtxt}; use syntax::ast; use syntax::codemap::DUMMY_SP; @@ -76,10 +76,7 @@ pub fn impl_is_local(tcx: &ty::ctxt, trait_ref.input_types().iter().any(|&t| ty_is_local(tcx, t)) } -pub fn ty_is_local(tcx: &ty::ctxt, - ty: ty::t) - -> bool -{ +pub fn ty_is_local(tcx: &ty::ctxt, ty: Ty) -> bool { debug!("ty_is_local({})", ty.repr(tcx)); match ty::get(ty).sty { diff --git a/src/librustc/middle/traits/mod.rs b/src/librustc/middle/traits/mod.rs index c9c9e3bd4ff..d821c447eb8 100644 --- a/src/librustc/middle/traits/mod.rs +++ b/src/librustc/middle/traits/mod.rs @@ -19,7 +19,7 @@ pub use self::ObligationCauseCode::*; use middle::mem_categorization::Typer; use middle::subst; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::InferCtxt; use std::rc::Rc; use std::slice::Items; @@ -75,7 +75,7 @@ pub enum ObligationCauseCode { ItemObligation(ast::DefId), /// Obligation incurred due to an object cast. - ObjectCastObligation(/* Object type */ ty::t), + ObjectCastObligation(/* Object type */ Ty), /// To implement drop, type must be sendable. DropTrait, @@ -231,7 +231,7 @@ pub fn select_inherent_impl<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>, typer: &Typer<'tcx>, cause: ObligationCause, impl_def_id: ast::DefId, - self_ty: ty::t) + self_ty: Ty) -> SelectionResult<VtableImplData<Obligation>> { /*! @@ -284,7 +284,7 @@ pub fn overlapping_impls(infcx: &InferCtxt, pub fn obligations_for_generics(tcx: &ty::ctxt, cause: ObligationCause, generic_bounds: &ty::GenericBounds, - type_substs: &subst::VecPerParamSpace<ty::t>) + type_substs: &subst::VecPerParamSpace<Ty>) -> subst::VecPerParamSpace<Obligation> { /*! @@ -307,7 +307,7 @@ pub fn obligations_for_generics(tcx: &ty::ctxt, pub fn obligation_for_builtin_bound(tcx: &ty::ctxt, cause: ObligationCause, - source_ty: ty::t, + source_ty: Ty, builtin_bound: ty::BuiltinBound) -> Result<Obligation, ErrorReported> { @@ -325,7 +325,7 @@ impl Obligation { Obligation::new(ObligationCause::misc(span), trait_ref) } - pub fn self_ty(&self) -> ty::t { + pub fn self_ty(&self) -> Ty { self.trait_ref.self_ty() } } diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index a941d2b079e..6ff405f19fb 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -30,7 +30,7 @@ use super::{util}; use middle::fast_reject; use middle::mem_categorization::Typer; use middle::subst::{Subst, Substs, VecPerParamSpace}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer; use middle::typeck::infer::{InferCtxt, TypeSkolemizer}; use middle::ty_fold::TypeFoldable; @@ -142,7 +142,7 @@ struct CandidateSet { } enum BuiltinBoundConditions { - If(Vec<ty::t>), + If(Vec<Ty>), ParameterBuiltin, AmbiguousBuiltin } @@ -221,7 +221,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { pub fn select_inherent_impl(&mut self, impl_def_id: ast::DefId, obligation_cause: ObligationCause, - obligation_self_ty: ty::t) + obligation_self_ty: Ty) -> SelectionResult<VtableImplData<Obligation>> { debug!("select_inherent_impl(impl_def_id={}, obligation_self_ty={})", @@ -271,7 +271,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn evaluate_builtin_bound_recursively(&mut self, bound: ty::BuiltinBound, previous_stack: &ObligationStack, - ty: ty::t) + ty: Ty) -> EvaluationResult { let obligation = @@ -434,8 +434,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // the algorithm. pub fn evaluate_method_obligation(&mut self, - rcvr_ty: ty::t, - xform_self_ty: ty::t, + rcvr_ty: Ty, + xform_self_ty: Ty, obligation: &Obligation) -> MethodMatchResult { @@ -562,8 +562,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } pub fn confirm_method_match(&mut self, - rcvr_ty: ty::t, - xform_self_ty: ty::t, + rcvr_ty: Ty, + xform_self_ty: Ty, obligation: &Obligation, data: MethodMatchedData) { @@ -596,8 +596,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } fn match_method_precise(&mut self, - rcvr_ty: ty::t, - xform_self_ty: ty::t, + rcvr_ty: Ty, + xform_self_ty: Ty, obligation: &Obligation) -> Result<(),()> { @@ -622,8 +622,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } fn assemble_method_candidates_from_impls(&mut self, - rcvr_ty: ty::t, - xform_self_ty: ty::t, + rcvr_ty: Ty, + xform_self_ty: Ty, obligation: &Obligation) -> Vec<ast::DefId> { @@ -650,8 +650,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn match_method_coerce(&mut self, impl_def_id: ast::DefId, - rcvr_ty: ty::t, - xform_self_ty: ty::t, + rcvr_ty: Ty, + xform_self_ty: Ty, obligation: &Obligation) -> Result<Substs, ()> { @@ -683,8 +683,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn winnow_method_impl(&mut self, impl_def_id: ast::DefId, - rcvr_ty: ty::t, - xform_self_ty: ty::t, + rcvr_ty: Ty, + xform_self_ty: Ty, obligation: &Obligation) -> bool { @@ -1227,7 +1227,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn builtin_bound(&mut self, bound: ty::BuiltinBound, - self_ty: ty::t) + self_ty: Ty) -> Result<BuiltinBoundConditions,SelectionError> { let self_ty = self.infcx.shallow_resolve(self_ty); @@ -1443,7 +1443,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } Some(freevars) => { - let tys: Vec<ty::t> = + let tys: Vec<Ty> = freevars .iter() .map(|freevar| { @@ -1458,7 +1458,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } ty::ty_struct(def_id, ref substs) => { - let types: Vec<ty::t> = + let types: Vec<Ty> = ty::struct_fields(self.tcx(), def_id, substs) .iter() .map(|f| f.mt.ty) @@ -1467,7 +1467,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } ty::ty_enum(def_id, ref substs) => { - let types: Vec<ty::t> = + let types: Vec<Ty> = ty::substd_enum_variants(self.tcx(), def_id, substs) .iter() .flat_map(|variant| variant.args.iter()) @@ -1508,7 +1508,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn nominal(this: &mut SelectionContext, bound: ty::BuiltinBound, def_id: ast::DefId, - types: Vec<ty::t>) + types: Vec<Ty>) -> Result<BuiltinBoundConditions,SelectionError> { // First check for markers and other nonsense. @@ -1635,7 +1635,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn vtable_builtin_data(&mut self, obligation: &Obligation, bound: ty::BuiltinBound, - nested: Vec<ty::t>) + nested: Vec<Ty>) -> VtableBuiltinData<Obligation> { let obligations = nested.iter().map(|&t| { @@ -1829,7 +1829,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { fn match_inherent_impl(&mut self, impl_def_id: ast::DefId, obligation_cause: ObligationCause, - obligation_self_ty: ty::t) + obligation_self_ty: Ty) -> Result<Substs,()> { /*! @@ -1878,10 +1878,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { cause: ObligationCause, // The self type provided by the impl/caller-obligation: - provided_self_ty: ty::t, + provided_self_ty: Ty, // The self type the obligation is for: - required_self_ty: ty::t) + required_self_ty: Ty) -> Result<(),()> { // FIXME(#5781) -- equating the types is stronger than diff --git a/src/librustc/middle/traits/util.rs b/src/librustc/middle/traits/util.rs index 8f8203f0281..41cdbc0948f 100644 --- a/src/librustc/middle/traits/util.rs +++ b/src/librustc/middle/traits/util.rs @@ -12,7 +12,7 @@ use middle::subst; use middle::subst::{ParamSpace, Substs, VecPerParamSpace}; use middle::typeck::infer::InferCtxt; -use middle::ty; +use middle::ty::{mod, Ty}; use std::collections::HashSet; use std::fmt; use std::rc::Rc; @@ -174,7 +174,7 @@ pub fn obligations_for_generics(tcx: &ty::ctxt, cause: ObligationCause, recursion_depth: uint, generic_bounds: &ty::GenericBounds, - type_substs: &VecPerParamSpace<ty::t>) + type_substs: &VecPerParamSpace<Ty>) -> VecPerParamSpace<Obligation> { /*! See `super::obligations_for_generics` */ @@ -207,7 +207,7 @@ fn push_obligations_for_param_bounds( space: subst::ParamSpace, index: uint, param_bounds: &ty::ParamBounds, - param_type_substs: &VecPerParamSpace<ty::t>, + param_type_substs: &VecPerParamSpace<Ty>, obligations: &mut VecPerParamSpace<Obligation>) { let param_ty = *param_type_substs.get(space, index); @@ -235,7 +235,7 @@ fn push_obligations_for_param_bounds( pub fn trait_ref_for_builtin_bound( tcx: &ty::ctxt, builtin_bound: ty::BuiltinBound, - param_ty: ty::t) + param_ty: Ty) -> Option<Rc<ty::TraitRef>> { match tcx.lang_items.from_builtin_kind(builtin_bound) { @@ -257,7 +257,7 @@ pub fn obligation_for_builtin_bound( cause: ObligationCause, builtin_bound: ty::BuiltinBound, recursion_depth: uint, - param_ty: ty::t) + param_ty: Ty) -> Result<Obligation, ErrorReported> { let trait_ref = trait_ref_for_builtin_bound(tcx, builtin_bound, param_ty); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 9f90afa3749..8a1bbe017f2 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -223,7 +223,7 @@ pub struct AssociatedType { #[deriving(Clone, PartialEq, Eq, Hash, Show)] pub struct mt { - pub ty: t, + pub ty: Ty, pub mutbl: ast::Mutability, } @@ -280,7 +280,7 @@ impl<W:Writer> Hash<W> for intern_key { pub enum ast_ty_to_ty_cache_entry { atttce_unresolved, /* not resolved yet */ - atttce_resolved(t) /* resolved to a type, irrespective of region */ + atttce_resolved(Ty) /* resolved to a type, irrespective of region */ } #[deriving(Clone, PartialEq, Decodable, Encodable)] @@ -310,7 +310,7 @@ pub enum UnsizeKind { // An unsize coercion applied to the tail field of a struct. // The uint is the index of the type parameter which is unsized. UnsizeStruct(Box<UnsizeKind>, uint), - UnsizeVtable(TyTrait, /* the self type of the trait */ ty::t) + UnsizeVtable(TyTrait, /* the self type of the trait */ Ty) } #[deriving(Clone, Show)] @@ -397,8 +397,8 @@ pub fn adjust_is_object(adj: &AutoAdjustment) -> bool { // If possible, returns the type expected from the given adjustment. This is not // possible if the adjustment depends on the type of the adjusted expression. -pub fn type_of_adjust(cx: &ctxt, adj: &AutoAdjustment) -> Option<t> { - fn type_of_autoref(cx: &ctxt, autoref: &AutoRef) -> Option<t> { +pub fn type_of_adjust(cx: &ctxt, adj: &AutoAdjustment) -> Option<Ty> { + fn type_of_autoref(cx: &ctxt, autoref: &AutoRef) -> Option<Ty> { match autoref { &AutoUnsize(ref k) => match k { &UnsizeVtable(TyTrait { ref principal, bounds }, _) => { @@ -414,13 +414,13 @@ pub fn type_of_adjust(cx: &ctxt, adj: &AutoAdjustment) -> Option<t> { }, &AutoPtr(r, m, Some(box ref autoref)) => { match type_of_autoref(cx, autoref) { - Some(t) => Some(mk_rptr(cx, r, mt {mutbl: m, ty: t})), + Some(ty) => Some(mk_rptr(cx, r, mt {mutbl: m, ty: ty})), None => None } } &AutoUnsafe(m, Some(box ref autoref)) => { match type_of_autoref(cx, autoref) { - Some(t) => Some(mk_ptr(cx, mt {mutbl: m, ty: t})), + Some(ty) => Some(mk_ptr(cx, mt {mutbl: m, ty: ty})), None => None } } @@ -444,9 +444,9 @@ pub struct TransmuteRestriction { /// The span from whence the restriction comes. pub span: Span, /// The type being transmuted from. - pub from: t, + pub from: Ty, /// The type being transmuted to. - pub to: t, + pub to: Ty, /// NodeIf of the transmute intrinsic. pub id: ast::NodeId, } @@ -471,7 +471,7 @@ pub struct ctxt<'tcx> { /// Stores the types for various nodes in the AST. Note that this table /// is not guaranteed to be populated until after typeck. See /// typeck::check::fn_ctxt for details. - pub node_types: RefCell<NodeMap<t>>, + pub node_types: RefCell<NodeMap<Ty>>, /// Stores the type parameters which were substituted to obtain the type /// of this node. This only applies to nodes that refer to entities @@ -498,18 +498,18 @@ pub struct ctxt<'tcx> { pub object_cast_map: typeck::ObjectCastMap, pub map: ast_map::Map<'tcx>, - pub intrinsic_defs: RefCell<DefIdMap<t>>, + pub intrinsic_defs: RefCell<DefIdMap<Ty>>, pub freevars: RefCell<FreevarMap>, pub tcache: RefCell<DefIdMap<Polytype>>, - pub rcache: RefCell<FnvHashMap<creader_cache_key, t>>, - pub short_names_cache: RefCell<FnvHashMap<t, String>>, - pub needs_unwind_cleanup_cache: RefCell<FnvHashMap<t, bool>>, - pub tc_cache: RefCell<FnvHashMap<t, TypeContents>>, + pub rcache: RefCell<FnvHashMap<creader_cache_key, Ty>>, + pub short_names_cache: RefCell<FnvHashMap<Ty, String>>, + pub needs_unwind_cleanup_cache: RefCell<FnvHashMap<Ty, bool>>, + pub tc_cache: RefCell<FnvHashMap<Ty, TypeContents>>, pub ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>, pub enum_var_cache: RefCell<DefIdMap<Rc<Vec<Rc<VariantInfo>>>>>, pub ty_param_defs: RefCell<NodeMap<TypeParameterDef>>, pub adjustments: RefCell<NodeMap<AutoAdjustment>>, - pub normalized_cache: RefCell<FnvHashMap<t, t>>, + pub normalized_cache: RefCell<FnvHashMap<Ty, Ty>>, pub lang_items: middle::lang_items::LanguageItems, /// A mapping of fake provided method def_ids to the default implementation pub provided_method_sources: RefCell<DefIdMap<ast::DefId>>, @@ -641,23 +641,23 @@ impl fmt::Show for TypeFlags { // To reduce refcounting cost, we're representing types as unsafe pointers // throughout the compiler. These are simply casted t_box values. Use ty::get // to cast them back to a box. (Without the cast, compiler performance suffers -// ~15%.) This does mean that a t value relies on the ctxt to keep its box +// ~15%.) This does mean that a Ty value relies on the ctxt to keep its box // alive, and using ty::get is unsafe when the ctxt is no longer alive. enum t_opaque {} #[allow(raw_pointer_deriving)] #[deriving(Clone, PartialEq, Eq, Hash)] -pub struct t { inner: *const t_opaque } +pub struct Ty { inner: *const t_opaque } -impl fmt::Show for t { +impl fmt::Show for Ty { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", get(*self)) } } -pub fn get(t: t) -> t_box { +pub fn get(ty: Ty) -> t_box { unsafe { - let t2: t_box = mem::transmute(t); + let t2: t_box = mem::transmute(ty); t2 } } @@ -665,20 +665,24 @@ pub fn get(t: t) -> t_box { fn tbox_has_flag(tb: t_box, flag: TypeFlags) -> bool { tb.flags.intersects(flag) } -pub fn type_has_params(t: t) -> bool { - tbox_has_flag(get(t), HAS_PARAMS) +pub fn type_has_params(ty: Ty) -> bool { + tbox_has_flag(get(ty), HAS_PARAMS) } -pub fn type_has_self(t: t) -> bool { tbox_has_flag(get(t), HAS_SELF) } -pub fn type_has_ty_infer(t: t) -> bool { tbox_has_flag(get(t), HAS_TY_INFER) } -pub fn type_needs_infer(t: t) -> bool { - tbox_has_flag(get(t), HAS_TY_INFER | HAS_RE_INFER) +pub fn type_has_self(ty: Ty) -> bool { + tbox_has_flag(get(ty), HAS_SELF) +} +pub fn type_has_ty_infer(ty: Ty) -> bool { + tbox_has_flag(get(ty), HAS_TY_INFER) +} +pub fn type_needs_infer(ty: Ty) -> bool { + tbox_has_flag(get(ty), HAS_TY_INFER | HAS_RE_INFER) } -pub fn type_has_late_bound_regions(ty: t) -> bool { +pub fn type_has_late_bound_regions(ty: Ty) -> bool { get(ty).flags.intersects(HAS_RE_LATE_BOUND) } -pub fn type_has_escaping_regions(t: t) -> bool { +pub fn type_has_escaping_regions(ty: Ty) -> bool { /*! * An "escaping region" is a bound region whose binder is not part of `t`. * @@ -711,11 +715,11 @@ pub fn type_has_escaping_regions(t: t) -> bool { * this processing has not yet been done. */ - type_escapes_depth(t, 0) + type_escapes_depth(ty, 0) } -pub fn type_escapes_depth(t: t, depth: uint) -> bool { - get(t).region_depth > depth +pub fn type_escapes_depth(ty: Ty, depth: uint) -> bool { + get(ty).region_depth > depth } #[deriving(Clone, PartialEq, Eq, Hash, Show)] @@ -737,12 +741,12 @@ pub struct ClosureTy { #[deriving(Clone, PartialEq, Eq, Hash)] pub enum FnOutput { - FnConverging(ty::t), + FnConverging(Ty), FnDiverging } impl FnOutput { - pub fn unwrap(&self) -> ty::t { + pub fn unwrap(&self) -> Ty { match *self { ty::FnConverging(ref t) => *t, ty::FnDiverging => unreachable!() @@ -764,7 +768,7 @@ impl FnOutput { */ #[deriving(Clone, PartialEq, Eq, Hash)] pub struct FnSig { - pub inputs: Vec<t>, + pub inputs: Vec<Ty>, pub output: FnOutput, pub variadic: bool } @@ -1073,9 +1077,9 @@ pub enum sty { /// the `ast_ty_to_ty_cache`. This is probably true for `ty_struct` as /// well.` ty_enum(DefId, Substs), - ty_uniq(t), + ty_uniq(Ty), ty_str, - ty_vec(t, Option<uint>), // Second field is length. + ty_vec(Ty, Option<uint>), // Second field is length. ty_ptr(mt), ty_rptr(Region, mt), ty_bare_fn(BareFnTy), @@ -1083,10 +1087,10 @@ pub enum sty { ty_trait(Box<TyTrait>), ty_struct(DefId, Substs), ty_unboxed_closure(DefId, Region, Substs), - ty_tup(Vec<t>), + ty_tup(Vec<Ty>), ty_param(ParamTy), // type parameter - ty_open(t), // A deref'ed fat pointer, i.e., a dynamically sized value + ty_open(Ty), // A deref'ed fat pointer, i.e., a dynamically sized value // and its size. Only ever used in trans. It is not necessary // earlier since we don't need to distinguish a DST with its // size (e.g., in a deref) vs a DST with the size elsewhere ( @@ -1188,7 +1192,7 @@ pub enum type_err { terr_regions_insufficiently_polymorphic(BoundRegion, Region), terr_regions_overly_polymorphic(BoundRegion, Region), terr_trait_stores_differ(terr_vstore_kind, expected_found<TraitStore>), - terr_sorts(expected_found<t>), + terr_sorts(expected_found<Ty>), terr_integer_as_char, terr_int_mismatch(expected_found<IntVarValue>), terr_float_mismatch(expected_found<ast::FloatTy>), @@ -1376,7 +1380,7 @@ pub struct TypeParameterDef { pub index: uint, pub associated_with: Option<ast::DefId>, pub bounds: ParamBounds, - pub default: Option<ty::t>, + pub default: Option<Ty>, } #[deriving(Encodable, Decodable, Clone, Show)] @@ -1462,11 +1466,11 @@ impl TraitRef { TraitRef { def_id: def_id, substs: substs } } - pub fn self_ty(&self) -> ty::t { + pub fn self_ty(&self) -> Ty { self.substs.self_ty().unwrap() } - pub fn input_types(&self) -> &[ty::t] { + pub fn input_types(&self) -> &[Ty] { // Select only the "input types" from a trait-reference. For // now this is all the types that appear in the // trait-reference, but it should eventually exclude @@ -1638,7 +1642,7 @@ impl ParameterEnvironment { #[deriving(Clone, Show)] pub struct Polytype { pub generics: Generics, - pub ty: t + pub ty: Ty } /// As `Polytype` but for a trait ref. @@ -1768,8 +1772,8 @@ pub fn mk_ctxt<'tcx>(s: Session, // Type constructors // Interns a type/name combination, stores the resulting box in cx.interner, -// and returns the box as cast to an unsafe ptr (see comments for t above). -pub fn mk_t(cx: &ctxt, st: sty) -> t { +// and returns the box as cast to an unsafe ptr (see comments for Ty above). +pub fn mk_t(cx: &ctxt, st: sty) -> Ty { // Check for primitive types. match st { ty_err => return mk_err(), @@ -1784,28 +1788,28 @@ pub fn mk_t(cx: &ctxt, st: sty) -> t { let key = intern_key { sty: &st }; match cx.interner.borrow().get(&key) { - Some(t) => unsafe { return mem::transmute(&t.sty); }, + Some(ty) => unsafe { return mem::transmute(&ty.sty); }, _ => () } let flags = FlagComputation::for_sty(&st); - let t = cx.type_arena.alloc(t_box_ { + let ty = cx.type_arena.alloc(t_box_ { sty: st, flags: flags.flags, region_depth: flags.depth, }); - let sty_ptr = &t.sty as *const sty; + let sty_ptr = &ty.sty as *const sty; let key = intern_key { sty: sty_ptr, }; - cx.interner.borrow_mut().insert(key, t); + cx.interner.borrow_mut().insert(key, ty); unsafe { - mem::transmute::<*const sty, t>(sty_ptr) + mem::transmute::<*const sty, Ty>(sty_ptr) } } @@ -1938,13 +1942,13 @@ impl FlagComputation { } } - fn add_ty(&mut self, t: t) { - let t_box = get(t); + fn add_ty(&mut self, ty: Ty) { + let t_box = get(ty); self.add_flags(t_box.flags); self.add_depth(t_box.region_depth); } - fn add_tys(&mut self, tys: &[t]) { + fn add_tys(&mut self, tys: &[Ty]) { for &ty in tys.iter() { self.add_ty(ty); } @@ -1992,55 +1996,55 @@ impl FlagComputation { } #[inline] -pub fn mk_prim_t(primitive: &'static t_box_) -> t { +pub fn mk_prim_t(primitive: &'static t_box_) -> Ty { unsafe { - mem::transmute::<&'static t_box_, t>(primitive) + mem::transmute::<&'static t_box_, Ty>(primitive) } } #[inline] -pub fn mk_err() -> t { mk_prim_t(&primitives::TY_ERR) } +pub fn mk_err() -> Ty { mk_prim_t(&primitives::TY_ERR) } #[inline] -pub fn mk_bool() -> t { mk_prim_t(&primitives::TY_BOOL) } +pub fn mk_bool() -> Ty { mk_prim_t(&primitives::TY_BOOL) } #[inline] -pub fn mk_int() -> t { mk_prim_t(&primitives::TY_INT) } +pub fn mk_int() -> Ty { mk_prim_t(&primitives::TY_INT) } #[inline] -pub fn mk_i8() -> t { mk_prim_t(&primitives::TY_I8) } +pub fn mk_i8() -> Ty { mk_prim_t(&primitives::TY_I8) } #[inline] -pub fn mk_i16() -> t { mk_prim_t(&primitives::TY_I16) } +pub fn mk_i16() -> Ty { mk_prim_t(&primitives::TY_I16) } #[inline] -pub fn mk_i32() -> t { mk_prim_t(&primitives::TY_I32) } +pub fn mk_i32() -> Ty { mk_prim_t(&primitives::TY_I32) } #[inline] -pub fn mk_i64() -> t { mk_prim_t(&primitives::TY_I64) } +pub fn mk_i64() -> Ty { mk_prim_t(&primitives::TY_I64) } #[inline] -pub fn mk_f32() -> t { mk_prim_t(&primitives::TY_F32) } +pub fn mk_f32() -> Ty { mk_prim_t(&primitives::TY_F32) } #[inline] -pub fn mk_f64() -> t { mk_prim_t(&primitives::TY_F64) } +pub fn mk_f64() -> Ty { mk_prim_t(&primitives::TY_F64) } #[inline] -pub fn mk_uint() -> t { mk_prim_t(&primitives::TY_UINT) } +pub fn mk_uint() -> Ty { mk_prim_t(&primitives::TY_UINT) } #[inline] -pub fn mk_u8() -> t { mk_prim_t(&primitives::TY_U8) } +pub fn mk_u8() -> Ty { mk_prim_t(&primitives::TY_U8) } #[inline] -pub fn mk_u16() -> t { mk_prim_t(&primitives::TY_U16) } +pub fn mk_u16() -> Ty { mk_prim_t(&primitives::TY_U16) } #[inline] -pub fn mk_u32() -> t { mk_prim_t(&primitives::TY_U32) } +pub fn mk_u32() -> Ty { mk_prim_t(&primitives::TY_U32) } #[inline] -pub fn mk_u64() -> t { mk_prim_t(&primitives::TY_U64) } +pub fn mk_u64() -> Ty { mk_prim_t(&primitives::TY_U64) } -pub fn mk_mach_int(tm: ast::IntTy) -> t { +pub fn mk_mach_int(tm: ast::IntTy) -> Ty { match tm { ast::TyI => mk_int(), ast::TyI8 => mk_i8(), @@ -2050,7 +2054,7 @@ pub fn mk_mach_int(tm: ast::IntTy) -> t { } } -pub fn mk_mach_uint(tm: ast::UintTy) -> t { +pub fn mk_mach_uint(tm: ast::UintTy) -> Ty { match tm { ast::TyU => mk_uint(), ast::TyU8 => mk_u8(), @@ -2060,7 +2064,7 @@ pub fn mk_mach_uint(tm: ast::UintTy) -> t { } } -pub fn mk_mach_float(tm: ast::FloatTy) -> t { +pub fn mk_mach_float(tm: ast::FloatTy) -> Ty { match tm { ast::TyF32 => mk_f32(), ast::TyF64 => mk_f64(), @@ -2068,13 +2072,13 @@ pub fn mk_mach_float(tm: ast::FloatTy) -> t { } #[inline] -pub fn mk_char() -> t { mk_prim_t(&primitives::TY_CHAR) } +pub fn mk_char() -> Ty { mk_prim_t(&primitives::TY_CHAR) } -pub fn mk_str(cx: &ctxt) -> t { +pub fn mk_str(cx: &ctxt) -> Ty { mk_t(cx, ty_str) } -pub fn mk_str_slice(cx: &ctxt, r: Region, m: ast::Mutability) -> t { +pub fn mk_str_slice(cx: &ctxt, r: Region, m: ast::Mutability) -> Ty { mk_rptr(cx, r, mt { ty: mk_t(cx, ty_str), @@ -2082,41 +2086,41 @@ pub fn mk_str_slice(cx: &ctxt, r: Region, m: ast::Mutability) -> t { }) } -pub fn mk_enum(cx: &ctxt, did: ast::DefId, substs: Substs) -> t { +pub fn mk_enum(cx: &ctxt, did: ast::DefId, substs: Substs) -> Ty { // take a copy of substs so that we own the vectors inside mk_t(cx, ty_enum(did, substs)) } -pub fn mk_uniq(cx: &ctxt, ty: t) -> t { mk_t(cx, ty_uniq(ty)) } +pub fn mk_uniq(cx: &ctxt, ty: Ty) -> Ty { mk_t(cx, ty_uniq(ty)) } -pub fn mk_ptr(cx: &ctxt, tm: mt) -> t { mk_t(cx, ty_ptr(tm)) } +pub fn mk_ptr(cx: &ctxt, tm: mt) -> Ty { mk_t(cx, ty_ptr(tm)) } -pub fn mk_rptr(cx: &ctxt, r: Region, tm: mt) -> t { mk_t(cx, ty_rptr(r, tm)) } +pub fn mk_rptr(cx: &ctxt, r: Region, tm: mt) -> Ty { mk_t(cx, ty_rptr(r, tm)) } -pub fn mk_mut_rptr(cx: &ctxt, r: Region, ty: t) -> t { +pub fn mk_mut_rptr(cx: &ctxt, r: Region, ty: Ty) -> Ty { mk_rptr(cx, r, mt {ty: ty, mutbl: ast::MutMutable}) } -pub fn mk_imm_rptr(cx: &ctxt, r: Region, ty: t) -> t { +pub fn mk_imm_rptr(cx: &ctxt, r: Region, ty: Ty) -> Ty { mk_rptr(cx, r, mt {ty: ty, mutbl: ast::MutImmutable}) } -pub fn mk_mut_ptr(cx: &ctxt, ty: t) -> t { +pub fn mk_mut_ptr(cx: &ctxt, ty: Ty) -> Ty { mk_ptr(cx, mt {ty: ty, mutbl: ast::MutMutable}) } -pub fn mk_imm_ptr(cx: &ctxt, ty: t) -> t { +pub fn mk_imm_ptr(cx: &ctxt, ty: Ty) -> Ty { mk_ptr(cx, mt {ty: ty, mutbl: ast::MutImmutable}) } -pub fn mk_nil_ptr(cx: &ctxt) -> t { +pub fn mk_nil_ptr(cx: &ctxt) -> Ty { mk_ptr(cx, mt {ty: mk_nil(cx), mutbl: ast::MutImmutable}) } -pub fn mk_vec(cx: &ctxt, t: t, sz: Option<uint>) -> t { - mk_t(cx, ty_vec(t, sz)) +pub fn mk_vec(cx: &ctxt, ty: Ty, sz: Option<uint>) -> Ty { + mk_t(cx, ty_vec(ty, sz)) } -pub fn mk_slice(cx: &ctxt, r: Region, tm: mt) -> t { +pub fn mk_slice(cx: &ctxt, r: Region, tm: mt) -> Ty { mk_rptr(cx, r, mt { ty: mk_vec(cx, tm.ty, None), @@ -2124,26 +2128,26 @@ pub fn mk_slice(cx: &ctxt, r: Region, tm: mt) -> t { }) } -pub fn mk_tup(cx: &ctxt, ts: Vec<t>) -> t { +pub fn mk_tup(cx: &ctxt, ts: Vec<Ty>) -> Ty { mk_t(cx, ty_tup(ts)) } -pub fn mk_nil(cx: &ctxt) -> t { +pub fn mk_nil(cx: &ctxt) -> Ty { mk_tup(cx, Vec::new()) } -pub fn mk_closure(cx: &ctxt, fty: ClosureTy) -> t { +pub fn mk_closure(cx: &ctxt, fty: ClosureTy) -> Ty { mk_t(cx, ty_closure(box fty)) } -pub fn mk_bare_fn(cx: &ctxt, fty: BareFnTy) -> t { +pub fn mk_bare_fn(cx: &ctxt, fty: BareFnTy) -> Ty { mk_t(cx, ty_bare_fn(fty)) } pub fn mk_ctor_fn(cx: &ctxt, - input_tys: &[ty::t], - output: ty::t) -> t { - let input_args = input_tys.iter().map(|t| *t).collect(); + input_tys: &[Ty], + output: Ty) -> Ty { + let input_args = input_tys.iter().map(|ty| *ty).collect(); mk_bare_fn(cx, BareFnTy { fn_style: ast::NormalFn, @@ -2160,7 +2164,7 @@ pub fn mk_ctor_fn(cx: &ctxt, pub fn mk_trait(cx: &ctxt, principal: ty::TraitRef, bounds: ExistentialBounds) - -> t { + -> Ty { // take a copy of substs so that we own the vectors inside let inner = box TyTrait { principal: principal, @@ -2169,43 +2173,43 @@ pub fn mk_trait(cx: &ctxt, mk_t(cx, ty_trait(inner)) } -pub fn mk_struct(cx: &ctxt, struct_id: ast::DefId, substs: Substs) -> t { +pub fn mk_struct(cx: &ctxt, struct_id: ast::DefId, substs: Substs) -> Ty { // take a copy of substs so that we own the vectors inside mk_t(cx, ty_struct(struct_id, substs)) } pub fn mk_unboxed_closure(cx: &ctxt, closure_id: ast::DefId, region: Region, substs: Substs) - -> t { + -> Ty { mk_t(cx, ty_unboxed_closure(closure_id, region, substs)) } -pub fn mk_var(cx: &ctxt, v: TyVid) -> t { mk_infer(cx, TyVar(v)) } +pub fn mk_var(cx: &ctxt, v: TyVid) -> Ty { mk_infer(cx, TyVar(v)) } -pub fn mk_int_var(cx: &ctxt, v: IntVid) -> t { mk_infer(cx, IntVar(v)) } +pub fn mk_int_var(cx: &ctxt, v: IntVid) -> Ty { mk_infer(cx, IntVar(v)) } -pub fn mk_float_var(cx: &ctxt, v: FloatVid) -> t { mk_infer(cx, FloatVar(v)) } +pub fn mk_float_var(cx: &ctxt, v: FloatVid) -> Ty { mk_infer(cx, FloatVar(v)) } -pub fn mk_infer(cx: &ctxt, it: InferTy) -> t { mk_t(cx, ty_infer(it)) } +pub fn mk_infer(cx: &ctxt, it: InferTy) -> Ty { mk_t(cx, ty_infer(it)) } -pub fn mk_param(cx: &ctxt, space: subst::ParamSpace, n: uint, k: DefId) -> t { +pub fn mk_param(cx: &ctxt, space: subst::ParamSpace, n: uint, k: DefId) -> Ty { mk_t(cx, ty_param(ParamTy { space: space, idx: n, def_id: k })) } -pub fn mk_self_type(cx: &ctxt, did: ast::DefId) -> t { +pub fn mk_self_type(cx: &ctxt, did: ast::DefId) -> Ty { mk_param(cx, subst::SelfSpace, 0, did) } -pub fn mk_param_from_def(cx: &ctxt, def: &TypeParameterDef) -> t { +pub fn mk_param_from_def(cx: &ctxt, def: &TypeParameterDef) -> Ty { mk_param(cx, def.space, def.index, def.def_id) } -pub fn mk_open(cx: &ctxt, t: t) -> t { mk_t(cx, ty_open(t)) } +pub fn mk_open(cx: &ctxt, ty: Ty) -> Ty { mk_t(cx, ty_open(ty)) } -pub fn walk_ty(ty: t, f: |t|) { - maybe_walk_ty(ty, |t| { f(t); true }); +pub fn walk_ty(ty: Ty, f: |Ty|) { + maybe_walk_ty(ty, |ty| { f(ty); true }); } -pub fn maybe_walk_ty(ty: t, f: |t| -> bool) { +pub fn maybe_walk_ty(ty: Ty, f: |Ty| -> bool) { if !f(ty) { return; } @@ -2245,7 +2249,7 @@ pub fn maybe_walk_ty(ty: t, f: |t| -> bool) { } // Folds types from the bottom up. -pub fn fold_ty(cx: &ctxt, t0: t, fldop: |t| -> t) -> t { +pub fn fold_ty(cx: &ctxt, t0: Ty, fldop: |Ty| -> Ty) -> Ty { let mut f = ty_fold::BottomUpFolder {tcx: cx, fldop: fldop}; f.fold_ty(t0) } @@ -2266,7 +2270,7 @@ impl ParamTy { ParamTy::new(def.space, def.index, def.def_id) } - pub fn to_ty(self, tcx: &ty::ctxt) -> ty::t { + pub fn to_ty(self, tcx: &ty::ctxt) -> Ty { ty::mk_param(tcx, self.space, self.idx, self.def_id) } @@ -2297,42 +2301,42 @@ impl ParamBounds { // Type utilities -pub fn type_is_nil(ty: t) -> bool { +pub fn type_is_nil(ty: Ty) -> bool { match get(ty).sty { ty_tup(ref tys) => tys.is_empty(), _ => false } } -pub fn type_is_error(ty: t) -> bool { +pub fn type_is_error(ty: Ty) -> bool { get(ty).flags.intersects(HAS_TY_ERR) } -pub fn type_needs_subst(ty: t) -> bool { +pub fn type_needs_subst(ty: Ty) -> bool { tbox_has_flag(get(ty), NEEDS_SUBST) } pub fn trait_ref_contains_error(tref: &ty::TraitRef) -> bool { - tref.substs.types.any(|&t| type_is_error(t)) + tref.substs.types.any(|&ty| type_is_error(ty)) } -pub fn type_is_ty_var(ty: t) -> bool { +pub fn type_is_ty_var(ty: Ty) -> bool { match get(ty).sty { ty_infer(TyVar(_)) => true, _ => false } } -pub fn type_is_bool(ty: t) -> bool { get(ty).sty == ty_bool } +pub fn type_is_bool(ty: Ty) -> bool { get(ty).sty == ty_bool } -pub fn type_is_self(ty: t) -> bool { +pub fn type_is_self(ty: Ty) -> bool { match get(ty).sty { ty_param(ref p) => p.space == subst::SelfSpace, _ => false } } -fn type_is_slice(ty: t) -> bool { +fn type_is_slice(ty: Ty) -> bool { match get(ty).sty { ty_ptr(mt) | ty_rptr(_, mt) => match get(mt.ty).sty { ty_vec(_, None) | ty_str => true, @@ -2342,11 +2346,11 @@ fn type_is_slice(ty: t) -> bool { } } -pub fn type_is_vec(ty: t) -> bool { +pub fn type_is_vec(ty: Ty) -> bool { match get(ty).sty { ty_vec(..) => true, - ty_ptr(mt{ty: t, ..}) | ty_rptr(_, mt{ty: t, ..}) | - ty_uniq(t) => match get(t).sty { + ty_ptr(mt{ty, ..}) | ty_rptr(_, mt{ty, ..}) | + ty_uniq(ty) => match get(ty).sty { ty_vec(_, None) => true, _ => false }, @@ -2354,7 +2358,7 @@ pub fn type_is_vec(ty: t) -> bool { } } -pub fn type_is_structural(ty: t) -> bool { +pub fn type_is_structural(ty: Ty) -> bool { match get(ty).sty { ty_struct(..) | ty_tup(_) | ty_enum(..) | ty_closure(_) | ty_vec(_, Some(_)) | ty_unboxed_closure(..) => true, @@ -2362,14 +2366,14 @@ pub fn type_is_structural(ty: t) -> bool { } } -pub fn type_is_simd(cx: &ctxt, ty: t) -> bool { +pub fn type_is_simd(cx: &ctxt, ty: Ty) -> bool { match get(ty).sty { ty_struct(did, _) => lookup_simd(cx, did), _ => false } } -pub fn sequence_element_type(cx: &ctxt, ty: t) -> t { +pub fn sequence_element_type(cx: &ctxt, ty: Ty) -> Ty { match get(ty).sty { ty_vec(ty, _) => ty, ty_str => mk_mach_uint(ast::TyU8), @@ -2379,7 +2383,7 @@ pub fn sequence_element_type(cx: &ctxt, ty: t) -> t { } } -pub fn simd_type(cx: &ctxt, ty: t) -> t { +pub fn simd_type(cx: &ctxt, ty: Ty) -> Ty { match get(ty).sty { ty_struct(did, ref substs) => { let fields = lookup_struct_fields(cx, did); @@ -2389,7 +2393,7 @@ pub fn simd_type(cx: &ctxt, ty: t) -> t { } } -pub fn simd_size(cx: &ctxt, ty: t) -> uint { +pub fn simd_size(cx: &ctxt, ty: Ty) -> uint { match get(ty).sty { ty_struct(did, _) => { let fields = lookup_struct_fields(cx, did); @@ -2399,21 +2403,21 @@ pub fn simd_size(cx: &ctxt, ty: t) -> uint { } } -pub fn type_is_region_ptr(ty: t) -> bool { +pub fn type_is_region_ptr(ty: Ty) -> bool { match get(ty).sty { ty_rptr(..) => true, _ => false } } -pub fn type_is_unsafe_ptr(ty: t) -> bool { +pub fn type_is_unsafe_ptr(ty: Ty) -> bool { match get(ty).sty { ty_ptr(_) => return true, _ => return false } } -pub fn type_is_unique(ty: t) -> bool { +pub fn type_is_unique(ty: Ty) -> bool { match get(ty).sty { ty_uniq(_) => match get(ty).sty { ty_trait(..) => false, @@ -2423,7 +2427,7 @@ pub fn type_is_unique(ty: t) -> bool { } } -pub fn type_is_fat_ptr(cx: &ctxt, ty: t) -> bool { +pub fn type_is_fat_ptr(cx: &ctxt, ty: Ty) -> bool { match get(ty).sty { ty_ptr(mt{ty, ..}) | ty_rptr(_, mt{ty, ..}) | ty_uniq(ty) if !type_is_sized(cx, ty) => true, @@ -2436,7 +2440,7 @@ pub fn type_is_fat_ptr(cx: &ctxt, ty: t) -> bool { (A ty_ptr is scalar because it represents a non-managed pointer, so its contents are abstract to rustc.) */ -pub fn type_is_scalar(ty: t) -> bool { +pub fn type_is_scalar(ty: Ty) -> bool { match get(ty).sty { ty_bool | ty_char | ty_int(_) | ty_float(_) | ty_uint(_) | ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) | @@ -2447,14 +2451,14 @@ pub fn type_is_scalar(ty: t) -> bool { } /// Returns true if this type is a floating point type and false otherwise. -pub fn type_is_floating_point(ty: t) -> bool { +pub fn type_is_floating_point(ty: Ty) -> bool { match get(ty).sty { ty_float(_) => true, _ => false, } } -pub fn type_needs_drop(cx: &ctxt, ty: t) -> bool { +pub fn type_needs_drop(cx: &ctxt, ty: Ty) -> bool { type_contents(cx, ty).needs_drop(cx) } @@ -2462,12 +2466,12 @@ pub fn type_needs_drop(cx: &ctxt, ty: t) -> bool { // task can free them all at once later. Currently only things // that only contain scalars and shared boxes can avoid unwind // cleanups. -pub fn type_needs_unwind_cleanup(cx: &ctxt, ty: t) -> bool { +pub fn type_needs_unwind_cleanup(cx: &ctxt, ty: Ty) -> bool { return memoized(&cx.needs_unwind_cleanup_cache, ty, |ty| { type_needs_unwind_cleanup_(cx, ty, &mut FnvHashSet::new()) }); - fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t, tycache: &mut FnvHashSet<t>) -> bool { + fn type_needs_unwind_cleanup_(cx: &ctxt, ty: Ty, tycache: &mut FnvHashSet<Ty>) -> bool { // Prevent infinite recursion if !tycache.insert(ty) { return false; @@ -2651,7 +2655,7 @@ impl TypeContents { } pub fn union<T>(v: &[T], f: |&T| -> TypeContents) -> TypeContents { - v.iter().fold(TC::None, |tc, t| tc | f(t)) + v.iter().fold(TC::None, |tc, ty| tc | f(ty)) } pub fn has_dtor(&self) -> bool { @@ -2683,18 +2687,18 @@ impl fmt::Show for TypeContents { } } -pub fn type_interior_is_unsafe(cx: &ctxt, t: ty::t) -> bool { - type_contents(cx, t).interior_unsafe() +pub fn type_interior_is_unsafe(cx: &ctxt, ty: Ty) -> bool { + type_contents(cx, ty).interior_unsafe() } -pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { +pub fn type_contents(cx: &ctxt, ty: Ty) -> TypeContents { return memoized(&cx.tc_cache, ty, |ty| { tc_ty(cx, ty, &mut FnvHashMap::new()) }); fn tc_ty(cx: &ctxt, - ty: t, - cache: &mut FnvHashMap<t, TypeContents>) -> TypeContents + ty: Ty, + cache: &mut FnvHashMap<Ty, TypeContents>) -> TypeContents { // Subtle: Note that we are *not* using cx.tc_cache here but rather a // private cache for this walk. This is needed in the case of cyclic @@ -2767,12 +2771,12 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { } } - ty_vec(t, Some(_)) => { - tc_ty(cx, t, cache) + ty_vec(ty, Some(_)) => { + tc_ty(cx, ty, cache) } - ty_vec(t, None) => { - tc_ty(cx, t, cache) | TC::Nonsized + ty_vec(ty, None) => { + tc_ty(cx, ty, cache) | TC::Nonsized } ty_str => TC::Nonsized, @@ -2884,8 +2888,8 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { TC::All } - ty_open(t) => { - let result = tc_ty(cx, t, cache); + ty_open(ty) => { + let result = tc_ty(cx, ty, cache); assert!(!result.is_sized(cx)) result.unsafe_pointer() | TC::Nonsized } @@ -2901,7 +2905,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { fn tc_mt(cx: &ctxt, mt: mt, - cache: &mut FnvHashMap<t, TypeContents>) -> TypeContents + cache: &mut FnvHashMap<Ty, TypeContents>) -> TypeContents { let mc = TC::ReachesMutable.when(mt.mutbl == MutMutable); mc | tc_ty(cx, mt.ty, cache) @@ -3005,18 +3009,18 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { } } -pub fn type_moves_by_default(cx: &ctxt, ty: t) -> bool { +pub fn type_moves_by_default(cx: &ctxt, ty: Ty) -> bool { type_contents(cx, ty).moves_by_default(cx) } -pub fn is_ffi_safe(cx: &ctxt, ty: t) -> bool { +pub fn is_ffi_safe(cx: &ctxt, ty: Ty) -> bool { !type_contents(cx, ty).intersects(TC::ReachesFfiUnsafe) } // True if instantiating an instance of `r_ty` requires an instance of `r_ty`. -pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool { +pub fn is_instantiable(cx: &ctxt, r_ty: Ty) -> bool { fn type_requires(cx: &ctxt, seen: &mut Vec<DefId>, - r_ty: t, ty: t) -> bool { + r_ty: Ty, ty: Ty) -> bool { debug!("type_requires({}, {})?", ::util::ppaux::ty_to_string(cx, r_ty), ::util::ppaux::ty_to_string(cx, ty)); @@ -3034,7 +3038,7 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool { } fn subtypes_require(cx: &ctxt, seen: &mut Vec<DefId>, - r_ty: t, ty: t) -> bool { + r_ty: Ty, ty: Ty) -> bool { debug!("subtypes_require({}, {})?", ::util::ppaux::ty_to_string(cx, r_ty), ::util::ppaux::ty_to_string(cx, ty)); @@ -3093,7 +3097,7 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool { } ty_tup(ref ts) => { - ts.iter().any(|t| type_requires(cx, seen, r_ty, *t)) + ts.iter().any(|ty| type_requires(cx, seen, r_ty, *ty)) } ty_enum(ref did, _) if seen.contains(did) => { @@ -3143,20 +3147,20 @@ pub enum Representability { /// Check whether a type is representable. This means it cannot contain unboxed /// structural recursion. This check is needed for structs and enums. -pub fn is_type_representable(cx: &ctxt, sp: Span, ty: t) -> Representability { +pub fn is_type_representable(cx: &ctxt, sp: Span, ty: Ty) -> Representability { // Iterate until something non-representable is found - fn find_nonrepresentable<It: Iterator<t>>(cx: &ctxt, sp: Span, seen: &mut Vec<t>, + fn find_nonrepresentable<It: Iterator<Ty>>(cx: &ctxt, sp: Span, seen: &mut Vec<Ty>, mut iter: It) -> Representability { iter.fold(Representable, |r, ty| cmp::max(r, is_type_structurally_recursive(cx, sp, seen, ty))) } fn are_inner_types_recursive(cx: &ctxt, sp: Span, - seen: &mut Vec<t>, ty: t) -> Representability { + seen: &mut Vec<Ty>, ty: Ty) -> Representability { match get(ty).sty { ty_tup(ref ts) => { - find_nonrepresentable(cx, sp, seen, ts.iter().map(|t| *t)) + find_nonrepresentable(cx, sp, seen, ts.iter().map(|ty| *ty)) } // Fixed-length vectors. // FIXME(#11924) Behavior undecided for zero-length vectors. @@ -3183,7 +3187,7 @@ pub fn is_type_representable(cx: &ctxt, sp: Span, ty: t) -> Representability { } } - fn same_struct_or_enum_def_id(ty: t, did: DefId) -> bool { + fn same_struct_or_enum_def_id(ty: Ty, did: DefId) -> bool { match get(ty).sty { ty_struct(ty_did, _) | ty_enum(ty_did, _) => { ty_did == did @@ -3192,7 +3196,7 @@ pub fn is_type_representable(cx: &ctxt, sp: Span, ty: t) -> Representability { } } - fn same_type(a: t, b: t) -> bool { + fn same_type(a: Ty, b: Ty) -> bool { match (&get(a).sty, &get(b).sty) { (&ty_struct(did_a, ref substs_a), &ty_struct(did_b, ref substs_b)) | (&ty_enum(did_a, ref substs_a), &ty_enum(did_b, ref substs_b)) => { @@ -3215,8 +3219,8 @@ pub fn is_type_representable(cx: &ctxt, sp: Span, ty: t) -> Representability { // Does the type `ty` directly (without indirection through a pointer) // contain any types on stack `seen`? - fn is_type_structurally_recursive(cx: &ctxt, sp: Span, seen: &mut Vec<t>, - ty: t) -> Representability { + fn is_type_structurally_recursive(cx: &ctxt, sp: Span, seen: &mut Vec<Ty>, + ty: Ty) -> Representability { debug!("is_type_structurally_recursive: {}", ::util::ppaux::ty_to_string(cx, ty)); @@ -3285,18 +3289,18 @@ pub fn is_type_representable(cx: &ctxt, sp: Span, ty: t) -> Representability { // To avoid a stack overflow when checking an enum variant or struct that // contains a different, structurally recursive type, maintain a stack // of seen types and check recursion for each of them (issues #3008, #3779). - let mut seen: Vec<t> = Vec::new(); + let mut seen: Vec<Ty> = Vec::new(); let r = is_type_structurally_recursive(cx, sp, &mut seen, ty); debug!("is_type_representable: {} is {}", ::util::ppaux::ty_to_string(cx, ty), r); r } -pub fn type_is_trait(ty: t) -> bool { +pub fn type_is_trait(ty: Ty) -> bool { type_trait_info(ty).is_some() } -pub fn type_trait_info(ty: t) -> Option<&'static TyTrait> { +pub fn type_trait_info(ty: Ty) -> Option<&'static TyTrait> { match get(ty).sty { ty_uniq(ty) | ty_rptr(_, mt { ty, ..}) | ty_ptr(mt { ty, ..}) => match get(ty).sty { ty_trait(ref t) => Some(&**t), @@ -3307,14 +3311,14 @@ pub fn type_trait_info(ty: t) -> Option<&'static TyTrait> { } } -pub fn type_is_integral(ty: t) -> bool { +pub fn type_is_integral(ty: Ty) -> bool { match get(ty).sty { ty_infer(IntVar(_)) | ty_int(_) | ty_uint(_) => true, _ => false } } -pub fn type_is_skolemized(ty: t) -> bool { +pub fn type_is_skolemized(ty: Ty) -> bool { match get(ty).sty { ty_infer(SkolemizedTy(_)) => true, ty_infer(SkolemizedIntTy(_)) => true, @@ -3322,46 +3326,46 @@ pub fn type_is_skolemized(ty: t) -> bool { } } -pub fn type_is_uint(ty: t) -> bool { +pub fn type_is_uint(ty: Ty) -> bool { match get(ty).sty { ty_infer(IntVar(_)) | ty_uint(ast::TyU) => true, _ => false } } -pub fn type_is_char(ty: t) -> bool { +pub fn type_is_char(ty: Ty) -> bool { match get(ty).sty { ty_char => true, _ => false } } -pub fn type_is_bare_fn(ty: t) -> bool { +pub fn type_is_bare_fn(ty: Ty) -> bool { match get(ty).sty { ty_bare_fn(..) => true, _ => false } } -pub fn type_is_fp(ty: t) -> bool { +pub fn type_is_fp(ty: Ty) -> bool { match get(ty).sty { ty_infer(FloatVar(_)) | ty_float(_) => true, _ => false } } -pub fn type_is_numeric(ty: t) -> bool { +pub fn type_is_numeric(ty: Ty) -> bool { return type_is_integral(ty) || type_is_fp(ty); } -pub fn type_is_signed(ty: t) -> bool { +pub fn type_is_signed(ty: Ty) -> bool { match get(ty).sty { ty_int(_) => true, _ => false } } -pub fn type_is_machine(ty: t) -> bool { +pub fn type_is_machine(ty: Ty) -> bool { match get(ty).sty { ty_int(ast::TyI) | ty_uint(ast::TyU) => false, ty_int(..) | ty_uint(..) | ty_float(..) => true, @@ -3370,21 +3374,21 @@ pub fn type_is_machine(ty: t) -> bool { } // Is the type's representation size known at compile time? -pub fn type_is_sized(cx: &ctxt, ty: t) -> bool { +pub fn type_is_sized(cx: &ctxt, ty: Ty) -> bool { type_contents(cx, ty).is_sized(cx) } -pub fn lltype_is_sized(cx: &ctxt, ty: t) -> bool { +pub fn lltype_is_sized(cx: &ctxt, ty: Ty) -> bool { match get(ty).sty { ty_open(_) => true, _ => type_contents(cx, ty).is_sized(cx) } } -// Return the smallest part of t which is unsized. Fails if t is sized. +// Return the smallest part of ty which is unsized. Fails if ty is sized. // 'Smallest' here means component of the static representation of the type; not // the size of an object at runtime. -pub fn unsized_part_of_type(cx: &ctxt, ty: t) -> t { +pub fn unsized_part_of_type(cx: &ctxt, ty: Ty) -> Ty { match get(ty).sty { ty_str | ty_trait(..) | ty_vec(..) => ty, ty_struct(def_id, ref substs) => { @@ -3405,7 +3409,7 @@ pub fn unsized_part_of_type(cx: &ctxt, ty: t) -> t { // Whether a type is enum like, that is an enum type with only nullary // constructors -pub fn type_is_c_like_enum(cx: &ctxt, ty: t) -> bool { +pub fn type_is_c_like_enum(cx: &ctxt, ty: Ty) -> bool { match get(ty).sty { ty_enum(did, _) => { let variants = enum_variants(cx, did); @@ -3419,12 +3423,12 @@ pub fn type_is_c_like_enum(cx: &ctxt, ty: t) -> bool { } } -// Returns the type and mutability of *t. +// Returns the type and mutability of *ty. // // The parameter `explicit` indicates if this is an *explicit* dereference. // Some types---notably unsafe ptrs---can only be dereferenced explicitly. -pub fn deref(t: t, explicit: bool) -> Option<mt> { - match get(t).sty { +pub fn deref(ty: Ty, explicit: bool) -> Option<mt> { + match get(ty).sty { ty_uniq(ty) => { Some(mt { ty: ty, @@ -3437,43 +3441,42 @@ pub fn deref(t: t, explicit: bool) -> Option<mt> { } } -pub fn deref_or_dont(t: t) -> t { - match get(t).sty { +pub fn deref_or_dont(ty: Ty) -> Ty { + match get(ty).sty { ty_uniq(ty) => ty, ty_rptr(_, mt) | ty_ptr(mt) => mt.ty, - _ => t + _ => ty } } -pub fn close_type(cx: &ctxt, t: t) -> t { - match get(t).sty { - ty_open(t) => mk_rptr(cx, ReStatic, mt {ty: t, mutbl:ast::MutImmutable}), +pub fn close_type(cx: &ctxt, ty: Ty) -> Ty { + match get(ty).sty { + ty_open(ty) => mk_rptr(cx, ReStatic, mt {ty: ty, mutbl:ast::MutImmutable}), _ => cx.sess.bug(format!("Trying to close a non-open type {}", - ty_to_string(cx, t)).as_slice()) + ty_to_string(cx, ty)).as_slice()) } } -pub fn type_content(t: t) -> t { - match get(t).sty { +pub fn type_content(ty: Ty) -> Ty { + match get(ty).sty { ty_uniq(ty) => ty, ty_rptr(_, mt) |ty_ptr(mt) => mt.ty, - _ => t + _ => ty } - } -// Extract the unsized type in an open type (or just return t if it is not open). -pub fn unopen_type(t: t) -> t { - match get(t).sty { - ty_open(t) => t, - _ => t +// Extract the unsized type in an open type (or just return ty if it is not open). +pub fn unopen_type(ty: Ty) -> Ty { + match get(ty).sty { + ty_open(ty) => ty, + _ => ty } } -// Returns the type of t[i] -pub fn index(ty: t) -> Option<t> { +// Returns the type of ty[i] +pub fn index(ty: Ty) -> Option<Ty> { match get(ty).sty { - ty_vec(t, _) => Some(t), + ty_vec(ty, _) => Some(ty), _ => None } } @@ -3481,9 +3484,9 @@ pub fn index(ty: t) -> Option<t> { // Returns the type of elements contained within an 'array-like' type. // This is exactly the same as the above, except it supports strings, // which can't actually be indexed. -pub fn array_element_ty(t: t) -> Option<t> { - match get(t).sty { - ty_vec(t, _) => Some(t), +pub fn array_element_ty(ty: Ty) -> Option<Ty> { + match get(ty).sty { + ty_vec(ty, _) => Some(ty), ty_str => Some(mk_u8()), _ => None } @@ -3491,29 +3494,29 @@ pub fn array_element_ty(t: t) -> Option<t> { pub fn node_id_to_trait_ref(cx: &ctxt, id: ast::NodeId) -> Rc<ty::TraitRef> { match cx.trait_refs.borrow().get(&id) { - Some(t) => t.clone(), + Some(ty) => ty.clone(), None => cx.sess.bug( format!("node_id_to_trait_ref: no trait ref for node `{}`", cx.map.node_to_string(id)).as_slice()) } } -pub fn try_node_id_to_type(cx: &ctxt, id: ast::NodeId) -> Option<t> { +pub fn try_node_id_to_type(cx: &ctxt, id: ast::NodeId) -> Option<Ty> { cx.node_types.borrow().get(&id).cloned() } -pub fn node_id_to_type(cx: &ctxt, id: ast::NodeId) -> t { +pub fn node_id_to_type(cx: &ctxt, id: ast::NodeId) -> Ty { match try_node_id_to_type(cx, id) { - Some(t) => t, + Some(ty) => ty, None => cx.sess.bug( format!("node_id_to_type: no type for node `{}`", cx.map.node_to_string(id)).as_slice()) } } -pub fn node_id_to_type_opt(cx: &ctxt, id: ast::NodeId) -> Option<t> { +pub fn node_id_to_type_opt(cx: &ctxt, id: ast::NodeId) -> Option<Ty> { match cx.node_types.borrow().get(&id) { - Some(&t) => Some(t), + Some(&ty) => Some(ty), None => None } } @@ -3525,7 +3528,7 @@ pub fn node_id_item_substs(cx: &ctxt, id: ast::NodeId) -> ItemSubsts { } } -pub fn fn_is_variadic(fty: t) -> bool { +pub fn fn_is_variadic(fty: Ty) -> bool { match get(fty).sty { ty_bare_fn(ref f) => f.sig.variadic, ty_closure(ref f) => f.sig.variadic, @@ -3535,7 +3538,7 @@ pub fn fn_is_variadic(fty: t) -> bool { } } -pub fn ty_fn_sig(fty: t) -> FnSig { +pub fn ty_fn_sig(fty: Ty) -> FnSig { match get(fty).sty { ty_bare_fn(ref f) => f.sig.clone(), ty_closure(ref f) => f.sig.clone(), @@ -3546,7 +3549,7 @@ pub fn ty_fn_sig(fty: t) -> FnSig { } /// Returns the ABI of the given function. -pub fn ty_fn_abi(fty: t) -> abi::Abi { +pub fn ty_fn_abi(fty: Ty) -> abi::Abi { match get(fty).sty { ty_bare_fn(ref f) => f.abi, ty_closure(ref f) => f.abi, @@ -3555,7 +3558,7 @@ pub fn ty_fn_abi(fty: t) -> abi::Abi { } // Type accessors for substructures of types -pub fn ty_fn_args(fty: t) -> Vec<t> { +pub fn ty_fn_args(fty: Ty) -> Vec<Ty> { match get(fty).sty { ty_bare_fn(ref f) => f.sig.inputs.clone(), ty_closure(ref f) => f.sig.inputs.clone(), @@ -3565,7 +3568,7 @@ pub fn ty_fn_args(fty: t) -> Vec<t> { } } -pub fn ty_closure_store(fty: t) -> TraitStore { +pub fn ty_closure_store(fty: Ty) -> TraitStore { match get(fty).sty { ty_closure(ref f) => f.store, ty_unboxed_closure(..) => { @@ -3579,7 +3582,7 @@ pub fn ty_closure_store(fty: t) -> TraitStore { } } -pub fn ty_fn_ret(fty: t) -> FnOutput { +pub fn ty_fn_ret(fty: Ty) -> FnOutput { match get(fty).sty { ty_bare_fn(ref f) => f.sig.output, ty_closure(ref f) => f.sig.output, @@ -3589,7 +3592,7 @@ pub fn ty_fn_ret(fty: t) -> FnOutput { } } -pub fn is_fn_ty(fty: t) -> bool { +pub fn is_fn_ty(fty: Ty) -> bool { match get(fty).sty { ty_bare_fn(_) => true, ty_closure(_) => true, @@ -3599,7 +3602,7 @@ pub fn is_fn_ty(fty: t) -> bool { pub fn ty_region(tcx: &ctxt, span: Span, - ty: t) -> Region { + ty: Ty) -> Region { match get(ty).sty { ty_rptr(r, _) => r, ref s => { @@ -3621,7 +3624,7 @@ pub fn free_region_from_def(free_id: ast::NodeId, def: &RegionParameterDef) // Returns the type of a pattern as a monotype. Like @expr_ty, this function // doesn't provide type parameter substitutions. -pub fn pat_ty(cx: &ctxt, pat: &ast::Pat) -> t { +pub fn pat_ty(cx: &ctxt, pat: &ast::Pat) -> Ty { return node_id_to_type(cx, pat.id); } @@ -3635,16 +3638,16 @@ pub fn pat_ty(cx: &ctxt, pat: &ast::Pat) -> t { // // NB (2): This type doesn't provide type parameter substitutions; e.g. if you // ask for the type of "id" in "id(3)", it will return "fn(&int) -> int" -// instead of "fn(t) -> T with T = int". -pub fn expr_ty(cx: &ctxt, expr: &ast::Expr) -> t { +// instead of "fn(ty) -> T with T = int". +pub fn expr_ty(cx: &ctxt, expr: &ast::Expr) -> Ty { return node_id_to_type(cx, expr.id); } -pub fn expr_ty_opt(cx: &ctxt, expr: &ast::Expr) -> Option<t> { +pub fn expr_ty_opt(cx: &ctxt, expr: &ast::Expr) -> Option<Ty> { return node_id_to_type_opt(cx, expr.id); } -pub fn expr_ty_adjusted(cx: &ctxt, expr: &ast::Expr) -> t { +pub fn expr_ty_adjusted(cx: &ctxt, expr: &ast::Expr) -> Ty { /*! * * Returns the type of `expr`, considering any `AutoAdjustment` @@ -3706,10 +3709,10 @@ pub fn local_var_name_str(cx: &ctxt, id: NodeId) -> InternedString { pub fn adjust_ty(cx: &ctxt, span: Span, expr_id: ast::NodeId, - unadjusted_ty: ty::t, + unadjusted_ty: Ty, adjustment: Option<&AutoAdjustment>, - method_type: |typeck::MethodCall| -> Option<ty::t>) - -> ty::t { + method_type: |typeck::MethodCall| -> Option<Ty>) + -> Ty { /*! See `expr_ty_adjusted` */ match get(unadjusted_ty).sty { @@ -3785,9 +3788,9 @@ pub fn adjust_ty(cx: &ctxt, pub fn adjust_ty_for_autoref(cx: &ctxt, span: Span, - ty: ty::t, + ty: Ty, autoref: Option<&AutoRef>) - -> ty::t + -> Ty { match autoref { None => ty, @@ -3820,15 +3823,15 @@ pub fn adjust_ty_for_autoref(cx: &ctxt, // Take a sized type and a sizing adjustment and produce an unsized version of // the type. pub fn unsize_ty(cx: &ctxt, - ty: ty::t, + ty: Ty, kind: &UnsizeKind, span: Span) - -> ty::t { + -> Ty { match kind { &UnsizeLength(len) => match get(ty).sty { - ty_vec(t, Some(n)) => { + ty_vec(ty, Some(n)) => { assert!(len == n); - mk_vec(cx, t, None) + mk_vec(cx, ty, None) } _ => cx.sess.span_bug(span, format!("UnsizeLength with bad sty: {}", @@ -3991,8 +3994,8 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind { ast::ExprCast(..) => { match tcx.node_types.borrow().get(&expr.id) { - Some(&t) => { - if type_is_trait(t) { + Some(&ty) => { + if type_is_trait(ty) { RvalueDpsExpr } else { RvalueDatumExpr @@ -4084,13 +4087,13 @@ pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem]) trait_items.iter().position(|m| m.name() == id) } -pub fn ty_sort_string(cx: &ctxt, t: t) -> String { - match get(t).sty { +pub fn ty_sort_string(cx: &ctxt, ty: Ty) -> String { + match get(ty).sty { ty_bool | ty_char | ty_int(_) | ty_uint(_) | ty_float(_) | ty_str => { - ::util::ppaux::ty_to_string(cx, t) + ::util::ppaux::ty_to_string(cx, ty) } - ty_tup(ref tys) if tys.is_empty() => ::util::ppaux::ty_to_string(cx, t), + ty_tup(ref tys) if tys.is_empty() => ::util::ppaux::ty_to_string(cx, ty), ty_enum(id, _) => format!("enum {}", item_path_str(cx, id)), ty_uniq(_) => "box".to_string(), @@ -4521,7 +4524,7 @@ pub fn try_add_builtin_trait( } } -pub fn ty_to_def_id(ty: t) -> Option<ast::DefId> { +pub fn ty_to_def_id(ty: Ty) -> Option<ast::DefId> { match get(ty).sty { ty_trait(ref tt) => Some(tt.principal.def_id), @@ -4537,9 +4540,9 @@ pub fn ty_to_def_id(ty: t) -> Option<ast::DefId> { // Enum information #[deriving(Clone)] pub struct VariantInfo { - pub args: Vec<t>, - pub arg_names: Option<Vec<ast::Ident> >, - pub ctor_ty: Option<t>, + pub args: Vec<Ty>, + pub arg_names: Option<Vec<ast::Ident>>, + pub ctor_ty: Option<Ty>, pub name: ast::Name, pub id: ast::DefId, pub disr_val: Disr, @@ -4676,8 +4679,8 @@ pub fn enum_is_univariant(cx: &ctxt, id: ast::DefId) -> bool { enum_variants(cx, id).len() == 1 } -pub fn type_is_empty(cx: &ctxt, t: t) -> bool { - match ty::get(t).sty { +pub fn type_is_empty(cx: &ctxt, ty: Ty) -> bool { + match ty::get(ty).sty { ty_enum(did, _) => (*enum_variants(cx, did)).is_empty(), _ => false } @@ -4944,8 +4947,8 @@ pub fn lookup_field_type(tcx: &ctxt, struct_id: DefId, id: DefId, substs: &Substs) - -> ty::t { - let t = if id.krate == ast::LOCAL_CRATE { + -> Ty { + let ty = if id.krate == ast::LOCAL_CRATE { node_id_to_type(tcx, id.node) } else { let mut tcache = tcx.tcache.borrow_mut(); @@ -4955,7 +4958,7 @@ pub fn lookup_field_type(tcx: &ctxt, }; pty.ty }; - t.subst(tcx, substs) + ty.subst(tcx, substs) } // Look up the list of field names and IDs for a given struct. @@ -4998,7 +5001,7 @@ pub fn struct_fields(cx: &ctxt, did: ast::DefId, substs: &Substs) // Returns a list of fields corresponding to the tuple's items. trans uses // this. -pub fn tup_fields(v: &[t]) -> Vec<field> { +pub fn tup_fields(v: &[Ty]) -> Vec<field> { v.iter().enumerate().map(|(i, &f)| { field { name: token::intern(i.to_string().as_slice()), @@ -5013,7 +5016,7 @@ pub fn tup_fields(v: &[t]) -> Vec<field> { pub struct UnboxedClosureUpvar { pub def: def::Def, pub span: Span, - pub ty: t, + pub ty: Ty, } // Returns a list of `UnboxedClosureUpvar`s for each upvar. @@ -5053,7 +5056,7 @@ pub fn unboxed_closure_upvars(tcx: &ctxt, closure_id: ast::DefId, substs: &Subst } } -pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool { +pub fn is_binopable(cx: &ctxt, ty: Ty, op: ast::BinOp) -> bool { #![allow(non_upper_case_globals)] static tycat_other: int = 0; static tycat_bool: int = 1; @@ -5095,7 +5098,7 @@ pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool { } } - fn tycat(cx: &ctxt, ty: t) -> int { + fn tycat(cx: &ctxt, ty: Ty) -> int { if type_is_simd(cx, ty) { return tycat(cx, simd_type(cx, ty)) } @@ -5126,8 +5129,8 @@ pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool { } /// Returns an equivalent type with all the typedefs and self regions removed. -pub fn normalize_ty(cx: &ctxt, t: t) -> t { - let u = TypeNormalizer(cx).fold_ty(t); +pub fn normalize_ty(cx: &ctxt, ty: Ty) -> Ty { + let u = TypeNormalizer(cx).fold_ty(ty); return u; struct TypeNormalizer<'a, 'tcx: 'a>(&'a ctxt<'tcx>); @@ -5135,14 +5138,14 @@ pub fn normalize_ty(cx: &ctxt, t: t) -> t { impl<'a, 'tcx> TypeFolder<'tcx> for TypeNormalizer<'a, 'tcx> { fn tcx(&self) -> &ctxt<'tcx> { let TypeNormalizer(c) = *self; c } - fn fold_ty(&mut self, t: ty::t) -> ty::t { - match self.tcx().normalized_cache.borrow().get(&t).cloned() { + fn fold_ty(&mut self, ty: Ty) -> Ty { + match self.tcx().normalized_cache.borrow().get(&ty).cloned() { None => {} Some(u) => return u } - let t_norm = ty_fold::super_fold_ty(self, t); - self.tcx().normalized_cache.borrow_mut().insert(t, t_norm); + let t_norm = ty_fold::super_fold_ty(self, ty); + self.tcx().normalized_cache.borrow_mut().insert(ty, t_norm); return t_norm; } @@ -5285,7 +5288,7 @@ pub fn required_region_bounds(tcx: &ctxt, } } -pub fn get_tydesc_ty(tcx: &ctxt) -> Result<t, String> { +pub fn get_tydesc_ty(tcx: &ctxt) -> Result<Ty, String> { tcx.lang_items.require(TyDescStructLangItem).map(|tydesc_lang_item| { tcx.intrinsic_defs.borrow().get(&tydesc_lang_item).cloned() .expect("Failed to resolve TyDesc") @@ -5491,9 +5494,9 @@ pub fn trait_item_of_item(tcx: &ctxt, def_id: ast::DefId) } } -/// Creates a hash of the type `t` which will be the same no matter what crate +/// Creates a hash of the type `Ty` which will be the same no matter what crate /// context it's calculated within. This is used by the `type_id` intrinsic. -pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 { +pub fn hash_crate_independent(tcx: &ctxt, ty: Ty, svh: &Svh) -> u64 { let mut state = sip::SipState::new(); macro_rules! byte( ($b:expr) => { ($b as u8).hash(&mut state) } ); macro_rules! hash( ($e:expr) => { $e.hash(&mut state) } ); @@ -5524,8 +5527,8 @@ pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 { let mt = |state: &mut sip::SipState, mt: mt| { mt.mutbl.hash(state); }; - ty::walk_ty(t, |t| { - match ty::get(t).sty { + ty::walk_ty(ty, |ty| { + match ty::get(ty).sty { ty_bool => byte!(2), ty_char => byte!(3), ty_int(i) => { @@ -5723,7 +5726,7 @@ pub fn construct_parameter_environment( } fn push_types_from_defs(tcx: &ty::ctxt, - types: &mut subst::VecPerParamSpace<ty::t>, + types: &mut subst::VecPerParamSpace<Ty>, space: subst::ParamSpace, defs: &[TypeParameterDef]) { for (i, def) in defs.iter().enumerate() { @@ -5810,11 +5813,11 @@ impl<'tcx> mc::Typer<'tcx> for ty::ctxt<'tcx> { self } - fn node_ty(&self, id: ast::NodeId) -> mc::McResult<ty::t> { + fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty> { Ok(ty::node_id_to_type(self, id)) } - fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t> { + fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<Ty> { self.method_map.borrow().get(&method_call).map(|method| method.ty) } @@ -5859,9 +5862,9 @@ pub enum ExplicitSelfCategory { /// in a list of type substitutions. This does *not* traverse into nominal /// types, nor does it resolve fictitious types. pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>, - typ: t) { - walk_ty(typ, |typ| { - match get(typ).sty { + ty: Ty) { + walk_ty(ty, |ty| { + match get(ty).sty { ty_rptr(region, _) => { accumulator.push(region) } diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs index 4dfee673bca..e09cf55437c 100644 --- a/src/librustc/middle/ty_fold.rs +++ b/src/librustc/middle/ty_fold.rs @@ -38,7 +38,7 @@ use middle::subst; use middle::subst::VecPerParamSpace; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::traits; use middle::typeck; use std::rc::Rc; @@ -73,7 +73,7 @@ pub trait TypeFolder<'tcx> { /// track the Debruijn index nesting level. fn exit_region_binder(&mut self) { } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { super_fold_ty(self, t) } @@ -231,8 +231,8 @@ impl TypeFoldable for ty::TraitStore { } } -impl TypeFoldable for ty::t { - fn fold_with<'tcx, F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::t { +impl TypeFoldable for Ty { + fn fold_with<'tcx, F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Ty { folder.fold_ty(*self) } } @@ -487,8 +487,8 @@ impl TypeFoldable for traits::VtableParamData { // They should invoke `foo.fold_with()` to do recursive folding. pub fn super_fold_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T, - t: ty::t) - -> ty::t { + t: Ty) + -> Ty { let sty = ty::get(t).sty.fold_with(this); ty::mk_t(this.tcx(), sty) } @@ -736,13 +736,13 @@ impl<T:HigherRankedFoldable> HigherRankedFoldable for Rc<T> { pub struct BottomUpFolder<'a, 'tcx: 'a> { pub tcx: &'a ty::ctxt<'tcx>, - pub fldop: |ty::t|: 'a -> ty::t, + pub fldop: |Ty|: 'a -> Ty, } impl<'a, 'tcx> TypeFolder<'tcx> for BottomUpFolder<'a, 'tcx> { fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> { self.tcx } - fn fold_ty(&mut self, ty: ty::t) -> ty::t { + fn fold_ty(&mut self, ty: Ty) -> Ty { let t1 = super_fold_ty(self, ty); (self.fldop)(t1) } @@ -754,7 +754,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BottomUpFolder<'a, 'tcx> { /// Folds over the substructure of a type, visiting its component /// types and all regions that occur *free* within it. /// -/// That is, `ty::t` can contain function or method types that bind +/// That is, `Ty` can contain function or method types that bind /// regions at the call site (`ReLateBound`), and occurrences of /// regions (aka "lifetimes") that are bound within a type are not /// visited by this folder; only regions that occur free will be diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 68677492649..b3e2c88ef63 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -53,7 +53,7 @@ use middle::def; use middle::resolve_lifetime as rl; use middle::subst::{FnSpace, TypeSpace, AssocSpace, SelfSpace, Subst, Substs}; use middle::subst::{VecPerParamSpace}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::lookup_def_tcx; use middle::typeck::rscope::{UnelidableRscope, RegionScope, SpecificRscope, ShiftedRscope, BindingRscope}; @@ -75,22 +75,22 @@ pub trait AstConv<'tcx> { fn get_trait_def(&self, id: ast::DefId) -> Rc<ty::TraitDef>; /// What type should we use when a type is omitted? - fn ty_infer(&self, span: Span) -> ty::t; + fn ty_infer(&self, span: Span) -> Ty; /// Returns true if associated types from the given trait and type are /// allowed to be used here and false otherwise. fn associated_types_of_trait_are_valid(&self, - ty: ty::t, + ty: Ty, trait_id: ast::DefId) -> bool; /// Returns the binding of the given associated type for some type. fn associated_type_binding(&self, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, trait_id: ast::DefId, associated_type_id: ast::DefId) - -> ty::t; + -> Ty; } pub fn ast_region_to_region(tcx: &ty::ctxt, lifetime: &ast::Lifetime) @@ -206,8 +206,8 @@ fn ast_path_substs_for_ty<'tcx,AC,RS>( rscope: &RS, decl_def_id: ast::DefId, decl_generics: &ty::Generics, - self_ty: Option<ty::t>, - associated_ty: Option<ty::t>, + self_ty: Option<Ty>, + associated_ty: Option<Ty>, path: &ast::Path) -> Substs where AC: AstConv<'tcx>, RS: RegionScope @@ -252,10 +252,10 @@ fn create_substs_for_ast_path<'tcx,AC,RS>( span: Span, decl_def_id: ast::DefId, decl_generics: &ty::Generics, - self_ty: Option<ty::t>, - types: Vec<ty::t>, + self_ty: Option<Ty>, + types: Vec<Ty>, regions: Vec<ty::Region>, - associated_ty: Option<ty::t>) + associated_ty: Option<Ty>) -> Substs where AC: AstConv<'tcx>, RS: RegionScope { @@ -377,7 +377,7 @@ fn create_substs_for_ast_path<'tcx,AC,RS>( fn convert_angle_bracketed_parameters<'tcx, AC, RS>(this: &AC, rscope: &RS, data: &ast::AngleBracketedParameterData) - -> (Vec<ty::Region>, Vec<ty::t>) + -> (Vec<ty::Region>, Vec<Ty>) where AC: AstConv<'tcx>, RS: RegionScope { let regions: Vec<_> = @@ -395,7 +395,7 @@ fn convert_angle_bracketed_parameters<'tcx, AC, RS>(this: &AC, fn convert_parenthesized_parameters<'tcx,AC>(this: &AC, data: &ast::ParenthesizedParameterData) - -> Vec<ty::t> + -> Vec<Ty> where AC: AstConv<'tcx> { let binding_rscope = BindingRscope::new(); @@ -417,8 +417,8 @@ pub fn instantiate_poly_trait_ref<'tcx,AC,RS>( this: &AC, rscope: &RS, ast_trait_ref: &ast::PolyTraitRef, - self_ty: Option<ty::t>, - associated_type: Option<ty::t>) + self_ty: Option<Ty>, + associated_type: Option<Ty>) -> Rc<ty::TraitRef> where AC: AstConv<'tcx>, RS: RegionScope { @@ -428,8 +428,8 @@ pub fn instantiate_poly_trait_ref<'tcx,AC,RS>( pub fn instantiate_trait_ref<'tcx,AC,RS>(this: &AC, rscope: &RS, ast_trait_ref: &ast::TraitRef, - self_ty: Option<ty::t>, - associated_type: Option<ty::t>) + self_ty: Option<Ty>, + associated_type: Option<Ty>) -> Rc<ty::TraitRef> where AC: AstConv<'tcx>, RS: RegionScope @@ -462,8 +462,8 @@ fn ast_path_to_trait_ref<'tcx,AC,RS>( this: &AC, rscope: &RS, trait_def_id: ast::DefId, - self_ty: Option<ty::t>, - associated_type: Option<ty::t>, + self_ty: Option<Ty>, + associated_type: Option<Ty>, path: &ast::Path) -> ty::TraitRef where AC: AstConv<'tcx>, RS: RegionScope @@ -589,7 +589,7 @@ fn check_path_args(tcx: &ty::ctxt, } } -pub fn ast_ty_to_prim_ty(tcx: &ty::ctxt, ast_ty: &ast::Ty) -> Option<ty::t> { +pub fn ast_ty_to_prim_ty(tcx: &ty::ctxt, ast_ty: &ast::Ty) -> Option<Ty> { match ast_ty.node { ast::TyPath(ref path, _, id) => { let a_def = match tcx.def_map.borrow().get(&id) { @@ -641,7 +641,7 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>( this: &AC, rscope: &RS, ast_ty: &ast::Ty) - -> Option<ty::t> { + -> Option<Ty> { match ast_ty_to_prim_ty(this.tcx(), ast_ty) { Some(typ) => return Some(typ), None => {} @@ -697,8 +697,8 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>( a_seq_mutbl: ast::Mutability, a_seq_ty: &ast::Ty, region: ty::Region, - constr: |ty::t| -> ty::t) - -> ty::t + constr: |Ty| -> Ty) + -> Ty { let tcx = this.tcx(); @@ -755,7 +755,7 @@ fn associated_ty_to_ty<'tcx,AC,RS>(this: &AC, for_ast_type: &ast::Ty, trait_type_id: ast::DefId, span: Span) - -> ty::t + -> Ty where AC: AstConv<'tcx>, RS: RegionScope { debug!("associated_ty_to_ty(trait_path={}, for_ast_type={}, trait_type_id={})", @@ -811,7 +811,7 @@ fn associated_ty_to_ty<'tcx,AC,RS>(this: &AC, // Parses the programmer's textual representation of a type into our // internal notion of a type. pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>( - this: &AC, rscope: &RS, ast_ty: &ast::Ty) -> ty::t + this: &AC, rscope: &RS, ast_ty: &ast::Ty) -> Ty { debug!("ast_ty_to_ty(ast_ty={})", ast_ty.repr(this.tcx())); @@ -1060,8 +1060,8 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>( pub fn ty_of_arg<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(this: &AC, rscope: &RS, a: &ast::Arg, - expected_ty: Option<ty::t>) - -> ty::t { + expected_ty: Option<Ty>) + -> Ty { match a.ty.node { ast::TyInfer if expected_ty.is_some() => expected_ty.unwrap(), ast::TyInfer => this.ty_infer(a.ty.span), @@ -1070,14 +1070,14 @@ pub fn ty_of_arg<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(this: &AC, rscope: &R } struct SelfInfo<'a> { - untransformed_self_ty: ty::t, + untransformed_self_ty: Ty, explicit_self: &'a ast::ExplicitSelf, } pub fn ty_of_method<'tcx, AC: AstConv<'tcx>>( this: &AC, fn_style: ast::FnStyle, - untransformed_self_ty: ty::t, + untransformed_self_ty: Ty, explicit_self: &ast::ExplicitSelf, decl: &ast::FnDecl, abi: abi::Abi) @@ -1163,7 +1163,7 @@ fn ty_of_method_or_bare_fn<'tcx, AC: AstConv<'tcx>>( let input_pats: Vec<String> = input_params.iter() .map(|a| pprust::pat_to_string(&*a.pat)) .collect(); - let self_and_input_tys: Vec<ty::t> = + let self_and_input_tys: Vec<Ty> = self_ty.into_iter().chain(input_tys).collect(); let mut lifetimes_for_params: Vec<(String, Vec<ty::Region>)> = Vec::new(); @@ -1302,7 +1302,7 @@ fn determine_explicit_self_category<'tcx, AC: AstConv<'tcx>, } }; - fn count_modifiers(ty: ty::t) -> uint { + fn count_modifiers(ty: Ty) -> uint { match ty::get(ty).sty { ty::ty_rptr(_, mt) => count_modifiers(mt.ty) + 1, ty::ty_uniq(t) => count_modifiers(t) + 1, @@ -1402,7 +1402,7 @@ fn conv_ty_poly_trait_ref<'tcx, AC, RS>( rscope: &RS, span: Span, ast_bounds: &[ast::TyParamBound]) - -> ty::t + -> Ty where AC: AstConv<'tcx>, RS:RegionScope { let ast_bounds: Vec<&ast::TyParamBound> = ast_bounds.iter().collect(); diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index a79edf28b36..17b2e51a428 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -11,7 +11,7 @@ use middle::def; use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const}; use middle::subst::{Subst, Substs}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::check::{check_expr, check_expr_has_type, demand, FnCtxt}; use middle::typeck::check::{instantiate_path, structurally_resolved_type, valid_range_bounds}; use middle::typeck::infer::{mod, resolve}; @@ -27,7 +27,7 @@ use syntax::parse::token; use syntax::print::pprust; use syntax::ptr::P; -pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { +pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: Ty) { let fcx = pcx.fcx; let tcx = pcx.fcx.ccx.tcx; @@ -207,7 +207,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { } } -pub fn check_dereferencable(pcx: &pat_ctxt, span: Span, expected: ty::t, +pub fn check_dereferencable(pcx: &pat_ctxt, span: Span, expected: Ty, inner: &ast::Pat) -> bool { let fcx = pcx.fcx; let tcx = pcx.fcx.ccx.tcx; @@ -292,7 +292,7 @@ pub struct pat_ctxt<'a, 'tcx: 'a> { pub fn check_pat_struct(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, fields: &[Spanned<ast::FieldPat>], - etc: bool, expected: ty::t) { + etc: bool, expected: Ty) { let fcx = pcx.fcx; let tcx = pcx.fcx.ccx.tcx; @@ -351,7 +351,7 @@ pub fn check_pat_struct(pcx: &pat_ctxt, pat: &ast::Pat, pub fn check_pat_enum(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, subpats: &Option<Vec<P<ast::Pat>>>, - expected: ty::t) { + expected: Ty) { // Typecheck the path. let fcx = pcx.fcx; diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index 2359f9d72d2..4d31275e45d 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -9,7 +9,7 @@ // except according to those terms. -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::check::FnCtxt; use middle::typeck::infer; use middle::typeck::infer::resolve_type; @@ -23,12 +23,12 @@ use util::ppaux::Repr; // Requires that the two types unify, and prints an error message if they // don't. -pub fn suptype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { +pub fn suptype(fcx: &FnCtxt, sp: Span, expected: Ty, actual: Ty) { suptype_with_fn(fcx, sp, false, expected, actual, |sp, e, a, s| { fcx.report_mismatched_types(sp, e, a, s) }) } -pub fn subtype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { +pub fn subtype(fcx: &FnCtxt, sp: Span, expected: Ty, actual: Ty) { suptype_with_fn(fcx, sp, true, actual, expected, |sp, a, e, s| { fcx.report_mismatched_types(sp, e, a, s) }) } @@ -36,9 +36,9 @@ pub fn subtype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { pub fn suptype_with_fn(fcx: &FnCtxt, sp: Span, b_is_expected: bool, - ty_a: ty::t, - ty_b: ty::t, - handle_err: |Span, ty::t, ty::t, &ty::type_err|) { + ty_a: Ty, + ty_b: Ty, + handle_err: |Span, Ty, Ty, &ty::type_err|) { // n.b.: order of actual, expected is reversed match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp), ty_b, ty_a) { @@ -49,7 +49,7 @@ pub fn suptype_with_fn(fcx: &FnCtxt, } } -pub fn eqtype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { +pub fn eqtype(fcx: &FnCtxt, sp: Span, expected: Ty, actual: Ty) { match infer::mk_eqty(fcx.infcx(), false, infer::Misc(sp), actual, expected) { Ok(()) => { /* ok */ } Err(ref err) => { @@ -59,7 +59,7 @@ pub fn eqtype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { } // Checks that the type `actual` can be coerced to `expected`. -pub fn coerce(fcx: &FnCtxt, sp: Span, expected: ty::t, expr: &ast::Expr) { +pub fn coerce(fcx: &FnCtxt, sp: Span, expected: Ty, expr: &ast::Expr) { let expr_ty = fcx.expr_ty(expr); debug!("demand::coerce(expected = {}, expr_ty = {})", expected.repr(fcx.ccx.tcx), diff --git a/src/librustc/middle/typeck/check/method/confirm.rs b/src/librustc/middle/typeck/check/method/confirm.rs index b4d22f117d4..9c138499b42 100644 --- a/src/librustc/middle/typeck/check/method/confirm.rs +++ b/src/librustc/middle/typeck/check/method/confirm.rs @@ -13,7 +13,7 @@ use super::probe; use middle::subst; use middle::subst::Subst; use middle::traits; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::check; use middle::typeck::check::{FnCtxt, NoPreference, PreferMutLvalue}; use middle::typeck::{MethodCall, MethodCallee, MethodObject, MethodOrigin, @@ -57,9 +57,9 @@ struct InstantiatedMethodSig { pub fn confirm(fcx: &FnCtxt, span: Span, self_expr: &ast::Expr, - unadjusted_self_ty: ty::t, + unadjusted_self_ty: Ty, pick: probe::Pick, - supplied_method_types: Vec<ty::t>) + supplied_method_types: Vec<Ty>) -> MethodCallee { debug!("confirm(unadjusted_self_ty={}, pick={}, supplied_method_types={})", @@ -81,9 +81,9 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { } fn confirm(&mut self, - unadjusted_self_ty: ty::t, + unadjusted_self_ty: Ty, pick: probe::Pick, - supplied_method_types: Vec<ty::t>) + supplied_method_types: Vec<Ty>) -> MethodCallee { // Adjust the self expression the user provided and obtain the adjusted type. @@ -136,9 +136,9 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { // ADJUSTMENTS fn adjust_self_ty(&mut self, - unadjusted_self_ty: ty::t, + unadjusted_self_ty: Ty, adjustment: &probe::PickAdjustment) - -> ty::t + -> Ty { // Construct the actual adjustment and write it into the table let auto_deref_ref = self.create_ty_adjustment(adjustment); @@ -191,7 +191,7 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { // fn fresh_receiver_substs(&mut self, - self_ty: ty::t, + self_ty: Ty, pick: &probe::Pick) -> (subst::Substs, MethodOrigin) { @@ -292,8 +292,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { } fn extract_trait_ref<R>(&mut self, - self_ty: ty::t, - closure: |&mut ConfirmContext<'a,'tcx>, ty::t, &ty::TyTrait| -> R) + self_ty: Ty, + closure: |&mut ConfirmContext<'a,'tcx>, Ty, &ty::TyTrait| -> R) -> R { // If we specified that this is an object method, then the @@ -324,8 +324,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { fn instantiate_method_substs(&mut self, pick: &probe::Pick, - supplied_method_types: Vec<ty::t>) - -> (Vec<ty::t>, Vec<ty::Region>) + supplied_method_types: Vec<Ty>) + -> (Vec<Ty>, Vec<ty::Region>) { // Determine the values for the generic parameters of the method. // If they were not explicitly supplied, just construct fresh @@ -361,8 +361,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { } fn unify_receivers(&mut self, - self_ty: ty::t, - method_self_ty: ty::t) + self_ty: Ty, + method_self_ty: Ty) { match self.fcx.mk_subty(false, infer::Misc(self.span), self_ty, method_self_ty) { Ok(_) => {} diff --git a/src/librustc/middle/typeck/check/method/mod.rs b/src/librustc/middle/typeck/check/method/mod.rs index 6c7df2cd07e..f96384adc26 100644 --- a/src/librustc/middle/typeck/check/method/mod.rs +++ b/src/librustc/middle/typeck/check/method/mod.rs @@ -59,7 +59,7 @@ type MethodIndex = uint; // just for doc purposes pub fn exists(fcx: &FnCtxt, span: Span, method_name: ast::Name, - self_ty: ty::t, + self_ty: Ty, call_expr_id: ast::NodeId) -> bool { @@ -77,8 +77,8 @@ pub fn exists(fcx: &FnCtxt, pub fn lookup(fcx: &FnCtxt, span: Span, method_name: ast::Name, - self_ty: ty::t, - supplied_method_types: Vec<ty::t>, + self_ty: Ty, + supplied_method_types: Vec<Ty>, call_expr_id: ast::NodeId, self_expr: &ast::Expr) -> Result<MethodCallee, MethodError> @@ -115,8 +115,8 @@ pub fn lookup_in_trait<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>, self_expr: Option<&'a ast::Expr>, m_name: ast::Name, trait_def_id: DefId, - self_ty: ty::t, - opt_input_types: Option<Vec<ty::t>>) + self_ty: Ty, + opt_input_types: Option<Vec<Ty>>) -> Option<MethodCallee> { lookup_in_trait_adjusted(fcx, span, self_expr, m_name, trait_def_id, @@ -130,8 +130,8 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>, m_name: ast::Name, trait_def_id: DefId, autoderefref: ty::AutoDerefRef, - self_ty: ty::t, - opt_input_types: Option<Vec<ty::t>>) + self_ty: Ty, + opt_input_types: Option<Vec<Ty>>) -> Option<MethodCallee> { /*! @@ -310,7 +310,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>, pub fn report_error(fcx: &FnCtxt, span: Span, - rcvr_ty: ty::t, + rcvr_ty: Ty, method_name: ast::Name, error: MethodError) { diff --git a/src/librustc/middle/typeck/check/method/probe.rs b/src/librustc/middle/typeck/check/method/probe.rs index f9c3fa86752..1a1c19ddb1d 100644 --- a/src/librustc/middle/typeck/check/method/probe.rs +++ b/src/librustc/middle/typeck/check/method/probe.rs @@ -16,7 +16,7 @@ use middle::fast_reject; use middle::subst; use middle::subst::Subst; use middle::traits; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold::HigherRankedFoldable; use middle::typeck::check; use middle::typeck::check::{FnCtxt, NoPreference}; @@ -46,12 +46,12 @@ struct ProbeContext<'a, 'tcx:'a> { } struct CandidateStep { - self_ty: ty::t, + self_ty: Ty, adjustment: PickAdjustment, } struct Candidate { - xform_self_ty: ty::t, + xform_self_ty: Ty, method_ty: Rc<ty::Method>, kind: CandidateKind, } @@ -108,7 +108,7 @@ pub enum PickAdjustment { pub fn probe(fcx: &FnCtxt, span: Span, method_name: ast::Name, - self_ty: ty::t, + self_ty: Ty, call_expr_id: ast::NodeId) -> PickResult { @@ -157,7 +157,7 @@ pub fn probe(fcx: &FnCtxt, }) } -fn create_steps(fcx: &FnCtxt, span: Span, self_ty: ty::t) -> Vec<CandidateStep> { +fn create_steps(fcx: &FnCtxt, span: Span, self_ty: Ty) -> Vec<CandidateStep> { let mut steps = Vec::new(); let (fully_dereferenced_ty, dereferences, _) = @@ -182,7 +182,7 @@ fn create_steps(fcx: &FnCtxt, span: Span, self_ty: ty::t) -> Vec<CandidateStep> return steps; - fn consider_reborrow(t: ty::t, d: uint) -> PickAdjustment { + fn consider_reborrow(t: Ty, d: uint) -> PickAdjustment { // Insert a `&*` or `&mut *` if this is a reference type: match ty::get(t).sty { ty::ty_rptr(_, ref mt) => AutoRef(mt.mutbl, box AutoDeref(d+1)), @@ -230,7 +230,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { } } - fn assemble_probe(&mut self, self_ty: ty::t) { + fn assemble_probe(&mut self, self_ty: Ty) { debug!("assemble_probe: self_ty={}", self_ty.repr(self.tcx())); @@ -293,7 +293,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { } fn assemble_inherent_candidates_from_object(&mut self, - self_ty: ty::t, + self_ty: Ty, principal: &ty::TraitRef, _bounds: ty::ExistentialBounds) { debug!("assemble_inherent_candidates_from_object(self_ty={})", @@ -353,7 +353,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { } fn assemble_inherent_candidates_from_param(&mut self, - _rcvr_ty: ty::t, + _rcvr_ty: Ty, param_ty: ty::ParamTy) { // FIXME -- Do we want to commit to this behavior for param bounds? @@ -671,7 +671,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { fn search_mutabilities(&mut self, mk_adjustment: |ast::Mutability| -> PickAdjustment, - mk_autoref_ty: |ast::Mutability, ty::Region| -> ty::t) + mk_autoref_ty: |ast::Mutability, ty::Region| -> Ty) -> Option<PickResult> { // In general, during probing we erase regions. See @@ -700,7 +700,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { } } - fn pick_method(&mut self, self_ty: ty::t) -> Option<PickResult> { + fn pick_method(&mut self, self_ty: Ty) -> Option<PickResult> { debug!("pick_method(self_ty={})", self.infcx().ty_to_string(self_ty)); debug!("searching inherent candidates"); @@ -715,7 +715,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { self.consider_candidates(self_ty, self.extension_candidates[]) } - fn consider_candidates(&self, self_ty: ty::t, probes: &[Candidate]) -> Option<PickResult> { + fn consider_candidates(&self, self_ty: Ty, probes: &[Candidate]) -> Option<PickResult> { let mut applicable_candidates: Vec<_> = probes.iter() .filter(|&probe| self.consider_probe(self_ty, probe)) @@ -741,7 +741,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { }) } - fn consider_probe(&self, self_ty: ty::t, probe: &Candidate) -> bool { + fn consider_probe(&self, self_ty: Ty, probe: &Candidate) -> bool { debug!("consider_probe: self_ty={} probe={}", self_ty.repr(self.tcx()), probe.repr(self.tcx())); @@ -844,7 +844,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { /////////////////////////////////////////////////////////////////////////// // MISCELLANY - fn make_sub_ty(&self, sub: ty::t, sup: ty::t) -> infer::ures { + fn make_sub_ty(&self, sub: Ty, sup: Ty) -> infer::ures { self.infcx().sub_types(false, infer::Misc(DUMMY_SP), sub, sup) } @@ -874,7 +874,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { self.static_candidates.push(source); } - fn xform_self_ty(&self, method: &Rc<ty::Method>, substs: &subst::Substs) -> ty::t { + fn xform_self_ty(&self, method: &Rc<ty::Method>, substs: &subst::Substs) -> Ty { debug!("xform_self_ty(self_ty={}, substs={})", method.fty.sig.inputs[0].repr(self.tcx()), substs.repr(self.tcx())); diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 8ae5c3a0a95..92518aada27 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -96,7 +96,7 @@ use middle::traits; use middle::ty::{FnSig, VariantInfo}; use middle::ty::{Polytype}; use middle::ty::{Disr, ParamTy, ParameterEnvironment}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty::{replace_late_bound_regions, liberate_late_bound_regions}; use middle::ty_fold::TypeFolder; use middle::typeck::astconv::AstConv; @@ -160,11 +160,11 @@ pub mod wf; /// share the inherited fields. pub struct Inherited<'a, 'tcx: 'a> { infcx: infer::InferCtxt<'a, 'tcx>, - locals: RefCell<NodeMap<ty::t>>, + locals: RefCell<NodeMap<Ty>>, param_env: ty::ParameterEnvironment, // Temporary tables: - node_types: RefCell<NodeMap<ty::t>>, + node_types: RefCell<NodeMap<Ty>>, item_substs: RefCell<NodeMap<ty::ItemSubsts>>, adjustments: RefCell<NodeMap<ty::AutoAdjustment>>, method_map: MethodMap, @@ -175,7 +175,7 @@ pub struct Inherited<'a, 'tcx: 'a> { // A mapping from each fn's id to its signature, with all bound // regions replaced with free ones. Unlike the other tables, this // one is never copied into the tcx: it is only used by regionck. - fn_sig_map: RefCell<NodeMap<Vec<ty::t>>>, + fn_sig_map: RefCell<NodeMap<Vec<Ty>>>, // A set of constraints that regionck must validate. Each // constraint has the form `T:'a`, meaning "some type `T` must @@ -209,7 +209,7 @@ pub struct Inherited<'a, 'tcx: 'a> { struct RegionObligation { sub_region: ty::Region, - sup_type: ty::t, + sup_type: Ty, origin: infer::SubregionOrigin, } @@ -220,10 +220,10 @@ enum Expectation { NoExpectation, /// This expression should have the type given (or some subtype) - ExpectHasType(ty::t), + ExpectHasType(Ty), - /// This expression will be cast to the `ty::t` - ExpectCastableToType(ty::t), + /// This expression will be cast to the `Ty` + ExpectCastableToType(Ty), } #[deriving(Clone)] @@ -295,11 +295,11 @@ impl<'a, 'tcx> mem_categorization::Typer<'tcx> for FnCtxt<'a, 'tcx> { fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> { self.ccx.tcx } - fn node_ty(&self, id: ast::NodeId) -> McResult<ty::t> { + fn node_ty(&self, id: ast::NodeId) -> McResult<Ty> { Ok(self.node_ty(id)) } fn node_method_ty(&self, method_call: typeck::MethodCall) - -> Option<ty::t> { + -> Option<Ty> { self.inh.method_map.borrow().get(&method_call).map(|m| m.ty) } fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment>> { @@ -398,7 +398,7 @@ fn check_bare_fn(ccx: &CrateCtxt, decl: &ast::FnDecl, body: &ast::Block, id: ast::NodeId, - fty: ty::t, + fty: Ty, param_env: ty::ParameterEnvironment) { // Compute the fty from point of view of inside fn // (replace any type-scheme with a type) @@ -425,7 +425,7 @@ struct GatherLocalsVisitor<'a, 'tcx: 'a> { } impl<'a, 'tcx> GatherLocalsVisitor<'a, 'tcx> { - fn assign(&mut self, _span: Span, nid: ast::NodeId, ty_opt: Option<ty::t>) -> ty::t { + fn assign(&mut self, _span: Span, nid: ast::NodeId, ty_opt: Option<Ty>) -> Ty { match ty_opt { None => { // infer the variable's type @@ -551,7 +551,7 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>, }; // Remember return type so that regionck can access it later. - let mut fn_sig_tys: Vec<ty::t> = + let mut fn_sig_tys: Vec<Ty> = arg_tys.iter() .map(|&ty| ty) .collect(); @@ -1515,7 +1515,7 @@ fn check_cast(fcx: &FnCtxt, "cannot cast as `bool`, compare with zero instead"); } else if ty::type_is_region_ptr(t_e) && ty::type_is_unsafe_ptr(t_1) { fn types_compatible(fcx: &FnCtxt, sp: Span, - t1: ty::t, t2: ty::t) -> bool { + t1: Ty, t2: Ty) -> bool { match ty::get(t1).sty { ty::ty_vec(_, Some(_)) => {} _ => return false @@ -1588,21 +1588,21 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> { ty::lookup_trait_def(self.tcx(), id) } - fn ty_infer(&self, _span: Span) -> ty::t { + fn ty_infer(&self, _span: Span) -> Ty { self.infcx().next_ty_var() } - fn associated_types_of_trait_are_valid(&self, _: ty::t, _: ast::DefId) + fn associated_types_of_trait_are_valid(&self, _: Ty, _: ast::DefId) -> bool { false } fn associated_type_binding(&self, span: Span, - _: Option<ty::t>, + _: Option<Ty>, _: ast::DefId, _: ast::DefId) - -> ty::t { + -> Ty { self.tcx().sess.span_err(span, "unsupported associated type binding"); ty::mk_err() } @@ -1642,7 +1642,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { format!("{}", self as *const FnCtxt) } - pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t { + pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> Ty { match self.inh.locals.borrow().get(&nid) { Some(&t) => t, None => { @@ -1663,7 +1663,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } #[inline] - pub fn write_ty(&self, node_id: ast::NodeId, ty: ty::t) { + pub fn write_ty(&self, node_id: ast::NodeId, ty: Ty) { debug!("write_ty({}, {}) in fcx {}", node_id, ppaux::ty_to_string(self.tcx(), ty), self.tag()); self.inh.node_types.borrow_mut().insert(node_id, ty); @@ -1833,7 +1833,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } pub fn require_type_meets(&self, - ty: ty::t, + ty: Ty, span: Span, code: traits::ObligationCauseCode, bound: ty::BuiltinBound) @@ -1850,7 +1850,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } pub fn require_type_is_sized(&self, - ty: ty::t, + ty: Ty, span: Span, code: traits::ObligationCauseCode) { @@ -1875,7 +1875,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .register_obligation(self.tcx(), obligation); } - pub fn to_ty(&self, ast_t: &ast::Ty) -> ty::t { + pub fn to_ty(&self, ast_t: &ast::Ty) -> Ty { let t = ast_ty_to_ty(self, self.infcx(), ast_t); let mut bounds_checker = wf::BoundsChecker::new(self, @@ -1891,7 +1891,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pat.repr(self.tcx()) } - pub fn expr_ty(&self, ex: &ast::Expr) -> ty::t { + pub fn expr_ty(&self, ex: &ast::Expr) -> Ty { match self.inh.node_types.borrow().get(&ex.id) { Some(&t) => t, None => { @@ -1901,7 +1901,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - pub fn expr_ty_adjusted(&self, expr: &ast::Expr) -> ty::t { + pub fn expr_ty_adjusted(&self, expr: &ast::Expr) -> Ty { /*! * Fetch type of `expr` after applying adjustments that * have been recorded in the fcx. @@ -1915,7 +1915,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn adjust_expr_ty(&self, expr: &ast::Expr, adjustment: Option<&ty::AutoAdjustment>) - -> ty::t + -> Ty { /*! * Apply `adjustment` to the type of `expr` @@ -1933,7 +1933,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .map(|method| method.ty)) } - pub fn node_ty(&self, id: ast::NodeId) -> ty::t { + pub fn node_ty(&self, id: ast::NodeId) -> Ty { match self.inh.node_types.borrow().get(&id) { Some(&t) => t, None => { @@ -1961,26 +1961,26 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn mk_subty(&self, a_is_expected: bool, origin: infer::TypeOrigin, - sub: ty::t, - sup: ty::t) + sub: Ty, + sup: Ty) -> Result<(), ty::type_err> { infer::mk_subty(self.infcx(), a_is_expected, origin, sub, sup) } - pub fn can_mk_subty(&self, sub: ty::t, sup: ty::t) + pub fn can_mk_subty(&self, sub: Ty, sup: Ty) -> Result<(), ty::type_err> { infer::can_mk_subty(self.infcx(), sub, sup) } - pub fn can_mk_eqty(&self, sub: ty::t, sup: ty::t) + pub fn can_mk_eqty(&self, sub: Ty, sup: Ty) -> Result<(), ty::type_err> { infer::can_mk_eqty(self.infcx(), sub, sup) } pub fn mk_assignty(&self, expr: &ast::Expr, - sub: ty::t, - sup: ty::t) + sub: Ty, + sup: Ty) -> Result<(), ty::type_err> { match infer::mk_coercety(self.infcx(), false, @@ -1999,8 +1999,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn mk_eqty(&self, a_is_expected: bool, origin: infer::TypeOrigin, - sub: ty::t, - sup: ty::t) + sub: Ty, + sup: Ty) -> Result<(), ty::type_err> { infer::mk_eqty(self.infcx(), a_is_expected, origin, sub, sup) } @@ -2015,22 +2015,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn type_error_message(&self, sp: Span, mk_msg: |String| -> String, - actual_ty: ty::t, + actual_ty: Ty, err: Option<&ty::type_err>) { self.infcx().type_error_message(sp, mk_msg, actual_ty, err); } pub fn report_mismatched_types(&self, sp: Span, - e: ty::t, - a: ty::t, + e: Ty, + a: Ty, err: &ty::type_err) { self.infcx().report_mismatched_types(sp, e, a, err) } pub fn register_region_obligation(&self, origin: infer::SubregionOrigin, - ty: ty::t, + ty: Ty, r: ty::Region) { /*! @@ -2129,7 +2129,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn add_region_obligations_for_type_parameter(&self, span: Span, param_bound: &ty::ParamBounds, - ty: ty::t) + ty: Ty) { // For each declared region bound `T:r`, `T` must outlive `r`. let region_bounds = @@ -2164,11 +2164,11 @@ pub enum LvaluePreference { NoPreference } -pub fn autoderef<T>(fcx: &FnCtxt, sp: Span, base_ty: ty::t, +pub fn autoderef<T>(fcx: &FnCtxt, sp: Span, base_ty: Ty, expr_id: Option<ast::NodeId>, mut lvalue_pref: LvaluePreference, - should_stop: |ty::t, uint| -> Option<T>) - -> (ty::t, uint, Option<T>) { + should_stop: |Ty, uint| -> Option<T>) + -> (Ty, uint, Option<T>) { /*! * Executes an autoderef loop for the type `t`. At each step, invokes * `should_stop` to decide whether to terminate the loop. Returns @@ -2219,12 +2219,12 @@ pub fn autoderef<T>(fcx: &FnCtxt, sp: Span, base_ty: ty::t, } /// Attempts to resolve a call expression as an overloaded call. -fn try_overloaded_call<'a>(fcx: &FnCtxt, - call_expression: &ast::Expr, - callee: &ast::Expr, - callee_type: ty::t, - args: &[&'a P<ast::Expr>]) - -> bool { +fn try_overloaded_call(fcx: &FnCtxt, + call_expression: &ast::Expr, + callee: &ast::Expr, + callee_type: Ty, + args: &[&P<ast::Expr>]) + -> bool { // Bail out if the callee is a bare function or a closure. We check those // manually. match *structure_of(fcx, callee.span, callee_type) { @@ -2282,7 +2282,7 @@ fn try_overloaded_deref(fcx: &FnCtxt, span: Span, method_call: Option<MethodCall>, base_expr: Option<&ast::Expr>, - base_ty: ty::t, + base_ty: Ty, lvalue_pref: LvaluePreference) -> Option<ty::mt> { @@ -2347,9 +2347,9 @@ fn make_overloaded_lvalue_return_type(fcx: &FnCtxt, fn autoderef_for_index<T>(fcx: &FnCtxt, base_expr: &ast::Expr, - base_ty: ty::t, + base_ty: Ty, lvalue_pref: LvaluePreference, - step: |ty::t, ty::AutoDerefRef| -> Option<T>) + step: |Ty, ty::AutoDerefRef| -> Option<T>) -> Option<T> { // FIXME(#18741) -- this is almost but not quite the same as the @@ -2387,11 +2387,11 @@ fn try_overloaded_slice(fcx: &FnCtxt, method_call: MethodCall, expr: &ast::Expr, base_expr: &ast::Expr, - base_ty: ty::t, + base_ty: Ty, start_expr: &Option<P<ast::Expr>>, end_expr: &Option<P<ast::Expr>>, mutbl: ast::Mutability) - -> Option<ty::t> // return type is result of slice + -> Option<Ty> // return type is result of slice { /*! * Autoderefs `base_expr`, looking for a `Slice` impl. If it @@ -2443,12 +2443,12 @@ fn try_overloaded_slice_step(fcx: &FnCtxt, method_call: MethodCall, expr: &ast::Expr, base_expr: &ast::Expr, - base_ty: ty::t, // autoderef'd type + base_ty: Ty, // autoderef'd type autoderefref: ty::AutoDerefRef, mutbl: ast::Mutability, start_expr: &Option<P<ast::Expr>>, end_expr: &Option<P<ast::Expr>>) - -> Option<ty::t> // result type is type of method being called + -> Option<Ty> // result type is type of method being called { /*! * Checks for a `Slice` (or `SliceMut`) impl at the relevant level @@ -2516,10 +2516,10 @@ fn try_index_step(fcx: &FnCtxt, method_call: MethodCall, expr: &ast::Expr, base_expr: &ast::Expr, - adjusted_ty: ty::t, + adjusted_ty: Ty, adjustment: ty::AutoDerefRef, lvalue_pref: LvaluePreference) - -> Option<(/*index type*/ ty::t, /*element type*/ ty::t)> + -> Option<(/*index type*/ Ty, /*element type*/ Ty)> { /*! * To type-check `base_expr[index_expr]`, we progressively autoderef (and otherwise adjust) @@ -2594,7 +2594,7 @@ fn try_index_step(fcx: &FnCtxt, fn lookup_method_for_for_loop(fcx: &FnCtxt, iterator_expr: &ast::Expr, loop_id: ast::NodeId) - -> ty::t { + -> Ty { let trait_did = match fcx.tcx().lang_items.require(IteratorItem) { Ok(trait_did) => trait_did, Err(ref err_string) => { @@ -2672,14 +2672,14 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt, } } -fn check_method_argument_types<'a>(fcx: &FnCtxt, - sp: Span, - method_fn_ty: ty::t, - callee_expr: &ast::Expr, - args_no_rcvr: &[&'a P<ast::Expr>], - deref_args: DerefArgs, - tuple_arguments: TupleArgumentsFlag) - -> ty::FnOutput { +fn check_method_argument_types(fcx: &FnCtxt, + sp: Span, + method_fn_ty: Ty, + callee_expr: &ast::Expr, + args_no_rcvr: &[&P<ast::Expr>], + deref_args: DerefArgs, + tuple_arguments: TupleArgumentsFlag) + -> ty::FnOutput { if ty::type_is_error(method_fn_ty) { let err_inputs = err_args(args_no_rcvr.len()); check_argument_types(fcx, @@ -2713,14 +2713,14 @@ fn check_method_argument_types<'a>(fcx: &FnCtxt, } } -fn check_argument_types<'a>(fcx: &FnCtxt, - sp: Span, - fn_inputs: &[ty::t], - _callee_expr: &ast::Expr, - args: &[&'a P<ast::Expr>], - deref_args: DerefArgs, - variadic: bool, - tuple_arguments: TupleArgumentsFlag) { +fn check_argument_types(fcx: &FnCtxt, + sp: Span, + fn_inputs: &[Ty], + _callee_expr: &ast::Expr, + args: &[&P<ast::Expr>], + deref_args: DerefArgs, + variadic: bool, + tuple_arguments: TupleArgumentsFlag) { /*! * * Generic function that factors out common logic from @@ -2891,7 +2891,7 @@ fn check_argument_types<'a>(fcx: &FnCtxt, } } -fn err_args(len: uint) -> Vec<ty::t> { +fn err_args(len: uint) -> Vec<Ty> { Vec::from_fn(len, |_| ty::mk_err()) } @@ -2906,7 +2906,7 @@ fn write_call(fcx: &FnCtxt, call_expr: &ast::Expr, output: ty::FnOutput) { fn check_lit(fcx: &FnCtxt, lit: &ast::Lit, expected: Expectation) - -> ty::t + -> Ty { let tcx = fcx.ccx.tcx; @@ -2960,7 +2960,7 @@ pub fn valid_range_bounds(ccx: &CrateCtxt, pub fn check_expr_has_type(fcx: &FnCtxt, expr: &ast::Expr, - expected: ty::t) { + expected: Ty) { check_expr_with_unifier( fcx, expr, ExpectHasType(expected), NoPreference, || demand::suptype(fcx, expr.span, expected, fcx.expr_ty(expr))); @@ -2968,13 +2968,13 @@ pub fn check_expr_has_type(fcx: &FnCtxt, fn check_expr_coercable_to_type(fcx: &FnCtxt, expr: &ast::Expr, - expected: ty::t) { + expected: Ty) { check_expr_with_unifier( fcx, expr, ExpectHasType(expected), NoPreference, || demand::coerce(fcx, expr.span, expected, expr)); } -fn check_expr_with_hint(fcx: &FnCtxt, expr: &ast::Expr, expected: ty::t) { +fn check_expr_with_hint(fcx: &FnCtxt, expr: &ast::Expr, expected: Ty) { check_expr_with_unifier( fcx, expr, ExpectHasType(expected), NoPreference, || ()) @@ -3035,7 +3035,7 @@ pub fn lookup_field_ty(tcx: &ty::ctxt, class_id: ast::DefId, items: &[ty::field_ty], fieldname: ast::Name, - substs: &subst::Substs) -> Option<ty::t> { + substs: &subst::Substs) -> Option<Ty> { let o_field = items.iter().find(|f| f.name == fieldname); o_field.map(|f| ty::lookup_field_type(tcx, class_id, f.id, substs)) @@ -3045,7 +3045,7 @@ pub fn lookup_tup_field_ty(tcx: &ty::ctxt, class_id: ast::DefId, items: &[ty::field_ty], idx: uint, - substs: &subst::Substs) -> Option<ty::t> { + substs: &subst::Substs) -> Option<Ty> { let o_field = if idx < items.len() { Some(&items[idx]) } else { None }; o_field.map(|f| ty::lookup_field_type(tcx, class_id, f.id, substs)) @@ -3271,12 +3271,12 @@ fn check_expr_with_unifier(fcx: &FnCtxt, fn lookup_op_method<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>, op_ex: &ast::Expr, - lhs_ty: ty::t, + lhs_ty: Ty, opname: ast::Name, trait_did: Option<ast::DefId>, lhs: &'a ast::Expr, rhs: Option<&P<ast::Expr>>, - unbound_method: ||) -> ty::t { + unbound_method: ||) -> Ty { let method = match trait_did { Some(trait_did) => { // We do eager coercions to make using operators @@ -3457,9 +3457,9 @@ fn check_expr_with_unifier(fcx: &FnCtxt, fn check_user_binop(fcx: &FnCtxt, ex: &ast::Expr, lhs_expr: &ast::Expr, - lhs_resolved_t: ty::t, + lhs_resolved_t: Ty, op: ast::BinOp, - rhs: &P<ast::Expr>) -> ty::t { + rhs: &P<ast::Expr>) -> Ty { let tcx = fcx.ccx.tcx; let lang = &tcx.lang_items; let (name, trait_did) = match op { @@ -3500,7 +3500,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, trait_did: Option<ast::DefId>, ex: &ast::Expr, rhs_expr: &ast::Expr, - rhs_t: ty::t) -> ty::t { + rhs_t: Ty) -> Ty { lookup_op_method(fcx, ex, rhs_t, token::intern(mname), trait_did, rhs_expr, None, || { fcx.type_error_message(ex.span, |actual| { @@ -3800,7 +3800,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, } fn check_struct_or_variant_fields(fcx: &FnCtxt, - struct_ty: ty::t, + struct_ty: Ty, span: Span, class_id: ast::DefId, node_id: ast::NodeId, @@ -3975,7 +3975,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, } } - type ExprCheckerWithTy = fn(&FnCtxt, &ast::Expr, ty::t); + type ExprCheckerWithTy = fn(&FnCtxt, &ast::Expr, Ty); let tcx = fcx.ccx.tcx; let id = expr.id; @@ -4394,7 +4394,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, uty } None => { - let t: ty::t = fcx.infcx().next_ty_var(); + let t: Ty = fcx.infcx().next_ty_var(); for e in args.iter() { check_expr_has_type(fcx, &**e, t); } @@ -4424,7 +4424,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, (uty, uty) } None => { - let t: ty::t = fcx.infcx().next_ty_var(); + let t: Ty = fcx.infcx().next_ty_var(); check_expr_has_type(fcx, &**element, t); (fcx.expr_ty(&**element), t) } @@ -4927,7 +4927,7 @@ fn check_block_with_expected(fcx: &FnCtxt, /// extended to type-level numeric literals. pub fn check_const_in_type(tcx: &ty::ctxt, expr: &ast::Expr, - expected_type: ty::t) { + expected_type: Ty) { // Synthesize a crate context. The trait map is not needed here (though I // imagine it will be if we have associated statics --pcwalton), so we // leave it blank. @@ -4954,7 +4954,7 @@ pub fn check_const(ccx: &CrateCtxt, pub fn check_const_with_ty(fcx: &FnCtxt, _: Span, e: &ast::Expr, - declty: ty::t) { + declty: Ty) { // Gather locals in statics (because of block expressions). // This is technically unnecessary because locals in static items are forbidden, // but prevents type checking from blowing up before const checking can properly @@ -5581,7 +5581,7 @@ pub fn instantiate_path(fcx: &FnCtxt, type_count); } - let input_tys: Vec<ty::t> = + let input_tys: Vec<Ty> = data.inputs.iter().map(|ty| fcx.to_ty(&**ty)).collect(); let tuple_ty = @@ -5591,7 +5591,7 @@ pub fn instantiate_path(fcx: &FnCtxt, substs.types.push(space, tuple_ty); } - let output_ty: Option<ty::t> = + let output_ty: Option<Ty> = data.output.as_ref().map(|ty| fcx.to_ty(&**ty)); let output_ty = @@ -5707,7 +5707,7 @@ pub fn instantiate_path(fcx: &FnCtxt, // Resolves `typ` by a single level if `typ` is a type variable. If no // resolution is possible, then an error is reported. -pub fn structurally_resolved_type(fcx: &FnCtxt, sp: Span, mut ty: ty::t) -> ty::t { +pub fn structurally_resolved_type(fcx: &FnCtxt, sp: Span, mut ty: Ty) -> Ty { // If `ty` is a type variable, see whether we already know what it is. ty = fcx.infcx().shallow_resolve(ty); @@ -5736,7 +5736,7 @@ pub fn structurally_resolved_type(fcx: &FnCtxt, sp: Span, mut ty: ty::t) -> ty:: } // Returns the one-level-deep structure of the given type. -pub fn structure_of<'a>(fcx: &FnCtxt, sp: Span, typ: ty::t) +pub fn structure_of<'a>(fcx: &FnCtxt, sp: Span, typ: Ty) -> &'a ty::sty { &ty::get(structurally_resolved_type(fcx, sp, typ)).sty } @@ -5768,7 +5768,7 @@ pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &ast::Block) -> bool { pub fn check_bounds_are_used(ccx: &CrateCtxt, span: Span, tps: &OwnedSlice<ast::TyParam>, - ty: ty::t) { + ty: Ty) { debug!("check_bounds_are_used(n_tps={}, ty={})", tps.len(), ppaux::ty_to_string(ccx.tcx, ty)); @@ -5796,7 +5796,7 @@ pub fn check_bounds_are_used(ccx: &CrateCtxt, } pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) { - fn param(ccx: &CrateCtxt, n: uint) -> ty::t { + fn param(ccx: &CrateCtxt, n: uint) -> Ty { ty::mk_param(ccx.tcx, subst::FnSpace, n, local_def(0)) } diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index c63e8944dbd..2c71be2bbc6 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -122,7 +122,7 @@ use middle::def; use middle::mem_categorization as mc; use middle::traits; use middle::ty::{ReScope}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::astconv::AstConv; use middle::typeck::check::FnCtxt; use middle::typeck::check::regionmanip; @@ -178,7 +178,7 @@ pub fn regionck_fn(fcx: &FnCtxt, id: ast::NodeId, blk: &ast::Block) { pub fn regionck_ensure_component_tys_wf(fcx: &FnCtxt, span: Span, - component_tys: &[ty::t]) { + component_tys: &[Ty]) { /*! * Checks that the types in `component_tys` are well-formed. * This will add constraints into the region graph. @@ -282,7 +282,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> { old_scope } - pub fn resolve_type(&self, unresolved_ty: ty::t) -> ty::t { + pub fn resolve_type(&self, unresolved_ty: Ty) -> Ty { /*! * Try to resolve the type for the given node, returning * t_err if an error results. Note that we never care @@ -319,19 +319,19 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> { } /// Try to resolve the type for the given node. - fn resolve_node_type(&self, id: ast::NodeId) -> ty::t { + fn resolve_node_type(&self, id: ast::NodeId) -> Ty { let t = self.fcx.node_ty(id); self.resolve_type(t) } - fn resolve_method_type(&self, method_call: MethodCall) -> Option<ty::t> { + fn resolve_method_type(&self, method_call: MethodCall) -> Option<Ty> { let method_ty = self.fcx.inh.method_map.borrow() .get(&method_call).map(|method| method.ty); method_ty.map(|method_ty| self.resolve_type(method_ty)) } /// Try to resolve the type for the given node. - pub fn resolve_expr_type_adjusted(&mut self, expr: &ast::Expr) -> ty::t { + pub fn resolve_expr_type_adjusted(&mut self, expr: &ast::Expr) -> Ty { let ty_unadjusted = self.resolve_node_type(expr.id); if ty::type_is_error(ty_unadjusted) { ty_unadjusted @@ -384,7 +384,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> { } fn relate_free_regions(&mut self, - fn_sig_tys: &[ty::t], + fn_sig_tys: &[Ty], body_id: ast::NodeId) { /*! * This method populates the region map's `free_region_map`. @@ -457,12 +457,12 @@ impl<'fcx, 'tcx> mc::Typer<'tcx> for Rcx<'fcx, 'tcx> { self.fcx.ccx.tcx } - fn node_ty(&self, id: ast::NodeId) -> mc::McResult<ty::t> { + fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty> { let t = self.resolve_node_type(id); if ty::type_is_error(t) {Err(())} else {Ok(t)} } - fn node_method_ty(&self, method_call: MethodCall) -> Option<ty::t> { + fn node_method_ty(&self, method_call: MethodCall) -> Option<Ty> { self.resolve_method_type(method_call) } @@ -809,8 +809,8 @@ fn constrain_cast(rcx: &mut Rcx, fn walk_cast(rcx: &mut Rcx, cast_expr: &ast::Expr, - from_ty: ty::t, - to_ty: ty::t) { + from_ty: Ty, + to_ty: Ty) { debug!("walk_cast(from_ty={}, to_ty={})", from_ty.repr(rcx.tcx()), to_ty.repr(rcx.tcx())); @@ -1185,7 +1185,7 @@ fn constrain_call<'a, I: Iterator<&'a ast::Expr>>(rcx: &mut Rcx, fn constrain_autoderefs(rcx: &mut Rcx, deref_expr: &ast::Expr, derefs: uint, - mut derefd_ty: ty::t) { + mut derefd_ty: Ty) { /*! * Invoked on any auto-dereference that occurs. Checks that if * this is a region pointer being dereferenced, the lifetime of @@ -1260,7 +1260,7 @@ pub fn mk_subregion_due_to_dereference(rcx: &mut Rcx, fn constrain_index(rcx: &mut Rcx, index_expr: &ast::Expr, - indexed_ty: ty::t) + indexed_ty: Ty) { /*! * Invoked on any index expression that occurs. Checks that if @@ -1912,7 +1912,7 @@ fn adjust_upvar_borrow_kind(rcx: &Rcx, fn type_must_outlive(rcx: &mut Rcx, origin: infer::SubregionOrigin, - ty: ty::t, + ty: Ty, region: ty::Region) { /*! diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index 2e727a8ef9a..af4917fb868 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -13,7 +13,7 @@ pub use self::WfConstraint::*; use middle::subst::{ParamSpace, Subst, Substs}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold::{TypeFolder}; use syntax::ast; @@ -23,19 +23,19 @@ use util::ppaux::Repr; // Helper functions related to manipulating region types. pub enum WfConstraint { - RegionSubRegionConstraint(Option<ty::t>, ty::Region, ty::Region), - RegionSubParamConstraint(Option<ty::t>, ty::Region, ty::ParamTy), + RegionSubRegionConstraint(Option<Ty>, ty::Region, ty::Region), + RegionSubParamConstraint(Option<Ty>, ty::Region, ty::ParamTy), } struct Wf<'a, 'tcx: 'a> { tcx: &'a ty::ctxt<'tcx>, - stack: Vec<(ty::Region, Option<ty::t>)>, + stack: Vec<(ty::Region, Option<Ty>)>, out: Vec<WfConstraint>, } pub fn region_wf_constraints( tcx: &ty::ctxt, - ty: ty::t, + ty: Ty, outer_region: ty::Region) -> Vec<WfConstraint> { @@ -55,7 +55,7 @@ pub fn region_wf_constraints( } impl<'a, 'tcx> Wf<'a, 'tcx> { - fn accumulate_from_ty(&mut self, ty: ty::t) { + fn accumulate_from_ty(&mut self, ty: Ty) { debug!("Wf::accumulate_from_ty(ty={})", ty.repr(self.tcx)); @@ -146,9 +146,9 @@ impl<'a, 'tcx> Wf<'a, 'tcx> { } fn accumulate_from_rptr(&mut self, - ty: ty::t, + ty: Ty, r_b: ty::Region, - ty_b: ty::t) { + ty_b: Ty) { // We are walking down a type like this, and current // position is indicated by caret: // @@ -193,7 +193,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> { } fn push_sub_region_constraint(&mut self, - opt_ty: Option<ty::t>, + opt_ty: Option<Ty>, r_a: ty::Region, r_b: ty::Region) { /*! Pushes a constraint that `r_a <= r_b`, due to `opt_ty` */ @@ -213,14 +213,14 @@ impl<'a, 'tcx> Wf<'a, 'tcx> { fn push_param_constraint(&mut self, region: ty::Region, - opt_ty: Option<ty::t>, + opt_ty: Option<Ty>, param_ty: ty::ParamTy) { /*! Pushes a constraint that `region <= param_ty`, due to `opt_ty` */ self.out.push(RegionSubParamConstraint(opt_ty, region, param_ty)); } fn accumulate_from_adt(&mut self, - ty: ty::t, + ty: Ty, def_id: ast::DefId, substs: &Substs) { @@ -322,7 +322,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> { } fn accumulate_from_closure_ty(&mut self, - ty: ty::t, + ty: Ty, c: &ty::ClosureTy) { match c.store { @@ -336,7 +336,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> { } fn accumulate_from_object_ty(&mut self, - ty: ty::t, + ty: Ty, bounds: &ty::ExistentialBounds) { // Imagine a type like this: diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 041d21a8baf..3de059a4086 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -14,7 +14,7 @@ use middle::traits::{SelectionError, OutputTypeParameterMismatch, Overflow, Unim use middle::traits::{Obligation, obligation_for_builtin_bound}; use middle::traits::{FulfillmentError, CodeSelectionError, CodeAmbiguity}; use middle::traits::{ObligationCause}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::check::{FnCtxt, structurally_resolved_type}; use middle::typeck::infer; @@ -26,7 +26,7 @@ use util::ppaux::{UserString, Repr, ty_to_string}; pub fn check_object_cast(fcx: &FnCtxt, cast_expr: &ast::Expr, source_expr: &ast::Expr, - target_object_ty: ty::t) + target_object_ty: Ty) { debug!("check_object_cast(cast_expr={}, target_object_ty={})", cast_expr.repr(fcx.tcx()), @@ -99,7 +99,7 @@ pub fn check_object_cast(fcx: &FnCtxt, // Because we currently give unsound lifetimes to the "t_box", I // could have written &'static ty::TyTrait here, but it seems // gratuitously unsafe. - fn object_trait<'a>(t: &'a ty::t) -> &'a ty::TyTrait { + fn object_trait<'a>(t: &'a Ty) -> &'a ty::TyTrait { match ty::get(*t).sty { ty::ty_trait(ref ty_trait) => &**ty_trait, _ => panic!("expected ty_trait") @@ -116,7 +116,7 @@ pub fn check_object_cast(fcx: &FnCtxt, fn push_cast_obligation(fcx: &FnCtxt, cast_expr: &ast::Expr, object_trait: &ty::TyTrait, - referent_ty: ty::t) { + referent_ty: Ty) { let object_trait_ref = register_object_cast_obligations(fcx, cast_expr.span, @@ -234,7 +234,7 @@ pub fn check_object_safety(tcx: &ty::ctxt, object_trait: &ty::TyTrait, span: Spa pub fn register_object_cast_obligations(fcx: &FnCtxt, span: Span, object_trait: &ty::TyTrait, - referent_ty: ty::t) + referent_ty: Ty) -> Rc<ty::TraitRef> { // This is just for better error reporting. Kinda goofy. The object type stuff @@ -300,7 +300,7 @@ pub fn select_all_fcx_obligations_or_error(fcx: &FnCtxt) { } fn resolve_trait_ref(fcx: &FnCtxt, obligation: &Obligation) - -> (Rc<ty::TraitRef>, ty::t) + -> (Rc<ty::TraitRef>, Ty) { let trait_ref = fcx.infcx().resolve_type_vars_in_trait_ref_if_possible( diff --git a/src/librustc/middle/typeck/check/wf.rs b/src/librustc/middle/typeck/check/wf.rs index 8e02f9f7bfd..b07b7526fe4 100644 --- a/src/librustc/middle/typeck/check/wf.rs +++ b/src/librustc/middle/typeck/check/wf.rs @@ -11,7 +11,7 @@ use middle::subst; use middle::subst::{Subst}; use middle::traits; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty::liberate_late_bound_regions; use middle::ty_fold::{TypeFolder, TypeFoldable}; use middle::typeck::astconv::AstConv; @@ -29,7 +29,7 @@ use syntax::visit::Visitor; pub struct CheckTypeWellFormedVisitor<'ccx, 'tcx:'ccx> { ccx: &'ccx CrateCtxt<'ccx, 'tcx>, - cache: HashSet<ty::t> + cache: HashSet<Ty> } impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> { @@ -139,7 +139,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> { } } - let field_tys: Vec<ty::t> = + let field_tys: Vec<Ty> = variants.iter().flat_map(|v| v.fields.iter().map(|f| f.ty)).collect(); regionck::regionck_ensure_component_tys_wf( @@ -256,14 +256,14 @@ pub struct BoundsChecker<'cx,'tcx:'cx> { span: Span, scope_id: ast::NodeId, binding_count: uint, - cache: Option<&'cx mut HashSet<ty::t>>, + cache: Option<&'cx mut HashSet<Ty>>, } impl<'cx,'tcx> BoundsChecker<'cx,'tcx> { pub fn new(fcx: &'cx FnCtxt<'cx,'tcx>, span: Span, scope_id: ast::NodeId, - cache: Option<&'cx mut HashSet<ty::t>>) + cache: Option<&'cx mut HashSet<Ty>>) -> BoundsChecker<'cx,'tcx> { BoundsChecker { fcx: fcx, span: span, scope_id: scope_id, cache: cache, binding_count: 0 } @@ -300,11 +300,11 @@ impl<'cx,'tcx> BoundsChecker<'cx,'tcx> { } } - pub fn check_ty(&mut self, ty: ty::t) { + pub fn check_ty(&mut self, ty: Ty) { ty.fold_with(self); } - fn check_traits_in_ty(&mut self, ty: ty::t) { + fn check_traits_in_ty(&mut self, ty: Ty) { // When checking types outside of a type def'n, we ignore // region obligations. See discussion below in fold_ty(). self.binding_count += 1; @@ -318,7 +318,7 @@ impl<'cx,'tcx> TypeFolder<'tcx> for BoundsChecker<'cx,'tcx> { self.fcx.tcx() } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { debug!("BoundsChecker t={}", t.repr(self.tcx())); @@ -406,7 +406,7 @@ struct AdtVariant { } struct AdtField { - ty: ty::t, + ty: Ty, span: Span, } @@ -459,7 +459,7 @@ fn enum_variants(fcx: &FnCtxt, enum_def: &ast::EnumDef) -> Vec<AdtVariant> { fn check_struct_safe_for_destructor(fcx: &FnCtxt, span: Span, - self_ty: ty::t, + self_ty: Ty, struct_did: ast::DefId) { let struct_tpt = ty::lookup_item_type(fcx.tcx(), struct_did); if !struct_tpt.generics.has_type_params(subst::TypeSpace) diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index 9ded3265f82..4f3fd4fae98 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -15,7 +15,7 @@ use self::ResolveReason::*; use middle::def; use middle::pat_util; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold::{TypeFolder,TypeFoldable}; use middle::typeck::astconv::AstConv; use middle::typeck::check::FnCtxt; @@ -465,7 +465,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> { self.tcx } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { if !ty::type_needs_infer(t) { return t; } diff --git a/src/librustc/middle/typeck/coherence/mod.rs b/src/librustc/middle/typeck/coherence/mod.rs index 09b2be28545..12a0e0d01f0 100644 --- a/src/librustc/middle/typeck/coherence/mod.rs +++ b/src/librustc/middle/typeck/coherence/mod.rs @@ -23,7 +23,7 @@ use middle::subst::{Substs}; use middle::ty::get; use middle::ty::{ImplContainer, ImplOrTraitItemId, MethodTraitItemId}; use middle::ty::{TypeTraitItemId, lookup_item_type}; -use middle::ty::{t, ty_bool, ty_char, ty_enum, ty_err}; +use middle::ty::{Ty, ty_bool, ty_char, ty_enum, ty_err}; use middle::ty::{ty_str, ty_vec, ty_float, ty_infer, ty_int, ty_open}; use middle::ty::{ty_param, Polytype, ty_ptr}; use middle::ty::{ty_rptr, ty_struct, ty_trait, ty_tup}; @@ -57,8 +57,8 @@ mod overlap; fn get_base_type(inference_context: &InferCtxt, span: Span, - original_type: t) - -> Option<t> { + original_type: Ty) + -> Option<Ty> { let resolved_type = match resolve_type(inference_context, Some(span), original_type, @@ -97,7 +97,7 @@ fn get_base_type(inference_context: &InferCtxt, // Returns the def ID of the base type, if there is one. fn get_base_type_def_id(inference_context: &InferCtxt, span: Span, - original_type: t) + original_type: Ty) -> Option<DefId> { match get_base_type(inference_context, span, original_type) { None => None, @@ -489,7 +489,7 @@ pub fn make_substs_for_receiver_types(tcx: &ty::ctxt, * intact. */ - let meth_tps: Vec<ty::t> = + let meth_tps: Vec<Ty> = method.generics.types.get_slice(subst::FnSpace) .iter() .map(|def| ty::mk_param_from_def(tcx, def)) diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index a0b198a59c2..f011c36f782 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -40,7 +40,7 @@ use middle::subst; use middle::subst::{Substs}; use middle::ty::{ImplContainer, ImplOrTraitItemContainer, TraitContainer}; use middle::ty::{Polytype}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold::TypeFolder; use middle::typeck::astconv::{AstConv, ty_of_arg}; use middle::typeck::astconv::{ast_ty_to_ty, ast_region_to_region}; @@ -137,17 +137,17 @@ impl<'a, 'tcx, 'v> visit::Visitor<'v> for CollectItemTypesVisitor<'a, 'tcx> { // Utility types and common code for the above passes. pub trait ToTy { - fn to_ty<RS:RegionScope>(&self, rs: &RS, ast_ty: &ast::Ty) -> ty::t; + fn to_ty<RS:RegionScope>(&self, rs: &RS, ast_ty: &ast::Ty) -> Ty; } impl<'a,'tcx> ToTy for ImplCtxt<'a,'tcx> { - fn to_ty<RS:RegionScope>(&self, rs: &RS, ast_ty: &ast::Ty) -> ty::t { + fn to_ty<RS:RegionScope>(&self, rs: &RS, ast_ty: &ast::Ty) -> Ty { ast_ty_to_ty(self, rs, ast_ty) } } impl<'a,'tcx> ToTy for CrateCtxt<'a,'tcx> { - fn to_ty<RS:RegionScope>(&self, rs: &RS, ast_ty: &ast::Ty) -> ty::t { + fn to_ty<RS:RegionScope>(&self, rs: &RS, ast_ty: &ast::Ty) -> Ty { ast_ty_to_ty(self, rs, ast_ty) } } @@ -181,23 +181,23 @@ impl<'a, 'tcx> AstConv<'tcx> for CrateCtxt<'a, 'tcx> { get_trait_def(self, id) } - fn ty_infer(&self, span: Span) -> ty::t { + fn ty_infer(&self, span: Span) -> Ty { span_err!(self.tcx.sess, span, E0121, "the type placeholder `_` is not allowed within types on item signatures."); ty::mk_err() } - fn associated_types_of_trait_are_valid(&self, _: ty::t, _: ast::DefId) + fn associated_types_of_trait_are_valid(&self, _: Ty, _: ast::DefId) -> bool { false } fn associated_type_binding(&self, span: Span, - _: Option<ty::t>, + _: Option<Ty>, _: ast::DefId, _: ast::DefId) - -> ty::t { + -> Ty { self.tcx().sess.span_err(span, "associated types may not be \ referenced here"); ty::mk_err() @@ -205,7 +205,7 @@ impl<'a, 'tcx> AstConv<'tcx> for CrateCtxt<'a, 'tcx> { } pub fn get_enum_variant_types(ccx: &CrateCtxt, - enum_ty: ty::t, + enum_ty: Ty, variants: &[P<ast::Variant>], generics: &ast::Generics) { let tcx = ccx.tcx; @@ -519,7 +519,7 @@ fn convert_methods<'a,I>(ccx: &CrateCtxt, convert_method_context: ConvertMethodContext, container: ImplOrTraitItemContainer, mut ms: I, - untransformed_rcvr_ty: ty::t, + untransformed_rcvr_ty: Ty, rcvr_ty_generics: &ty::Generics, rcvr_visibility: ast::Visibility) where I: Iterator<&'a ast::Method> { @@ -568,7 +568,7 @@ fn convert_methods<'a,I>(ccx: &CrateCtxt, convert_method_context: ConvertMethodContext, container: ImplOrTraitItemContainer, m: &ast::Method, - untransformed_rcvr_ty: ty::t, + untransformed_rcvr_ty: Ty, rcvr_ty_generics: &ty::Generics, rcvr_visibility: ast::Visibility) -> ty::Method { @@ -659,7 +659,7 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, } } -fn is_associated_type_valid_for_param(ty: ty::t, +fn is_associated_type_valid_for_param(ty: Ty, trait_id: ast::DefId, generics: &ty::Generics) -> bool { @@ -681,10 +681,10 @@ fn is_associated_type_valid_for_param(ty: ty::t, fn find_associated_type_in_generics(tcx: &ty::ctxt, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, associated_type_id: ast::DefId, generics: &ty::Generics) - -> ty::t { + -> Ty { let ty = match ty { None => { tcx.sess.span_bug(span, @@ -721,7 +721,7 @@ fn find_associated_type_in_generics(tcx: &ty::ctxt, } } -fn type_is_self(ty: ty::t) -> bool { +fn type_is_self(ty: Ty) -> bool { match ty::get(ty).sty { ty::ty_param(ref param_ty) if param_ty.is_self() => true, _ => false, @@ -748,12 +748,12 @@ impl<'a,'tcx> AstConv<'tcx> for ImplCtxt<'a,'tcx> { self.ccx.get_trait_def(id) } - fn ty_infer(&self, span: Span) -> ty::t { + fn ty_infer(&self, span: Span) -> Ty { self.ccx.ty_infer(span) } fn associated_types_of_trait_are_valid(&self, - ty: ty::t, + ty: Ty, trait_id: ast::DefId) -> bool { // OK if the trait with the associated type is the trait we're @@ -774,10 +774,10 @@ impl<'a,'tcx> AstConv<'tcx> for ImplCtxt<'a,'tcx> { fn associated_type_binding(&self, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, trait_id: ast::DefId, associated_type_id: ast::DefId) - -> ty::t + -> Ty { let trait_def = ty::lookup_trait_def(self.tcx(), trait_id); match self.opt_trait_ref_id { @@ -837,12 +837,12 @@ impl<'a,'tcx> AstConv<'tcx> for FnCtxt<'a,'tcx> { self.ccx.get_trait_def(id) } - fn ty_infer(&self, span: Span) -> ty::t { + fn ty_infer(&self, span: Span) -> Ty { self.ccx.ty_infer(span) } fn associated_types_of_trait_are_valid(&self, - ty: ty::t, + ty: Ty, trait_id: ast::DefId) -> bool { // OK if the trait with the associated type is one of the traits in @@ -852,10 +852,10 @@ impl<'a,'tcx> AstConv<'tcx> for FnCtxt<'a,'tcx> { fn associated_type_binding(&self, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, _: ast::DefId, associated_type_id: ast::DefId) - -> ty::t { + -> Ty { debug!("collect::FnCtxt::associated_type_binding()"); // The ID should map to an associated type on one of the traits in @@ -886,12 +886,12 @@ impl<'a,'tcx> AstConv<'tcx> for ImplMethodCtxt<'a,'tcx> { self.ccx.get_trait_def(id) } - fn ty_infer(&self, span: Span) -> ty::t { + fn ty_infer(&self, span: Span) -> Ty { self.ccx.ty_infer(span) } fn associated_types_of_trait_are_valid(&self, - ty: ty::t, + ty: Ty, trait_id: ast::DefId) -> bool { is_associated_type_valid_for_param(ty, trait_id, self.method_generics) @@ -899,10 +899,10 @@ impl<'a,'tcx> AstConv<'tcx> for ImplMethodCtxt<'a,'tcx> { fn associated_type_binding(&self, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, _: ast::DefId, associated_type_id: ast::DefId) - -> ty::t { + -> Ty { debug!("collect::ImplMethodCtxt::associated_type_binding()"); // The ID should map to an associated type on one of the traits in @@ -935,12 +935,12 @@ impl<'a,'tcx> AstConv<'tcx> for TraitMethodCtxt<'a,'tcx> { self.ccx.get_trait_def(id) } - fn ty_infer(&self, span: Span) -> ty::t { + fn ty_infer(&self, span: Span) -> Ty { self.ccx.ty_infer(span) } fn associated_types_of_trait_are_valid(&self, - ty: ty::t, + ty: Ty, trait_id: ast::DefId) -> bool { // OK if the trait with the associated type is this trait. @@ -955,10 +955,10 @@ impl<'a,'tcx> AstConv<'tcx> for TraitMethodCtxt<'a,'tcx> { fn associated_type_binding(&self, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, trait_id: ast::DefId, associated_type_id: ast::DefId) - -> ty::t { + -> Ty { debug!("collect::TraitMethodCtxt::associated_type_binding()"); // If this is one of our own associated types, return it. @@ -1015,12 +1015,12 @@ impl<'a,'tcx,AC:AstConv<'tcx>> AstConv<'tcx> for GenericsCtxt<'a,AC> { self.chain.get_trait_def(id) } - fn ty_infer(&self, span: Span) -> ty::t { + fn ty_infer(&self, span: Span) -> Ty { self.chain.ty_infer(span) } fn associated_types_of_trait_are_valid(&self, - ty: ty::t, + ty: Ty, trait_id: ast::DefId) -> bool { // OK if the trait with the associated type is one of the traits in @@ -1032,10 +1032,10 @@ impl<'a,'tcx,AC:AstConv<'tcx>> AstConv<'tcx> for GenericsCtxt<'a,AC> { fn associated_type_binding(&self, span: Span, - ty: Option<ty::t>, + ty: Option<Ty>, _: ast::DefId, associated_type_id: ast::DefId) - -> ty::t { + -> Ty { debug!("collect::GenericsCtxt::associated_type_binding()"); // The ID should map to an associated type on one of the traits in @@ -2138,7 +2138,7 @@ pub fn mk_item_substs(ccx: &CrateCtxt, fn check_method_self_type<RS:RegionScope>( crate_context: &CrateCtxt, rs: &RS, - required_type: ty::t, + required_type: Ty, explicit_self: &ast::ExplicitSelf, body_id: ast::NodeId) { diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs index 1bbbe2838b9..bc520e264d1 100644 --- a/src/librustc/middle/typeck/infer/coercion.rs +++ b/src/librustc/middle/typeck/infer/coercion.rs @@ -67,7 +67,7 @@ we may want to adjust precisely when coercions occur. use middle::subst; use middle::ty::{AutoPtr, AutoDerefRef, AdjustDerefRef, AutoUnsize, AutoUnsafe}; use middle::ty::{mt}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::{CoerceResult, resolve_type, Coercion}; use middle::typeck::infer::combine::{CombineFields, Combine}; use middle::typeck::infer::sub::Sub; @@ -88,7 +88,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { let Coerce(ref v) = *self; v } - pub fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult { + pub fn tys(&self, a: Ty, b: Ty) -> CoerceResult { debug!("Coerce.tys({} => {})", a.repr(self.get_ref().infcx.tcx), b.repr(self.get_ref().infcx.tcx)); @@ -190,14 +190,14 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { }) } - pub fn subtype(&self, a: ty::t, b: ty::t) -> CoerceResult { + pub fn subtype(&self, a: Ty, b: Ty) -> CoerceResult { match Sub(self.get_ref().clone()).tys(a, b) { Ok(_) => Ok(None), // No coercion required. Err(ref e) => Err(*e) } } - pub fn unpack_actual_value<T>(&self, a: ty::t, f: |&ty::sty| -> T) + pub fn unpack_actual_value<T>(&self, a: Ty, f: |&ty::sty| -> T) -> T { match resolve_type(self.get_ref().infcx, None, a, try_resolve_tvar_shallow) { @@ -215,9 +215,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // ~T -> &T or &mut T -> &T (including where T = [U] or str) pub fn coerce_borrowed_pointer(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t, + b: Ty, mutbl_b: ast::Mutability) -> CoerceResult { debug!("coerce_borrowed_pointer(a={}, sty_a={}, b={})", @@ -258,9 +258,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // or &mut [T, ..n] -> &mut [T] // or &Concrete -> &Trait, etc. fn coerce_unsized(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t) + b: Ty) -> CoerceResult { debug!("coerce_unsized(a={}, sty_a={}, b={})", a.repr(self.get_ref().infcx.tcx), sty_a, @@ -349,10 +349,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // performed to unsize it. // E.g., `[T, ..n]` -> `([T], UnsizeLength(n))` fn unsize_ty(&self, - ty_a: ty::t, + ty_a: Ty, sty_a: &ty::sty, - ty_b: ty::t) - -> Option<(ty::t, ty::UnsizeKind)> { + ty_b: Ty) + -> Option<(Ty, ty::UnsizeKind)> { debug!("unsize_ty(sty_a={}, ty_b={})", sty_a, ty_b.repr(self.get_ref().infcx.tcx)); let tcx = self.get_ref().infcx.tcx; @@ -425,9 +425,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } fn coerce_borrowed_object(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t, + b: Ty, b_mutbl: ast::Mutability) -> CoerceResult { let tcx = self.get_ref().infcx.tcx; @@ -445,9 +445,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } fn coerce_unsafe_object(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t, + b: Ty, b_mutbl: ast::Mutability) -> CoerceResult { let tcx = self.get_ref().infcx.tcx; @@ -462,11 +462,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } fn coerce_object(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t, + b: Ty, b_mutbl: ast::Mutability, - mk_ty: |ty::t| -> ty::t, + mk_ty: |Ty| -> Ty, mk_adjust: || -> ty::AutoRef) -> CoerceResult { let tcx = self.get_ref().infcx.tcx; @@ -494,9 +494,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } pub fn coerce_borrowed_fn(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t) + b: Ty) -> CoerceResult { debug!("coerce_borrowed_fn(a={}, sty_a={}, b={})", a.repr(self.get_ref().infcx.tcx), sty_a, @@ -512,7 +512,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } } - fn coerce_from_bare_fn(&self, a: ty::t, fn_ty_a: &ty::BareFnTy, b: ty::t) + fn coerce_from_bare_fn(&self, a: Ty, fn_ty_a: &ty::BareFnTy, b: Ty) -> CoerceResult { /*! * @@ -546,9 +546,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } pub fn coerce_unsafe_ptr(&self, - a: ty::t, + a: Ty, sty_a: &ty::sty, - b: ty::t, + b: Ty, mutbl_b: ast::Mutability) -> CoerceResult { debug!("coerce_unsafe_ptr(a={}, sty_a={}, b={})", diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index 0f9554cd417..c0258c0c651 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -38,7 +38,7 @@ use middle::subst::{ErasedRegions, NonerasedRegions, Substs}; use middle::ty::{FloatVar, FnSig, IntVar, TyVar}; use middle::ty::{IntType, UintType}; use middle::ty::{BuiltinBounds}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold; use middle::typeck::infer::equate::Equate; use middle::typeck::infer::glb::Glb; @@ -70,14 +70,14 @@ pub trait Combine<'tcx> { fn glb<'a>(&'a self) -> Glb<'a, 'tcx>; fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt>; - fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t>; - fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t>; + fn contratys(&self, a: Ty, b: Ty) -> cres<Ty>; + fn tys(&self, a: Ty, b: Ty) -> cres<Ty>; fn tps(&self, _: subst::ParamSpace, - as_: &[ty::t], - bs: &[ty::t]) - -> cres<Vec<ty::t>> { + as_: &[Ty], + bs: &[Ty]) + -> cres<Vec<Ty>> { // FIXME -- In general, we treat variance a bit wrong // here. For historical reasons, we treat tps and Self // as invariant. This is overly conservative. @@ -90,7 +90,7 @@ pub trait Combine<'tcx> { try!(as_.iter().zip(bs.iter()) .map(|(a, b)| self.equate().tys(*a, *b)) - .collect::<cres<Vec<ty::t>>>()); + .collect::<cres<Vec<Ty>>>()); Ok(as_.to_vec()) } @@ -237,7 +237,7 @@ pub trait Combine<'tcx> { fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig>; - fn args(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn args(&self, a: Ty, b: Ty) -> cres<Ty> { self.contratys(a, b).and_then(|t| Ok(t)) } @@ -323,7 +323,7 @@ pub fn expected_found<'tcx, C: Combine<'tcx>, T>( } } -pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> { +pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C, a: Ty, b: Ty) -> cres<Ty> { let tcx = this.infcx().tcx; let a_sty = &ty::get(a).sty; @@ -513,7 +513,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C, a: ty::t, b: ty::t) -> cres<t this: &C, vid_is_expected: bool, vid: ty::IntVid, - val: ty::IntVarValue) -> cres<ty::t> + val: ty::IntVarValue) -> cres<Ty> { try!(this.infcx().simple_var_t(vid_is_expected, vid, val)); match val { @@ -526,7 +526,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C, a: ty::t, b: ty::t) -> cres<t this: &C, vid_is_expected: bool, vid: ty::FloatVid, - val: ast::FloatTy) -> cres<ty::t> + val: ast::FloatTy) -> cres<Ty> { try!(this.infcx().simple_var_t(vid_is_expected, vid, val)); Ok(ty::mk_mach_float(val)) @@ -550,7 +550,7 @@ impl<'f, 'tcx> CombineFields<'f, 'tcx> { } pub fn instantiate(&self, - a_ty: ty::t, + a_ty: Ty, dir: RelationDir, b_vid: ty::TyVid) -> cres<()> @@ -640,10 +640,10 @@ impl<'f, 'tcx> CombineFields<'f, 'tcx> { } fn generalize(&self, - ty: ty::t, + ty: Ty, for_vid: ty::TyVid, make_region_vars: bool) - -> cres<ty::t> + -> cres<Ty> { /*! * Attempts to generalize `ty` for the type variable @@ -681,7 +681,7 @@ impl<'cx, 'tcx> ty_fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> { self.infcx.tcx } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { // Check to see whether the type we are genealizing references // `vid`. At the same time, also update any type variables to // the values that they are bound to. This is needed to truly diff --git a/src/librustc/middle/typeck/infer/equate.rs b/src/librustc/middle/typeck/infer/equate.rs index 3874f5fc5e4..88afbf0307c 100644 --- a/src/librustc/middle/typeck/infer/equate.rs +++ b/src/librustc/middle/typeck/infer/equate.rs @@ -9,7 +9,7 @@ // except according to those terms. use middle::ty::{BuiltinBounds}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty::TyVar; use middle::typeck::infer::combine::*; use middle::typeck::infer::{cres}; @@ -43,7 +43,7 @@ impl<'f, 'tcx> Combine<'tcx> for Equate<'f, 'tcx> { fn lub<'a>(&'a self) -> Lub<'a, 'tcx> { Lub(self.fields.clone()) } fn glb<'a>(&'a self) -> Glb<'a, 'tcx> { Glb(self.fields.clone()) } - fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn contratys(&self, a: Ty, b: Ty) -> cres<Ty> { self.tys(a, b) } @@ -103,7 +103,7 @@ impl<'f, 'tcx> Combine<'tcx> for Equate<'f, 'tcx> { } } - fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn tys(&self, a: Ty, b: Ty) -> cres<Ty> { debug!("{}.tys({}, {})", self.tag(), a.repr(self.fields.infcx.tcx), b.repr(self.fields.infcx.tcx)); if a == b { return Ok(a); } diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 65bd21b14e0..2274a7fecac 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -63,7 +63,7 @@ use self::FreshOrKept::*; use std::collections::HashSet; use middle::def; use middle::subst; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty::{Region, ReFree}; use middle::typeck::infer; use middle::typeck::infer::InferCtxt; @@ -1679,8 +1679,8 @@ pub trait Resolvable { fn contains_error(&self) -> bool; } -impl Resolvable for ty::t { - fn resolve(&self, infcx: &InferCtxt) -> ty::t { +impl Resolvable for Ty { + fn resolve(&self, infcx: &InferCtxt) -> Ty { infcx.resolve_type_vars_if_possible(*self) } fn contains_error(&self) -> bool { diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index 287a5cfba9e..940bcf22df5 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -10,7 +10,7 @@ use middle::ty::{BuiltinBounds}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::combine::*; use middle::typeck::infer::lattice::*; use middle::typeck::infer::equate::Equate; @@ -77,7 +77,7 @@ impl<'f, 'tcx> Combine<'tcx> for Glb<'f, 'tcx> { } } - fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn contratys(&self, a: Ty, b: Ty) -> cres<Ty> { self.lub().tys(a, b) } @@ -118,7 +118,7 @@ impl<'f, 'tcx> Combine<'tcx> for Glb<'f, 'tcx> { self.lub().regions(a, b) } - fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn tys(&self, a: Ty, b: Ty) -> cres<Ty> { super_lattice_tys(self, a, b) } diff --git a/src/librustc/middle/typeck/infer/higher_ranked/mod.rs b/src/librustc/middle/typeck/infer/higher_ranked/mod.rs index 09f0bbb2254..abe82eb1d9a 100644 --- a/src/librustc/middle/typeck/infer/higher_ranked/mod.rs +++ b/src/librustc/middle/typeck/infer/higher_ranked/mod.rs @@ -13,8 +13,7 @@ * the end of the file for details. */ -use middle::ty; -use middle::ty::replace_late_bound_regions; +use middle::ty::{mod, Ty, replace_late_bound_regions}; use middle::typeck::infer::{mod, combine, cres, InferCtxt}; use middle::typeck::infer::combine::Combine; use middle::typeck::infer::region_inference::{RegionMark}; @@ -375,9 +374,9 @@ impl HigherRankedCombineable for ty::FnSig { fn argvecs<'tcx, C: Combine<'tcx>>(combiner: &C, - a_args: &[ty::t], - b_args: &[ty::t]) - -> cres<Vec<ty::t>> + a_args: &[Ty], + b_args: &[Ty]) + -> cres<Vec<Ty>> { if a_args.len() == b_args.len() { a_args.iter().zip(b_args.iter()) diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index f7e6cef99af..2df42002fa7 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -32,7 +32,7 @@ */ use middle::ty::{TyVar}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::*; use middle::typeck::infer::combine::*; use middle::typeck::infer::glb::Glb; @@ -42,11 +42,11 @@ use util::ppaux::Repr; pub trait LatticeDir { // Relates the type `v` to `a` and `b` such that `v` represents // the LUB/GLB of `a` and `b` as appropriate. - fn relate_bound<'a>(&'a self, v: ty::t, a: ty::t, b: ty::t) -> cres<()>; + fn relate_bound<'a>(&'a self, v: Ty, a: Ty, b: Ty) -> cres<()>; } impl<'a, 'tcx> LatticeDir for Lub<'a, 'tcx> { - fn relate_bound<'a>(&'a self, v: ty::t, a: ty::t, b: ty::t) -> cres<()> { + fn relate_bound<'a>(&'a self, v: Ty, a: Ty, b: Ty) -> cres<()> { let sub = self.sub(); try!(sub.tys(a, v)); try!(sub.tys(b, v)); @@ -55,7 +55,7 @@ impl<'a, 'tcx> LatticeDir for Lub<'a, 'tcx> { } impl<'a, 'tcx> LatticeDir for Glb<'a, 'tcx> { - fn relate_bound<'a>(&'a self, v: ty::t, a: ty::t, b: ty::t) -> cres<()> { + fn relate_bound<'a>(&'a self, v: Ty, a: Ty, b: Ty) -> cres<()> { let sub = self.sub(); try!(sub.tys(v, a)); try!(sub.tys(v, b)); @@ -64,9 +64,9 @@ impl<'a, 'tcx> LatticeDir for Glb<'a, 'tcx> { } pub fn super_lattice_tys<'tcx, L:LatticeDir+Combine<'tcx>>(this: &L, - a: ty::t, - b: ty::t) - -> cres<ty::t> + a: Ty, + b: Ty) + -> cres<Ty> { debug!("{}.lattice_tys({}, {})", this.tag(), diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index 8856f42d1f5..2ed8b9c7380 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -9,7 +9,7 @@ // except according to those terms. use middle::ty::{BuiltinBounds}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::combine::*; use middle::typeck::infer::equate::Equate; use middle::typeck::infer::glb::Glb; @@ -72,7 +72,7 @@ impl<'f, 'tcx> Combine<'tcx> for Lub<'f, 'tcx> { } } - fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn contratys(&self, a: Ty, b: Ty) -> cres<Ty> { self.glb().tys(a, b) } @@ -117,7 +117,7 @@ impl<'f, 'tcx> Combine<'tcx> for Lub<'f, 'tcx> { self.higher_ranked_lub(a, b) } - fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn tys(&self, a: Ty, b: Ty) -> cres<Ty> { super_lattice_tys(self, a, b) } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index e69bd215766..539b220a022 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -32,7 +32,7 @@ use middle::subst; use middle::subst::Substs; use middle::ty::{TyVid, IntVid, FloatVid, RegionVid}; use middle::ty::replace_late_bound_regions; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold::{HigherRankedFoldable, TypeFolder, TypeFoldable}; use std::cell::{RefCell}; use std::rc::Rc; @@ -80,7 +80,7 @@ pub type CoerceResult = cres<Option<ty::AutoAdjustment>>; pub struct InferCtxt<'a, 'tcx: 'a> { pub tcx: &'a ty::ctxt<'tcx>, - // We instantiate UnificationTable with bounds<ty::t> because the + // We instantiate UnificationTable with bounds<Ty> because the // types that might instantiate a general type variable have an // order, represented by its upper and lower bounds. type_variables: RefCell<type_variable::TypeVariableTable>, @@ -135,7 +135,7 @@ pub enum TypeOrigin { /// See `error_reporting.rs` for more details #[deriving(Clone, Show)] pub enum ValuePairs { - Types(ty::expected_found<ty::t>), + Types(ty::expected_found<Ty>), TraitRefs(ty::expected_found<Rc<ty::TraitRef>>), } @@ -182,11 +182,11 @@ pub enum SubregionOrigin { // When closing over a variable in a closure/proc, ensure that the // type of the variable outlives the lifetime bound. - RelateProcBound(Span, ast::NodeId, ty::t), + RelateProcBound(Span, ast::NodeId, Ty), // Some type parameter was instantiated with the given type, // and that type must outlive some region. - RelateParamBound(Span, ty::t), + RelateParamBound(Span, Ty), // The given region parameter was instantiated with a region // that must outlive some other region. @@ -194,7 +194,7 @@ pub enum SubregionOrigin { // A bound placed on type parameters that states that must outlive // the moment of their instantiation. - RelateDefaultParamBound(Span, ty::t), + RelateDefaultParamBound(Span, Ty), // Creating a pointer `b` to contents of another reference Reborrow(Span), @@ -203,10 +203,10 @@ pub enum SubregionOrigin { ReborrowUpvar(Span, ty::UpvarId), // (&'a &'b T) where a >= b - ReferenceOutlivesReferent(ty::t, Span), + ReferenceOutlivesReferent(Ty, Span), // The type T of an expression E must outlive the lifetime for E. - ExprTypeIsNotInScope(ty::t, Span), + ExprTypeIsNotInScope(Ty, Span), // A `ref b` whose region does not enclose the decl site BindingTypeIsNotValidAtDecl(Span), @@ -308,9 +308,9 @@ pub fn new_infer_ctxt<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>) pub fn common_supertype(cx: &InferCtxt, origin: TypeOrigin, a_is_expected: bool, - a: ty::t, - b: ty::t) - -> ty::t + a: Ty, + b: Ty) + -> Ty { /*! * Computes the least upper-bound of `a` and `b`. If this is @@ -339,8 +339,8 @@ pub fn common_supertype(cx: &InferCtxt, pub fn mk_subty(cx: &InferCtxt, a_is_expected: bool, origin: TypeOrigin, - a: ty::t, - b: ty::t) + a: Ty, + b: Ty) -> ures { debug!("mk_subty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx)); @@ -349,7 +349,7 @@ pub fn mk_subty(cx: &InferCtxt, }) } -pub fn can_mk_subty(cx: &InferCtxt, a: ty::t, b: ty::t) -> ures { +pub fn can_mk_subty(cx: &InferCtxt, a: Ty, b: Ty) -> ures { debug!("can_mk_subty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx)); cx.probe(|| { let trace = TypeTrace { @@ -360,7 +360,7 @@ pub fn can_mk_subty(cx: &InferCtxt, a: ty::t, b: ty::t) -> ures { }) } -pub fn can_mk_eqty(cx: &InferCtxt, a: ty::t, b: ty::t) -> ures { +pub fn can_mk_eqty(cx: &InferCtxt, a: Ty, b: Ty) -> ures { debug!("can_mk_subty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx)); cx.probe(|| { let trace = TypeTrace { @@ -397,8 +397,8 @@ pub fn verify_param_bound(cx: &InferCtxt, pub fn mk_eqty(cx: &InferCtxt, a_is_expected: bool, origin: TypeOrigin, - a: ty::t, - b: ty::t) + a: Ty, + b: Ty) -> ures { debug!("mk_eqty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx)); @@ -434,8 +434,8 @@ fn expected_found<T>(a_is_expected: bool, pub fn mk_coercety(cx: &InferCtxt, a_is_expected: bool, origin: TypeOrigin, - a: ty::t, - b: ty::t) + a: Ty, + b: Ty) -> CoerceResult { debug!("mk_coercety({} -> {})", a.repr(cx.tcx), b.repr(cx.tcx)); indent(|| { @@ -452,9 +452,9 @@ pub fn mk_coercety(cx: &InferCtxt, // See comment on the type `resolve_state` below pub fn resolve_type(cx: &InferCtxt, span: Option<Span>, - a: ty::t, + a: Ty, modes: uint) - -> fres<ty::t> { + -> fres<Ty> { let mut resolver = resolver(cx, modes, span); cx.commit_unconditionally(|| resolver.resolve_type_chk(a)) } @@ -522,7 +522,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { t.fold_with(&mut self.skolemizer()) } - pub fn type_var_diverges(&'a self, ty: ty::t) -> bool { + pub fn type_var_diverges(&'a self, ty: Ty) -> bool { match ty::get(ty).sty { ty::ty_infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid), _ => false @@ -651,8 +651,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn sub_types(&self, a_is_expected: bool, origin: TypeOrigin, - a: ty::t, - b: ty::t) + a: Ty, + b: Ty) -> ures { debug!("sub_types({} <: {})", a.repr(self.tcx), b.repr(self.tcx)); @@ -668,8 +668,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn eq_types(&self, a_is_expected: bool, origin: TypeOrigin, - a: ty::t, - b: ty::t) + a: Ty, + b: Ty) -> ures { self.commit_if_ok(|| { @@ -709,15 +709,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .new_var(diverging) } - pub fn next_ty_var(&self) -> ty::t { + pub fn next_ty_var(&self) -> Ty { ty::mk_var(self.tcx, self.next_ty_var_id(false)) } - pub fn next_diverging_ty_var(&self) -> ty::t { + pub fn next_diverging_ty_var(&self) -> Ty { ty::mk_var(self.tcx, self.next_ty_var_id(true)) } - pub fn next_ty_vars(&self, n: uint) -> Vec<ty::t> { + pub fn next_ty_vars(&self, n: uint) -> Vec<Ty> { Vec::from_fn(n, |_i| self.next_ty_var()) } @@ -769,7 +769,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn fresh_substs_for_trait(&self, span: Span, generics: &ty::Generics, - self_ty: ty::t) + self_ty: Ty) -> subst::Substs { /*! @@ -805,12 +805,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { self.report_region_errors(&errors); // see error_reporting.rs } - pub fn ty_to_string(&self, t: ty::t) -> String { + pub fn ty_to_string(&self, t: Ty) -> String { ty_to_string(self.tcx, self.resolve_type_vars_if_possible(t)) } - pub fn tys_to_string(&self, ts: &[ty::t]) -> String { + pub fn tys_to_string(&self, ts: &[Ty]) -> String { let tstrs: Vec<String> = ts.iter().map(|t| self.ty_to_string(*t)).collect(); format!("({})", tstrs.connect(", ")) } @@ -820,7 +820,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { trait_ref_to_string(self.tcx, &t) } - pub fn contains_unbound_type_variables(&self, typ: ty::t) -> ty::t { + pub fn contains_unbound_type_variables(&self, typ: Ty) -> Ty { match resolve_type(self, None, typ, resolve_nested_tvar | resolve_ivar) { @@ -829,7 +829,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } } - pub fn shallow_resolve(&self, typ: ty::t) -> ty::t { + pub fn shallow_resolve(&self, typ: Ty) -> Ty { match ty::get(typ).sty { ty::ty_infer(ty::TyVar(v)) => { self.type_variables.borrow() @@ -853,7 +853,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } } - pub fn resolve_type_vars_if_possible(&self, typ: ty::t) -> ty::t { + pub fn resolve_type_vars_if_possible(&self, typ: Ty) -> Ty { match resolve_type(self, None, typ, resolve_nested_tvar | resolve_ivar) { @@ -908,7 +908,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { mk_msg: |Option<String>, String| -> String, - expected_ty: Option<ty::t>, + expected_ty: Option<Ty>, actual_ty: String, err: Option<&ty::type_err>) { debug!("hi! expected_ty = {}, actual_ty = {}", expected_ty, actual_ty); @@ -938,7 +938,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn type_error_message(&self, sp: Span, mk_msg: |String| -> String, - actual_ty: ty::t, + actual_ty: Ty, err: Option<&ty::type_err>) { let actual_ty = self.resolve_type_vars_if_possible(actual_ty); @@ -952,8 +952,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn report_mismatched_types(&self, span: Span, - expected: ty::t, - actual: ty::t, + expected: Ty, + actual: Ty, err: &ty::type_err) { let trace = TypeTrace { origin: Misc(span), diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 73f595dbedc..94b8485834f 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -50,7 +50,7 @@ use middle::ty::{FloatVar, FloatVid, IntVar, IntVid, RegionVid, TyVar, TyVid}; use middle::ty::{IntType, UintType}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold; use middle::typeck::infer::{fixup_err, fres, InferCtxt}; use middle::typeck::infer::{unresolved_int_ty,unresolved_float_ty,unresolved_ty}; @@ -98,7 +98,7 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for ResolveState<'a, 'tcx> { self.infcx.tcx } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { self.resolve_type(t) } @@ -112,10 +112,7 @@ impl<'a, 'tcx> ResolveState<'a, 'tcx> { (self.modes & mode) == mode } - pub fn resolve_type_chk(&mut self, - typ: ty::t) - -> fres<ty::t> - { + pub fn resolve_type_chk(&mut self, typ: Ty) -> fres<Ty> { self.err = None; debug!("Resolving {} (modes={:x})", @@ -151,7 +148,7 @@ impl<'a, 'tcx> ResolveState<'a, 'tcx> { } } - pub fn resolve_type(&mut self, typ: ty::t) -> ty::t { + pub fn resolve_type(&mut self, typ: Ty) -> Ty { debug!("resolve_type({})", typ.repr(self.infcx.tcx)); if !ty::type_needs_infer(typ) { @@ -203,7 +200,7 @@ impl<'a, 'tcx> ResolveState<'a, 'tcx> { self.infcx.region_vars.resolve_var(rid) } - pub fn resolve_ty_var(&mut self, vid: TyVid) -> ty::t { + pub fn resolve_ty_var(&mut self, vid: TyVid) -> Ty { let tcx = self.infcx.tcx; let tv = self.infcx.type_variables.borrow(); match tv.probe(vid) { @@ -219,7 +216,7 @@ impl<'a, 'tcx> ResolveState<'a, 'tcx> { } } - pub fn resolve_int_var(&mut self, vid: IntVid) -> ty::t { + pub fn resolve_int_var(&mut self, vid: IntVid) -> Ty { if !self.should(resolve_ivar) { return ty::mk_int_var(self.infcx.tcx, vid); } @@ -240,7 +237,7 @@ impl<'a, 'tcx> ResolveState<'a, 'tcx> { } } - pub fn resolve_float_var(&mut self, vid: FloatVid) -> ty::t { + pub fn resolve_float_var(&mut self, vid: FloatVid) -> Ty { if !self.should(resolve_fvar) { return ty::mk_float_var(self.infcx.tcx, vid); } diff --git a/src/librustc/middle/typeck/infer/skolemize.rs b/src/librustc/middle/typeck/infer/skolemize.rs index 9458960156e..e8630b8ae82 100644 --- a/src/librustc/middle/typeck/infer/skolemize.rs +++ b/src/librustc/middle/typeck/infer/skolemize.rs @@ -40,7 +40,7 @@ * it is reasonable to ask what the type inferencer knows "so far". */ -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold; use middle::ty_fold::TypeFoldable; use middle::ty_fold::TypeFolder; @@ -52,7 +52,7 @@ use super::unify::InferCtxtMethodsForSimplyUnifiableTypes; pub struct TypeSkolemizer<'a, 'tcx:'a> { infcx: &'a InferCtxt<'a, 'tcx>, skolemization_count: uint, - skolemization_map: hash_map::HashMap<ty::InferTy, ty::t>, + skolemization_map: hash_map::HashMap<ty::InferTy, Ty>, } impl<'a, 'tcx> TypeSkolemizer<'a, 'tcx> { @@ -65,10 +65,10 @@ impl<'a, 'tcx> TypeSkolemizer<'a, 'tcx> { } fn skolemize(&mut self, - opt_ty: Option<ty::t>, + opt_ty: Option<Ty>, key: ty::InferTy, skolemizer: |uint| -> ty::InferTy) - -> ty::t + -> Ty { match opt_ty { Some(ty) => { return ty.fold_with(self); } @@ -112,7 +112,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeSkolemizer<'a, 'tcx> { } } - fn fold_ty(&mut self, t: ty::t) -> ty::t { + fn fold_ty(&mut self, t: Ty) -> Ty { match ty::get(t).sty { ty::ty_infer(ty::TyVar(v)) => { self.skolemize(self.infcx.type_variables.borrow().probe(v), diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index f85cb85ff21..1a3b626e1f5 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -10,7 +10,7 @@ use middle::ty::{BuiltinBounds}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty::TyVar; use middle::typeck::infer::combine::*; use middle::typeck::infer::{cres, CresCompare}; @@ -47,7 +47,7 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> { fn lub<'a>(&'a self) -> Lub<'a, 'tcx> { Lub(self.fields.clone()) } fn glb<'a>(&'a self) -> Glb<'a, 'tcx> { Glb(self.fields.clone()) } - fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn contratys(&self, a: Ty, b: Ty) -> cres<Ty> { Sub(self.fields.switch_expected()).tys(b, a) } @@ -119,7 +119,7 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> { } } - fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t> { + fn tys(&self, a: Ty, b: Ty) -> cres<Ty> { debug!("{}.tys({}, {})", self.tag(), a.repr(self.tcx()), b.repr(self.tcx())); if a == b { return Ok(a); } diff --git a/src/librustc/middle/typeck/infer/type_variable.rs b/src/librustc/middle/typeck/infer/type_variable.rs index 4bb2cc2ca5c..1bda448990e 100644 --- a/src/librustc/middle/typeck/infer/type_variable.rs +++ b/src/librustc/middle/typeck/infer/type_variable.rs @@ -12,7 +12,7 @@ pub use self::RelationDir::*; use self::TypeVariableValue::*; use self::UndoEntry::*; -use middle::ty; +use middle::ty::{mod, Ty}; use std::mem; use util::snapshot_vec as sv; @@ -26,7 +26,7 @@ struct TypeVariableData { } enum TypeVariableValue { - Known(ty::t), + Known(Ty), Bounded(Vec<Relation>), } @@ -89,8 +89,8 @@ impl TypeVariableTable { pub fn instantiate_and_push( &mut self, vid: ty::TyVid, - ty: ty::t, - stack: &mut Vec<(ty::t, RelationDir, ty::TyVid)>) + ty: Ty, + stack: &mut Vec<(Ty, RelationDir, ty::TyVid)>) { /*! * Instantiates `vid` with the type `ty` and then pushes an @@ -125,14 +125,14 @@ impl TypeVariableTable { ty::TyVid { index: index } } - pub fn probe(&self, vid: ty::TyVid) -> Option<ty::t> { + pub fn probe(&self, vid: ty::TyVid) -> Option<Ty> { match self.values.get(vid.index).value { Bounded(..) => None, Known(t) => Some(t) } } - pub fn replace_if_possible(&self, t: ty::t) -> ty::t { + pub fn replace_if_possible(&self, t: Ty) -> Ty { match ty::get(t).sty { ty::ty_infer(ty::TyVar(v)) => { match self.probe(v) { diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index eaf1d2805b0..8596be7f536 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -13,7 +13,7 @@ pub use self::VarValue::*; use std::kinds::marker; use middle::ty::{expected_found, IntVarValue}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::{uok, ures}; use middle::typeck::infer::InferCtxt; use std::cell::RefCell; @@ -260,7 +260,7 @@ impl<K,V> sv::SnapshotVecDelegate<VarValue<K,V>,()> for Delegate { * relationship. */ pub trait SimplyUnifiable : Clone + PartialEq + Repr { - fn to_type(&self) -> ty::t; + fn to_type(&self) -> Ty; fn to_type_err(expected_found<Self>) -> ty::type_err; } @@ -289,7 +289,7 @@ pub trait InferCtxtMethodsForSimplyUnifiableTypes<V:SimplyUnifiable, a_id: K, b: V) -> ures; - fn probe_var(&self, a_id: K) -> Option<ty::t>; + fn probe_var(&self, a_id: K) -> Option<Ty>; } impl<'a,'tcx,V:SimplyUnifiable,K:UnifyKey<Option<V>>> @@ -375,7 +375,7 @@ impl<'a,'tcx,V:SimplyUnifiable,K:UnifyKey<Option<V>>> } } - fn probe_var(&self, a_id: K) -> Option<ty::t> { + fn probe_var(&self, a_id: K) -> Option<Ty> { let tcx = self.tcx; let table = UnifyKey::unification_table(self); let node_a = table.borrow_mut().get(tcx, a_id); @@ -407,7 +407,7 @@ impl UnifyKey<Option<IntVarValue>> for ty::IntVid { } impl SimplyUnifiable for IntVarValue { - fn to_type(&self) -> ty::t { + fn to_type(&self) -> Ty { match *self { ty::IntType(i) => ty::mk_mach_int(i), ty::UintType(i) => ty::mk_mach_uint(i), @@ -443,7 +443,7 @@ impl UnifyValue for Option<ast::FloatTy> { } impl SimplyUnifiable for ast::FloatTy { - fn to_type(&self) -> ty::t { + fn to_type(&self) -> Ty { ty::mk_mach_float(*self) } diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 24d11b25a60..da1ff84f718 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -69,7 +69,7 @@ use middle::def; use middle::resolve; use middle::subst; use middle::subst::VecPerParamSpace; -use middle::ty; +use middle::ty::{mod, Ty}; use session::config; use util::common::time; use util::ppaux::Repr; @@ -146,7 +146,7 @@ pub struct MethodObject { #[deriving(Clone)] pub struct MethodCallee { pub origin: MethodOrigin, - pub ty: ty::t, + pub ty: Ty, pub substs: subst::Substs } @@ -179,7 +179,7 @@ pub enum ExprAdjustment { pub struct TypeAndSubsts { pub substs: subst::Substs, - pub ty: ty::t, + pub ty: Ty, } impl MethodCall { @@ -285,7 +285,7 @@ pub struct CrateCtxt<'a, 'tcx: 'a> { } // Functions that write types into the node type table -pub fn write_ty_to_tcx(tcx: &ty::ctxt, node_id: ast::NodeId, ty: ty::t) { +pub fn write_ty_to_tcx(tcx: &ty::ctxt, node_id: ast::NodeId, ty: Ty) { debug!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_string(tcx, ty)); assert!(!ty::type_needs_infer(ty)); tcx.node_types.borrow_mut().insert(node_id, ty); @@ -318,7 +318,7 @@ pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: Span, id: ast::NodeId) lookup_def_tcx(ccx.tcx, sp, id) } -pub fn no_params(t: ty::t) -> ty::Polytype { +pub fn no_params(t: Ty) -> ty::Polytype { ty::Polytype { generics: ty::Generics {types: VecPerParamSpace::empty(), regions: VecPerParamSpace::empty()}, @@ -330,8 +330,8 @@ pub fn require_same_types(tcx: &ty::ctxt, maybe_infcx: Option<&infer::InferCtxt>, t1_is_expected: bool, span: Span, - t1: ty::t, - t2: ty::t, + t1: Ty, + t2: Ty, msg: || -> String) -> bool { let result = match maybe_infcx { diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index 76250d44baf..e3df42c2ada 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -199,7 +199,7 @@ use arena::Arena; use middle::resolve_lifetime as rl; use middle::subst; use middle::subst::{ParamSpace, FnSpace, TypeSpace, SelfSpace, VecPerParamSpace}; -use middle::ty; +use middle::ty::{mod, Ty}; use std::fmt; use std::rc::Rc; use syntax::ast; @@ -725,7 +725,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { /// Adds constraints appropriate for an instance of `ty` appearing /// in a context with ambient variance `variance` fn add_constraints_from_ty(&mut self, - ty: ty::t, + ty: Ty, variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_ty(ty={})", ty.repr(self.tcx())); diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 4ce783b37b7..28ddec69781 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -16,7 +16,7 @@ use middle::ty::{BoundRegion, BrAnon, BrNamed}; use middle::ty::{ReEarlyBound, BrFresh, ctxt}; use middle::ty::{ReFree, ReScope, ReInfer, ReStatic, Region, ReEmpty}; use middle::ty::{ReSkolemized, ReVar, BrEnv}; -use middle::ty::{mt, t, ParamTy}; +use middle::ty::{mt, Ty, ParamTy}; use middle::ty::{ty_bool, ty_char, ty_struct, ty_enum}; use middle::ty::{ty_err, ty_str, ty_vec, ty_float, ty_bare_fn, ty_closure}; use middle::ty::{ty_param, ty_ptr, ty_rptr, ty_tup, ty_open}; @@ -259,7 +259,7 @@ pub fn trait_ref_to_string(cx: &ctxt, trait_ref: &ty::TraitRef) -> String { trait_ref.user_string(cx).to_string() } -pub fn ty_to_string(cx: &ctxt, typ: t) -> String { +pub fn ty_to_string(cx: &ctxt, typ: Ty) -> String { fn bare_fn_to_string(cx: &ctxt, fn_style: ast::FnStyle, abi: abi::Abi, @@ -539,7 +539,7 @@ pub fn parameterized(cx: &ctxt, } } -pub fn ty_to_short_str(cx: &ctxt, typ: t) -> String { +pub fn ty_to_short_str(cx: &ctxt, typ: Ty) -> String { let mut s = typ.repr(cx).to_string(); if s.len() >= 32u { s = s.as_slice().slice(0u, 32u).to_string(); @@ -652,7 +652,7 @@ impl Repr for ty::RegionParameterDef { } } -impl Repr for ty::t { +impl Repr for Ty { fn repr(&self, tcx: &ctxt) -> String { ty_to_string(tcx, *self) } @@ -1188,7 +1188,7 @@ impl UserString for ty::TraitRef { } } -impl UserString for ty::t { +impl UserString for Ty { fn user_string(&self, tcx: &ctxt) -> String { ty_to_string(tcx, *self) } diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index d5d488e8965..264756ccf1e 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -22,7 +22,7 @@ use metadata::common::LinkMeta; use metadata::{encoder, cstore, filesearch, csearch, creader}; use trans::context::CrateContext; use trans::common::gensym_name; -use middle::ty; +use middle::ty::{mod, Ty}; use util::common::time; use util::ppaux; use util::sha2::{Digest, Sha256}; @@ -198,7 +198,7 @@ fn truncated_hash_result(symbol_hasher: &mut Sha256) -> String { // This calculates STH for a symbol, as defined above fn symbol_hash(tcx: &ty::ctxt, symbol_hasher: &mut Sha256, - t: ty::t, + t: Ty, link_meta: &LinkMeta) -> String { // NB: do *not* use abbrevs here as we want the symbol names @@ -219,7 +219,7 @@ fn symbol_hash(tcx: &ty::ctxt, hash } -fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> String { +fn get_symbol_hash(ccx: &CrateContext, t: Ty) -> String { match ccx.type_hashcodes().borrow().get(&t) { Some(h) => return h.to_string(), None => {} @@ -321,7 +321,7 @@ pub fn exported_name(path: PathElems, hash: &str) -> String { } pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems, - t: ty::t, id: ast::NodeId) -> String { + t: Ty, id: ast::NodeId) -> String { let mut hash = get_symbol_hash(ccx, t); // Paths can be completely identical for different nodes, @@ -346,7 +346,7 @@ pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems, } pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext, - t: ty::t, + t: Ty, name: &str) -> String { let s = ppaux::ty_to_string(ccx.tcx(), t); let path = [PathName(token::intern(s.as_slice())), diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs index c9410d753ae..68c6459820c 100644 --- a/src/librustc_trans/save/mod.rs +++ b/src/librustc_trans/save/mod.rs @@ -31,7 +31,7 @@ use driver::driver::CrateAnalysis; use session::Session; use middle::def; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck; use std::cell::Cell; diff --git a/src/librustc_trans/test.rs b/src/librustc_trans/test.rs index a17702ac1dc..897cd3cc542 100644 --- a/src/librustc_trans/test.rs +++ b/src/librustc_trans/test.rs @@ -24,7 +24,7 @@ use middle::resolve_lifetime; use middle::stability; use middle::subst; use middle::subst::Subst; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::infer::combine::Combine; use middle::typeck::infer; use middle::typeck::infer::lub::Lub; @@ -215,7 +215,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> { } } - pub fn make_subtype(&self, a: ty::t, b: ty::t) -> bool { + pub fn make_subtype(&self, a: Ty, b: Ty) -> bool { match infer::mk_subty(self.infcx, true, infer::Misc(DUMMY_SP), a, b) { Ok(_) => true, Err(ref e) => panic!("Encountered error: {}", @@ -223,14 +223,14 @@ impl<'a, 'tcx> Env<'a, 'tcx> { } } - pub fn is_subtype(&self, a: ty::t, b: ty::t) -> bool { + pub fn is_subtype(&self, a: Ty, b: Ty) -> bool { match infer::can_mk_subty(self.infcx, a, b) { Ok(_) => true, Err(_) => false } } - pub fn assert_subtype(&self, a: ty::t, b: ty::t) { + pub fn assert_subtype(&self, a: Ty, b: Ty) { if !self.is_subtype(a, b) { panic!("{} is not a subtype of {}, but it should be", self.ty_to_string(a), @@ -238,37 +238,36 @@ impl<'a, 'tcx> Env<'a, 'tcx> { } } - pub fn assert_eq(&self, a: ty::t, b: ty::t) { + pub fn assert_eq(&self, a: Ty, b: Ty) { self.assert_subtype(a, b); self.assert_subtype(b, a); } - pub fn ty_to_string(&self, a: ty::t) -> String { + pub fn ty_to_string(&self, a: Ty) -> String { ty_to_string(self.infcx.tcx, a) } pub fn t_fn(&self, - input_tys: &[ty::t], - output_ty: ty::t) - -> ty::t + input_tys: &[Ty], + output_ty: Ty) + -> Ty { ty::mk_ctor_fn(self.infcx.tcx, input_tys, output_ty) } - pub fn t_nil(&self) -> ty::t { + pub fn t_nil(&self) -> Ty { ty::mk_nil(self.infcx.tcx) } - pub fn t_pair(&self, ty1: ty::t, ty2: ty::t) -> ty::t - { + pub fn t_pair(&self, ty1: Ty, ty2: Ty) -> Ty { ty::mk_tup(self.infcx.tcx, vec![ty1, ty2]) } pub fn t_closure(&self, - input_tys: &[ty::t], - output_ty: ty::t, + input_tys: &[Ty], + output_ty: Ty, region_bound: ty::Region) - -> ty::t + -> Ty { ty::mk_closure(self.infcx.tcx, ty::ClosureTy { fn_style: ast::NormalFn, @@ -284,7 +283,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> { }) } - pub fn t_param(&self, space: subst::ParamSpace, index: uint) -> ty::t { + pub fn t_param(&self, space: subst::ParamSpace, index: uint) -> Ty { ty::mk_param(self.infcx.tcx, space, index, ast_util::local_def(ast::DUMMY_NODE_ID)) } @@ -302,23 +301,23 @@ impl<'a, 'tcx> Env<'a, 'tcx> { ty::ReLateBound(debruijn, ty::BrAnon(id)) } - pub fn t_rptr(&self, r: ty::Region) -> ty::t { + pub fn t_rptr(&self, r: ty::Region) -> Ty { ty::mk_imm_rptr(self.infcx.tcx, r, ty::mk_int()) } - pub fn t_rptr_late_bound(&self, id: uint) -> ty::t { + pub fn t_rptr_late_bound(&self, id: uint) -> Ty { ty::mk_imm_rptr(self.infcx.tcx, self.re_late_bound_with_debruijn(id, ty::DebruijnIndex::new(1)), ty::mk_int()) } - pub fn t_rptr_late_bound_with_debruijn(&self, id: uint, debruijn: ty::DebruijnIndex) -> ty::t { + pub fn t_rptr_late_bound_with_debruijn(&self, id: uint, debruijn: ty::DebruijnIndex) -> Ty { ty::mk_imm_rptr(self.infcx.tcx, self.re_late_bound_with_debruijn(id, debruijn), ty::mk_int()) } - pub fn t_rptr_scope(&self, id: ast::NodeId) -> ty::t { + pub fn t_rptr_scope(&self, id: ast::NodeId) -> Ty { ty::mk_imm_rptr(self.infcx.tcx, ty::ReScope(id), ty::mk_int()) } @@ -327,11 +326,11 @@ impl<'a, 'tcx> Env<'a, 'tcx> { bound_region: ty::BrAnon(id)}) } - pub fn t_rptr_free(&self, nid: ast::NodeId, id: uint) -> ty::t { + pub fn t_rptr_free(&self, nid: ast::NodeId, id: uint) -> Ty { ty::mk_imm_rptr(self.infcx.tcx, self.re_free(nid, id), ty::mk_int()) } - pub fn t_rptr_static(&self) -> ty::t { + pub fn t_rptr_static(&self) -> Ty { ty::mk_imm_rptr(self.infcx.tcx, ty::ReStatic, ty::mk_int()) } @@ -349,7 +348,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> { Glb(self.infcx.combine_fields(true, trace)) } - pub fn make_lub_ty(&self, t1: ty::t, t2: ty::t) -> ty::t { + pub fn make_lub_ty(&self, t1: Ty, t2: Ty) -> Ty { match self.lub().tys(t1, t2) { Ok(t) => t, Err(ref e) => panic!("unexpected error computing LUB: {}", @@ -358,7 +357,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> { } /// Checks that `LUB(t1,t2) == t_lub` - pub fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) { + pub fn check_lub(&self, t1: Ty, t2: Ty, t_lub: Ty) { match self.lub().tys(t1, t2) { Ok(t) => { self.assert_eq(t, t_lub); @@ -371,7 +370,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> { } /// Checks that `GLB(t1,t2) == t_glb` - pub fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) { + pub fn check_glb(&self, t1: Ty, t2: Ty, t_glb: Ty) { debug!("check_glb(t1={}, t2={}, t_glb={})", self.ty_to_string(t1), self.ty_to_string(t2), diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index 001a3a4dca0..5c90f64f298 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -217,7 +217,7 @@ use trans::expr::{mod, Dest}; use trans::tvec; use trans::type_of; use trans::debuginfo; -use middle::ty; +use middle::ty::{mod, Ty}; use session::config::FullDebugInfo; use util::common::indenter; use util::nodemap::FnvHashMap; @@ -339,7 +339,7 @@ pub struct BindingInfo { pub trmode: TransBindingMode, pub id: ast::NodeId, pub span: Span, - pub ty: ty::t, + pub ty: Ty, } type BindingsMap = FnvHashMap<Ident, BindingInfo>; @@ -620,7 +620,7 @@ fn extract_variant_args<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ExtractedBlock { vals: args, bcx: bcx } } -fn match_datum(val: ValueRef, left_ty: ty::t) -> Datum<Lvalue> { +fn match_datum(val: ValueRef, left_ty: Ty) -> Datum<Lvalue> { /*! * Helper for converting from the ValueRef that we pass around in * the match code, which is always an lvalue, into a Datum. Eventually @@ -655,7 +655,7 @@ fn bind_subslice_pat(bcx: Block, } fn extract_vec_elems<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - left_ty: ty::t, + left_ty: Ty, before: uint, after: uint, val: ValueRef) @@ -790,12 +790,12 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<uint> { fn compare_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>, lhs: ValueRef, rhs: ValueRef, - rhs_t: ty::t) + rhs_t: Ty) -> Result<'blk, 'tcx> { fn compare_str<'blk, 'tcx>(cx: Block<'blk, 'tcx>, lhs: ValueRef, rhs: ValueRef, - rhs_t: ty::t) + rhs_t: Ty) -> Result<'blk, 'tcx> { let did = langcall(cx, None, @@ -1560,7 +1560,7 @@ fn mk_binding_alloca<'blk, 'tcx, A>(bcx: Block<'blk, 'tcx>, ident: &ast::Ident, cleanup_scope: cleanup::ScopeId, arg: A, - populate: |A, Block<'blk, 'tcx>, ValueRef, ty::t| + populate: |A, Block<'blk, 'tcx>, ValueRef, Ty| -> Block<'blk, 'tcx>) -> Block<'blk, 'tcx> { let var_ty = node_id_type(bcx, p_id); diff --git a/src/librustc_trans/trans/adt.rs b/src/librustc_trans/trans/adt.rs index 806c4a68ba2..195808f2419 100644 --- a/src/librustc_trans/trans/adt.rs +++ b/src/librustc_trans/trans/adt.rs @@ -64,7 +64,7 @@ use trans::datum; use trans::machine; use trans::type_::Type; use trans::type_of; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty::Disr; use syntax::ast; use syntax::attr; @@ -105,8 +105,8 @@ pub enum Repr { */ RawNullablePointer { nndiscr: Disr, - nnty: ty::t, - nullfields: Vec<ty::t> + nnty: Ty, + nullfields: Vec<Ty> }, /** * Two cases distinguished by a nullable pointer: the case with discriminant @@ -123,7 +123,7 @@ pub enum Repr { nonnull: Struct, nndiscr: Disr, ptrfield: PointerField, - nullfields: Vec<ty::t>, + nullfields: Vec<Ty>, } } @@ -136,12 +136,12 @@ pub struct Struct { pub align: u32, pub sized: bool, pub packed: bool, - pub fields: Vec<ty::t> + pub fields: Vec<Ty> } /** * Convenience for `represent_type`. There should probably be more or - * these, for places in trans where the `ty::t` isn't directly + * these, for places in trans where the `Ty` isn't directly * available. */ pub fn represent_node(bcx: Block, node: ast::NodeId) -> Rc<Repr> { @@ -149,7 +149,7 @@ pub fn represent_node(bcx: Block, node: ast::NodeId) -> Rc<Repr> { } /// Decides how to represent a given type. -pub fn represent_type(cx: &CrateContext, t: ty::t) -> Rc<Repr> { +pub fn represent_type(cx: &CrateContext, t: Ty) -> Rc<Repr> { debug!("Representing: {}", ty_to_string(cx.tcx(), t)); match cx.adt_reprs().borrow().get(&t) { Some(repr) => return repr.clone(), @@ -162,7 +162,7 @@ pub fn represent_type(cx: &CrateContext, t: ty::t) -> Rc<Repr> { repr } -fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr { +fn represent_type_uncached(cx: &CrateContext, t: Ty) -> Repr { match ty::get(t).sty { ty::ty_tup(ref elems) => { return Univariant(mk_struct(cx, elems.as_slice(), false, t), false) @@ -287,7 +287,7 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr { // this should probably all be in ty struct Case { discr: Disr, - tys: Vec<ty::t> + tys: Vec<Ty> } @@ -298,7 +298,7 @@ pub enum PointerField { } impl Case { - fn is_zerolen(&self, cx: &CrateContext, scapegoat: ty::t) -> bool { + fn is_zerolen(&self, cx: &CrateContext, scapegoat: Ty) -> bool { mk_struct(cx, self.tys.as_slice(), false, scapegoat).size == 0 } @@ -345,7 +345,7 @@ fn get_cases(tcx: &ty::ctxt, def_id: ast::DefId, substs: &subst::Substs) -> Vec< }).collect() } -fn mk_struct(cx: &CrateContext, tys: &[ty::t], packed: bool, scapegoat: ty::t) -> Struct { +fn mk_struct(cx: &CrateContext, tys: &[Ty], packed: bool, scapegoat: Ty) -> Struct { let sized = tys.iter().all(|&ty| ty::type_is_sized(cx.tcx(), ty)); let lltys : Vec<Type> = if sized { tys.iter() @@ -450,7 +450,7 @@ fn bounds_usable(cx: &CrateContext, ity: IntType, bounds: &IntBounds) -> bool { } } -pub fn ty_of_inttype(ity: IntType) -> ty::t { +pub fn ty_of_inttype(ity: IntType) -> Ty { match ity { attr::SignedInt(t) => ty::mk_mach_int(t), attr::UnsignedInt(t) => ty::mk_mach_uint(t) @@ -461,7 +461,7 @@ pub fn ty_of_inttype(ity: IntType) -> ty::t { fn ensure_struct_fits_in_address_space(ccx: &CrateContext, fields: &[Type], packed: bool, - scapegoat: ty::t) { + scapegoat: Ty) { let mut offset = 0; for &llty in fields.iter() { // Invariant: offset < ccx.max_obj_size() <= 1<<61 @@ -489,7 +489,7 @@ fn union_size_and_align(sts: &[Struct]) -> (machine::llsize, machine::llalign) { fn ensure_enum_fits_in_address_space(ccx: &CrateContext, discr: IntType, fields: &[Struct], - scapegoat: ty::t) { + scapegoat: Ty) { let discr_size = machine::llsize_of_alloc(ccx, ll_inttype(ccx, discr)); let (field_size, field_align) = union_size_and_align(fields); diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 9c4a532790d..fdb19605b76 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -17,10 +17,10 @@ // // Hopefully useful general knowledge about trans: // -// * There's no way to find out the ty::t type of a ValueRef. Doing so +// * There's no way to find out the Ty type of a ValueRef. Doing so // would be "trying to get the eggs out of an omelette" (credit: // pcwalton). You can, instead, find out its TypeRef by calling val_ty, -// but one TypeRef corresponds to many `ty::t`s; for instance, tup(int, int, +// but one TypeRef corresponds to many `Ty`s; for instance, tup(int, int, // int) and rec(x=int, y=int, z=int) will have the same TypeRef. #![allow(non_camel_case_types)] @@ -41,7 +41,7 @@ use middle::lang_items::{LangItem, ExchangeMallocFnLangItem, StartFnLangItem}; use middle::subst; use middle::weak_lang_items; use middle::subst::Subst; -use middle::ty; +use middle::ty::{mod, Ty}; use session::config::{mod, NoDebugInfo, FullDebugInfo}; use session::Session; use trans::_match; @@ -170,7 +170,7 @@ impl<'a, 'tcx> Drop for StatRecorder<'a, 'tcx> { // only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions pub fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv, - ty: Type, output: ty::FnOutput) -> ValueRef { + ty: Type, output: ty::FnOutput) -> ValueRef { let llfn: ValueRef = name.with_c_str(|buf| { unsafe { @@ -203,7 +203,7 @@ pub fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv, pub fn decl_cdecl_fn(ccx: &CrateContext, name: &str, ty: Type, - output: ty::t) -> ValueRef { + output: Ty) -> ValueRef { decl_fn(ccx, name, llvm::CCallConv, ty, ty::FnConverging(output)) } @@ -213,7 +213,7 @@ pub fn get_extern_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv, ty: Type, - output: ty::t) + output: Ty) -> ValueRef { match externs.get(name) { Some(n) => return *n, @@ -224,7 +224,7 @@ pub fn get_extern_fn(ccx: &CrateContext, f } -fn get_extern_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str, did: ast::DefId) -> ValueRef { +fn get_extern_rust_fn(ccx: &CrateContext, fn_ty: Ty, name: &str, did: ast::DefId) -> ValueRef { match ccx.externs().borrow().get(name) { Some(n) => return *n, None => () @@ -242,8 +242,8 @@ fn get_extern_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str, did: ast::De pub fn self_type_for_unboxed_closure(ccx: &CrateContext, closure_id: ast::DefId, - fn_ty: ty::t) - -> ty::t { + fn_ty: Ty) + -> Ty { let unboxed_closures = ccx.tcx().unboxed_closures.borrow(); let unboxed_closure = &(*unboxed_closures)[closure_id]; match unboxed_closure.kind { @@ -263,7 +263,7 @@ pub fn kind_for_unboxed_closure(ccx: &CrateContext, closure_id: ast::DefId) (*unboxed_closures)[closure_id].kind } -pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef { +pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: Ty, name: &str) -> ValueRef { let (inputs, output, abi, env) = match ty::get(fn_ty).sty { ty::ty_bare_fn(ref f) => { (f.sig.inputs.clone(), f.sig.output, f.abi, None) @@ -297,14 +297,14 @@ pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef { llfn } -pub fn decl_internal_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef { +pub fn decl_internal_rust_fn(ccx: &CrateContext, fn_ty: Ty, name: &str) -> ValueRef { let llfn = decl_rust_fn(ccx, fn_ty, name); llvm::SetLinkage(llfn, llvm::InternalLinkage); llfn } pub fn get_extern_const(ccx: &CrateContext, did: ast::DefId, - t: ty::t) -> ValueRef { + t: Ty) -> ValueRef { let name = csearch::get_symbol(&ccx.sess().cstore, did); let ty = type_of(ccx, t); match ccx.externs().borrow_mut().get(&name) { @@ -335,7 +335,7 @@ pub fn get_extern_const(ccx: &CrateContext, did: ast::DefId, // Returns a pointer to the body for the box. The box may be an opaque // box. The result will be casted to the type of body_t, if it is statically // known. -pub fn at_box_body(bcx: Block, body_t: ty::t, boxptr: ValueRef) -> ValueRef { +pub fn at_box_body(bcx: Block, body_t: Ty, boxptr: ValueRef) -> ValueRef { let _icx = push_ctxt("at_box_body"); let ccx = bcx.ccx(); let ty = Type::at_box(ccx, type_of(ccx, body_t)); @@ -343,7 +343,7 @@ pub fn at_box_body(bcx: Block, body_t: ty::t, boxptr: ValueRef) -> ValueRef { GEPi(bcx, boxptr, &[0u, abi::box_field_body]) } -fn require_alloc_fn(bcx: Block, info_ty: ty::t, it: LangItem) -> ast::DefId { +fn require_alloc_fn(bcx: Block, info_ty: Ty, it: LangItem) -> ast::DefId { match bcx.tcx().lang_items.require(it) { Ok(id) => id, Err(s) => { @@ -359,7 +359,7 @@ fn require_alloc_fn(bcx: Block, info_ty: ty::t, it: LangItem) -> ast::DefId { pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, llty_ptr: Type, - info_ty: ty::t, + info_ty: Ty, size: ValueRef, align: ValueRef) -> Result<'blk, 'tcx> { @@ -374,7 +374,7 @@ pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, Result::new(r.bcx, PointerCast(r.bcx, r.val, llty_ptr)) } -pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: ty::t) -> Result<'blk, 'tcx> { +pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty) -> Result<'blk, 'tcx> { let _icx = push_ctxt("malloc_raw_dyn_proc"); let ccx = bcx.ccx(); @@ -399,7 +399,7 @@ pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: ty::t) -> Resu // Type descriptor and type glue stuff -pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> Rc<tydesc_info> { +pub fn get_tydesc(ccx: &CrateContext, t: Ty) -> Rc<tydesc_info> { match ccx.tydescs().borrow().get(&t) { Some(inf) => return inf.clone(), _ => { } @@ -496,7 +496,7 @@ pub fn note_unique_llvm_symbol(ccx: &CrateContext, sym: String) { pub fn get_res_dtor(ccx: &CrateContext, did: ast::DefId, - t: ty::t, + t: Ty, parent_id: ast::DefId, substs: &subst::Substs) -> ValueRef { @@ -549,7 +549,7 @@ pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, } pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>, lhs: ValueRef, rhs: ValueRef, - t: ty::t, + t: Ty, op: ast::BinOp) -> Result<'blk, 'tcx> { let f = |a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op)); @@ -631,7 +631,7 @@ pub fn compare_simd_types( cx: Block, lhs: ValueRef, rhs: ValueRef, - t: ty::t, + t: Ty, size: uint, op: ast::BinOp) -> ValueRef { @@ -666,12 +666,12 @@ pub fn compare_simd_types( } pub type val_and_ty_fn<'a, 'blk, 'tcx> = - |Block<'blk, 'tcx>, ValueRef, ty::t|: 'a -> Block<'blk, 'tcx>; + |Block<'blk, 'tcx>, ValueRef, Ty|: 'a -> Block<'blk, 'tcx>; // Iterates through the elements of a structural type. pub fn iter_structural_ty<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>, av: ValueRef, - t: ty::t, + t: Ty, f: val_and_ty_fn<'a, 'blk, 'tcx>) -> Block<'blk, 'tcx> { let _icx = push_ctxt("iter_structural_ty"); @@ -855,7 +855,7 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>( divrem: ast::BinOp, lhs: ValueRef, rhs: ValueRef, - rhs_t: ty::t) + rhs_t: Ty) -> Block<'blk, 'tcx> { let (zero_text, overflow_text) = if divrem == ast::BiDiv { ("attempted to divide by zero", @@ -922,7 +922,7 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>( } } -pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> ValueRef { +pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: Ty) -> ValueRef { let name = csearch::get_symbol(&ccx.sess().cstore, did); match ty::get(t).sty { ty::ty_bare_fn(ref fn_ty) => { @@ -951,7 +951,7 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, llfn: ValueRef, llargs: Vec<ValueRef> , - fn_ty: ty::t, + fn_ty: Ty, call_info: Option<NodeInfo>, // FIXME(15064) is_lang_item is a horrible hack, please remove it // at the soonest opportunity. @@ -1028,13 +1028,13 @@ pub fn need_invoke(bcx: Block) -> bool { bcx.fcx.needs_invoke() } -pub fn load_if_immediate(cx: Block, v: ValueRef, t: ty::t) -> ValueRef { +pub fn load_if_immediate(cx: Block, v: ValueRef, t: Ty) -> ValueRef { let _icx = push_ctxt("load_if_immediate"); if type_is_immediate(cx.ccx(), t) { return load_ty(cx, v, t); } return v; } -pub fn load_ty(cx: Block, ptr: ValueRef, t: ty::t) -> ValueRef { +pub fn load_ty(cx: Block, ptr: ValueRef, t: Ty) -> ValueRef { /*! * Helper for loading values from memory. Does the necessary conversion if * the in-memory type differs from the type used for SSA values. Also @@ -1054,7 +1054,7 @@ pub fn load_ty(cx: Block, ptr: ValueRef, t: ty::t) -> ValueRef { } } -pub fn store_ty(cx: Block, v: ValueRef, dst: ValueRef, t: ty::t) { +pub fn store_ty(cx: Block, v: ValueRef, dst: ValueRef, t: Ty) { /*! * Helper for storing values in memory. Does the necessary conversion if * the in-memory type differs from the type used for SSA values. @@ -1148,7 +1148,7 @@ pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, a Call(cx, memcpy, &[dst_ptr, src_ptr, size, align, volatile], None); } -pub fn memcpy_ty(bcx: Block, dst: ValueRef, src: ValueRef, t: ty::t) { +pub fn memcpy_ty(bcx: Block, dst: ValueRef, src: ValueRef, t: Ty) { let _icx = push_ctxt("memcpy_ty"); let ccx = bcx.ccx(); if ty::type_is_structural(t) { @@ -1161,7 +1161,7 @@ pub fn memcpy_ty(bcx: Block, dst: ValueRef, src: ValueRef, t: ty::t) { } } -pub fn zero_mem(cx: Block, llptr: ValueRef, t: ty::t) { +pub fn zero_mem(cx: Block, llptr: ValueRef, t: Ty) { if cx.unreachable.get() { return; } let _icx = push_ctxt("zero_mem"); let bcx = cx; @@ -1173,7 +1173,7 @@ pub fn zero_mem(cx: Block, llptr: ValueRef, t: ty::t) { // allocation for large data structures, and the generated code will be // awful. (A telltale sign of this is large quantities of // `mov [byte ptr foo],0` in the generated code.) -fn memzero(b: &Builder, llptr: ValueRef, ty: ty::t) { +fn memzero(b: &Builder, llptr: ValueRef, ty: Ty) { let _icx = push_ctxt("memzero"); let ccx = b.ccx; @@ -1194,7 +1194,7 @@ fn memzero(b: &Builder, llptr: ValueRef, ty: ty::t) { b.call(llintrinsicfn, &[llptr, llzeroval, size, align, volatile], None); } -pub fn alloc_ty(bcx: Block, t: ty::t, name: &str) -> ValueRef { +pub fn alloc_ty(bcx: Block, t: Ty, name: &str) -> ValueRef { let _icx = push_ctxt("alloc_ty"); let ccx = bcx.ccx(); let ty = type_of::type_of(ccx, t); @@ -1220,7 +1220,7 @@ pub fn alloca_no_lifetime(cx: Block, ty: Type, name: &str) -> ValueRef { Alloca(cx, ty, name) } -pub fn alloca_zeroed(cx: Block, ty: ty::t, name: &str) -> ValueRef { +pub fn alloca_zeroed(cx: Block, ty: Ty, name: &str) -> ValueRef { let llty = type_of::type_of(cx.ccx(), ty); if cx.unreachable.get() { unsafe { @@ -1248,7 +1248,7 @@ pub fn arrayalloca(cx: Block, ty: Type, v: ValueRef) -> ValueRef { } // Creates the alloca slot which holds the pointer to the slot for the final return value -pub fn make_return_slot_pointer(fcx: &FunctionContext, output_type: ty::t) -> ValueRef { +pub fn make_return_slot_pointer(fcx: &FunctionContext, output_type: Ty) -> ValueRef { let lloutputtype = type_of::type_of(fcx.ccx, output_type); // We create an alloca to hold a pointer of type `output_type` @@ -1499,7 +1499,7 @@ pub fn init_function<'a, 'tcx>(fcx: &'a FunctionContext<'a, 'tcx>, // - new_fn_ctxt // - trans_args -pub fn arg_kind(cx: &FunctionContext, t: ty::t) -> datum::Rvalue { +pub fn arg_kind(cx: &FunctionContext, t: Ty) -> datum::Rvalue { use trans::datum::{ByRef, ByValue}; datum::Rvalue { @@ -1515,7 +1515,7 @@ pub type LvalueDatum = datum::Datum<datum::Lvalue>; // incoming function arguments. These will later be stored into // appropriate lvalue datums. pub fn create_datums_for_fn_args(fcx: &FunctionContext, - arg_tys: &[ty::t]) + arg_tys: &[Ty]) -> Vec<RvalueDatum> { let _icx = push_ctxt("create_datums_for_fn_args"); @@ -1535,7 +1535,7 @@ pub fn create_datums_for_fn_args(fcx: &FunctionContext, fn create_datums_for_fn_args_under_call_abi( mut bcx: Block, arg_scope: cleanup::CustomScopeIndex, - arg_tys: &[ty::t]) + arg_tys: &[Ty]) -> Vec<RvalueDatum> { let mut result = Vec::new(); for (i, &arg_ty) in arg_tys.iter().enumerate() { @@ -1630,7 +1630,7 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>( arg_scope: cleanup::CustomScopeIndex, args: &[ast::Arg], arg_datums: Vec<RvalueDatum>, - monomorphized_arg_types: &[ty::t]) + monomorphized_arg_types: &[Ty]) -> Block<'blk, 'tcx> { let _icx = push_ctxt("copy_unboxed_closure_args_to_allocas"); let arg_scope_id = cleanup::CustomScope(arg_scope); @@ -1957,7 +1957,7 @@ pub fn trans_enum_variant(ccx: &CrateContext, } pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, - ctor_ty: ty::t, + ctor_ty: Ty, disr: ty::Disr, args: callee::CallArgs, dest: expr::Dest, @@ -2374,7 +2374,7 @@ fn register_fn(ccx: &CrateContext, sp: Span, sym: String, node_id: ast::NodeId, - node_type: ty::t) + node_type: Ty) -> ValueRef { match ty::get(node_type).sty { ty::ty_bare_fn(ref f) => { @@ -2388,7 +2388,7 @@ fn register_fn(ccx: &CrateContext, llfn } -pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) +pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: Ty) -> llvm::AttrBuilder { use middle::ty::{BrAnon, ReLateBound}; @@ -2665,7 +2665,7 @@ pub fn create_entry_wrapper(ccx: &CrateContext, } fn exported_name(ccx: &CrateContext, id: ast::NodeId, - ty: ty::t, attrs: &[ast::Attribute]) -> String { + ty: Ty, attrs: &[ast::Attribute]) -> String { match ccx.external_srcs().borrow().get(&id) { Some(&did) => { let sym = csearch::get_symbol(&ccx.sess().cstore, did); diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index de49754fe7f..574ead622c3 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -50,7 +50,7 @@ use trans::meth; use trans::monomorphize; use trans::type_::Type; use trans::type_of; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck::coherence::make_substs_for_receiver_types; use middle::typeck::MethodCall; use util::ppaux::Repr; @@ -671,7 +671,7 @@ pub fn trans_lang_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn trans_call_inner<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, call_info: Option<NodeInfo>, - callee_ty: ty::t, + callee_ty: Ty, get_callee: |bcx: Block<'blk, 'tcx>, arg_cleanup_scope: cleanup::ScopeId| -> Callee<'blk, 'tcx>, @@ -913,7 +913,7 @@ pub enum CallArgs<'a> { fn trans_args_under_call_abi<'blk, 'tcx>( mut bcx: Block<'blk, 'tcx>, arg_exprs: &[P<ast::Expr>], - fn_ty: ty::t, + fn_ty: Ty, llargs: &mut Vec<ValueRef>, arg_cleanup_scope: cleanup::ScopeId, ignore_self: bool) @@ -973,7 +973,7 @@ fn trans_args_under_call_abi<'blk, 'tcx>( fn trans_overloaded_call_args<'blk, 'tcx>( mut bcx: Block<'blk, 'tcx>, arg_exprs: Vec<&ast::Expr>, - fn_ty: ty::t, + fn_ty: Ty, llargs: &mut Vec<ValueRef>, arg_cleanup_scope: cleanup::ScopeId, ignore_self: bool) @@ -1018,7 +1018,7 @@ fn trans_overloaded_call_args<'blk, 'tcx>( pub fn trans_args<'blk, 'tcx>(cx: Block<'blk, 'tcx>, args: CallArgs, - fn_ty: ty::t, + fn_ty: Ty, llargs: &mut Vec<ValueRef> , arg_cleanup_scope: cleanup::ScopeId, ignore_self: bool, @@ -1108,7 +1108,7 @@ pub enum AutorefArg { } pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - formal_arg_ty: ty::t, + formal_arg_ty: Ty, arg_datum: Datum<Expr>, arg_cleanup_scope: cleanup::ScopeId, autoref_arg: AutorefArg) diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs index 02909b0e3a9..94b32c9b3af 100644 --- a/src/librustc_trans/trans/cleanup.rs +++ b/src/librustc_trans/trans/cleanup.rs @@ -27,7 +27,7 @@ use trans::common::{Block, FunctionContext, ExprId, NodeInfo}; use trans::debuginfo; use trans::glue; use trans::type_::Type; -use middle::ty; +use middle::ty::{mod, Ty}; use std::fmt; use syntax::ast; use util::ppaux::Repr; @@ -307,7 +307,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { fn schedule_drop_mem(&self, cleanup_scope: ScopeId, val: ValueRef, - ty: ty::t) { + ty: Ty) { /*! * Schedules a (deep) drop of `val`, which is a pointer to an * instance of `ty` @@ -333,7 +333,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { fn schedule_drop_and_zero_mem(&self, cleanup_scope: ScopeId, val: ValueRef, - ty: ty::t) { + ty: Ty) { /*! * Schedules a (deep) drop and zero-ing of `val`, which is a pointer * to an instance of `ty` @@ -360,7 +360,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { fn schedule_drop_immediate(&self, cleanup_scope: ScopeId, val: ValueRef, - ty: ty::t) { + ty: Ty) { /*! * Schedules a (deep) drop of `val`, which is an instance of `ty` */ @@ -386,7 +386,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { cleanup_scope: ScopeId, val: ValueRef, heap: Heap, - content_ty: ty::t) { + content_ty: Ty) { /*! * Schedules a call to `free(val)`. Note that this is a shallow * operation. @@ -959,7 +959,7 @@ pub struct DropValue { is_immediate: bool, must_unwind: bool, val: ValueRef, - ty: ty::t, + ty: Ty, zero: bool } @@ -1000,7 +1000,7 @@ pub enum Heap { pub struct FreeValue { ptr: ValueRef, heap: Heap, - content_ty: ty::t + content_ty: Ty } impl Cleanup for FreeValue { @@ -1166,20 +1166,20 @@ pub trait CleanupMethods<'blk, 'tcx> { fn schedule_drop_mem(&self, cleanup_scope: ScopeId, val: ValueRef, - ty: ty::t); + ty: Ty); fn schedule_drop_and_zero_mem(&self, cleanup_scope: ScopeId, val: ValueRef, - ty: ty::t); + ty: Ty); fn schedule_drop_immediate(&self, cleanup_scope: ScopeId, val: ValueRef, - ty: ty::t); + ty: Ty); fn schedule_free_value(&self, cleanup_scope: ScopeId, val: ValueRef, heap: Heap, - content_ty: ty::t); + content_ty: Ty); fn schedule_free_slice(&self, cleanup_scope: ScopeId, val: ValueRef, diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/trans/closure.rs index 3cb823aec34..f6a4e4bcf94 100644 --- a/src/librustc_trans/trans/closure.rs +++ b/src/librustc_trans/trans/closure.rs @@ -25,7 +25,7 @@ use trans::expr; use trans::monomorphize::MonoId; use trans::type_of::*; use trans::type_::Type; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::subst::{Subst, Substs}; use session::config::FullDebugInfo; use util::ppaux::Repr; @@ -115,7 +115,7 @@ impl EnvValue { // Given a closure ty, emits a corresponding tuple ty pub fn mk_closure_tys(tcx: &ty::ctxt, bound_values: &[EnvValue]) - -> ty::t { + -> Ty { // determine the types of the values in the env. Note that this // is the actual types that will be stored in the map, not the // logical types as the user sees them, so by-ref upvars must be @@ -131,14 +131,14 @@ pub fn mk_closure_tys(tcx: &ty::ctxt, return cdata_ty; } -fn tuplify_box_ty(tcx: &ty::ctxt, t: ty::t) -> ty::t { +fn tuplify_box_ty(tcx: &ty::ctxt, t: Ty) -> Ty { let ptr = ty::mk_imm_ptr(tcx, ty::mk_i8()); ty::mk_tup(tcx, vec!(ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t)) } fn allocate_cbox<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, store: ty::TraitStore, - cdata_ty: ty::t) + cdata_ty: Ty) -> Result<'blk, 'tcx> { let _icx = push_ctxt("closure::allocate_cbox"); let tcx = bcx.tcx(); @@ -158,7 +158,7 @@ fn allocate_cbox<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub struct ClosureResult<'blk, 'tcx: 'blk> { llbox: ValueRef, // llvalue of ptr to closure - cdata_ty: ty::t, // type of the closure data + cdata_ty: Ty, // type of the closure data bcx: Block<'blk, 'tcx> // final bcx } @@ -248,7 +248,7 @@ fn build_closure<'blk, 'tcx>(bcx0: Block<'blk, 'tcx>, // and a list of upvars, generate code to load and populate the environment // with the upvars and type descriptors. fn load_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - cdata_ty: ty::t, + cdata_ty: Ty, freevars: &Vec<ty::Freevar>, store: ty::TraitStore) -> Block<'blk, 'tcx> { @@ -553,7 +553,7 @@ pub fn trans_unboxed_closure<'blk, 'tcx>( } pub fn get_wrapper_for_bare_fn(ccx: &CrateContext, - closure_ty: ty::t, + closure_ty: Ty, def: def::Def, fn_ptr: ValueRef, is_local: bool) -> ValueRef { @@ -647,7 +647,7 @@ pub fn get_wrapper_for_bare_fn(ccx: &CrateContext, } pub fn make_closure_from_bare_fn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - closure_ty: ty::t, + closure_ty: Ty, def: def::Def, fn_ptr: ValueRef) -> DatumBlock<'blk, 'tcx, Expr> { diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs index 21cf3138661..fe867ed7039 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/trans/common.rs @@ -32,7 +32,7 @@ use trans::machine; use trans::type_::Type; use trans::type_of; use middle::traits; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::ty_fold; use middle::ty_fold::TypeFoldable; use middle::typeck; @@ -55,7 +55,7 @@ use syntax::parse::token; pub use trans::context::CrateContext; -fn type_is_newtype_immediate(ccx: &CrateContext, ty: ty::t) -> bool { +fn type_is_newtype_immediate(ccx: &CrateContext, ty: Ty) -> bool { match ty::get(ty).sty { ty::ty_struct(def_id, ref substs) => { let fields = ty::struct_fields(ccx.tcx(), def_id, substs); @@ -68,7 +68,7 @@ fn type_is_newtype_immediate(ccx: &CrateContext, ty: ty::t) -> bool { } } -pub fn type_is_immediate(ccx: &CrateContext, ty: ty::t) -> bool { +pub fn type_is_immediate(ccx: &CrateContext, ty: Ty) -> bool { use trans::machine::llsize_of_alloc; use trans::type_of::sizing_type_of; @@ -93,7 +93,7 @@ pub fn type_is_immediate(ccx: &CrateContext, ty: ty::t) -> bool { } } -pub fn type_is_zero_size(ccx: &CrateContext, ty: ty::t) -> bool { +pub fn type_is_zero_size(ccx: &CrateContext, ty: Ty) -> bool { /*! * Identify types which have size zero at runtime. */ @@ -104,7 +104,7 @@ pub fn type_is_zero_size(ccx: &CrateContext, ty: ty::t) -> bool { llsize_of_alloc(ccx, llty) == 0 } -pub fn return_type_is_void(ccx: &CrateContext, ty: ty::t) -> bool { +pub fn return_type_is_void(ccx: &CrateContext, ty: Ty) -> bool { /*! * Identifies types which we declare to be equivalent to `void` * in C for the purpose of function return types. These are @@ -126,7 +126,7 @@ pub fn gensym_name(name: &str) -> PathElem { } pub struct tydesc_info { - pub ty: ty::t, + pub ty: Ty, pub tydesc: ValueRef, pub size: ValueRef, pub align: ValueRef, @@ -495,7 +495,7 @@ impl<'blk, 'tcx> BlockS<'blk, 'tcx> { self.ccx().tn().type_to_string(ty) } - pub fn ty_to_string(&self, t: ty::t) -> String { + pub fn ty_to_string(&self, t: Ty) -> String { t.repr(self.tcx()) } @@ -509,11 +509,11 @@ impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> { self.tcx() } - fn node_ty(&self, id: ast::NodeId) -> mc::McResult<ty::t> { + fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty> { Ok(node_id_type(self, id)) } - fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t> { + fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<Ty> { self.tcx() .method_map .borrow() @@ -788,21 +788,21 @@ pub fn is_null(val: ValueRef) -> bool { } } -pub fn monomorphize_type(bcx: &BlockS, t: ty::t) -> ty::t { +pub fn monomorphize_type(bcx: &BlockS, t: Ty) -> Ty { t.subst(bcx.tcx(), &bcx.fcx.param_substs.substs) } -pub fn node_id_type(bcx: &BlockS, id: ast::NodeId) -> ty::t { +pub fn node_id_type(bcx: &BlockS, id: ast::NodeId) -> Ty { let tcx = bcx.tcx(); let t = ty::node_id_to_type(tcx, id); monomorphize_type(bcx, t) } -pub fn expr_ty(bcx: Block, ex: &ast::Expr) -> ty::t { +pub fn expr_ty(bcx: Block, ex: &ast::Expr) -> Ty { node_id_type(bcx, ex.id) } -pub fn expr_ty_adjusted(bcx: Block, ex: &ast::Expr) -> ty::t { +pub fn expr_ty_adjusted(bcx: Block, ex: &ast::Expr) -> Ty { monomorphize_type(bcx, ty::expr_ty_adjusted(bcx.tcx(), ex)) } diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index 545b12d2267..2100e57b190 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -29,7 +29,7 @@ use trans::machine; use trans::type_::Type; use trans::type_of; use trans::debuginfo; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux::{Repr, ty_to_string}; use std::c_str::ToCStr; @@ -133,14 +133,14 @@ fn const_deref_ptr(cx: &CrateContext, v: ValueRef) -> ValueRef { } } -fn const_deref_newtype(cx: &CrateContext, v: ValueRef, t: ty::t) +fn const_deref_newtype(cx: &CrateContext, v: ValueRef, t: Ty) -> ValueRef { let repr = adt::represent_type(cx, t); adt::const_get_field(cx, &*repr, v, 0, 0) } -fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool) - -> (ValueRef, ty::t) { +fn const_deref(cx: &CrateContext, v: ValueRef, t: Ty, explicit: bool) + -> (ValueRef, Ty) { match ty::deref(t, explicit) { Some(ref mt) => { match ty::get(t).sty { @@ -187,7 +187,7 @@ pub fn get_const_val(cx: &CrateContext, cx.const_values().borrow()[def_id.node].clone() } -pub fn const_expr(cx: &CrateContext, e: &ast::Expr) -> (ValueRef, ty::t) { +pub fn const_expr(cx: &CrateContext, e: &ast::Expr) -> (ValueRef, Ty) { let llconst = const_expr_unadjusted(cx, e); let mut llconst = llconst; let ety = ty::expr_ty(cx.tcx(), e); @@ -725,7 +725,7 @@ pub fn trans_static(ccx: &CrateContext, m: ast::Mutability, id: ast::NodeId) { } } -fn get_static_val(ccx: &CrateContext, did: ast::DefId, ty: ty::t) -> ValueRef { +fn get_static_val(ccx: &CrateContext, did: ast::DefId, ty: Ty) -> ValueRef { if ast_util::is_local(did) { return base::get_item_val(ccx, did.node) } base::trans_external_path(ccx, did, ty) } diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs index c2c1f8bb5f5..1e1dd399f3e 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/trans/context.rs @@ -22,7 +22,7 @@ use trans::common::{ExternMap,tydesc_info,BuilderRef_res}; use trans::debuginfo; use trans::monomorphize::MonoId; use trans::type_::{Type, TypeNames}; -use middle::ty; +use middle::ty::{mod, Ty}; use session::config::NoDebugInfo; use session::Session; use util::ppaux::Repr; @@ -70,7 +70,7 @@ pub struct SharedCrateContext<'tcx> { stats: Stats, available_monomorphizations: RefCell<FnvHashSet<String>>, - available_drop_glues: RefCell<FnvHashMap<ty::t, String>>, + available_drop_glues: RefCell<FnvHashMap<Ty, String>>, } /// The local portion of a `CrateContext`. There is one `LocalCrateContext` @@ -84,8 +84,8 @@ pub struct LocalCrateContext { tn: TypeNames, externs: RefCell<ExternMap>, item_vals: RefCell<NodeMap<ValueRef>>, - drop_glues: RefCell<FnvHashMap<ty::t, ValueRef>>, - tydescs: RefCell<FnvHashMap<ty::t, Rc<tydesc_info>>>, + drop_glues: RefCell<FnvHashMap<Ty, ValueRef>>, + tydescs: RefCell<FnvHashMap<Ty, Rc<tydesc_info>>>, /// Set when running emit_tydescs to enforce that no more tydescs are /// created. finished_tydescs: Cell<bool>, @@ -98,7 +98,7 @@ pub struct LocalCrateContext { monomorphized: RefCell<FnvHashMap<MonoId, ValueRef>>, monomorphizing: RefCell<DefIdMap<uint>>, /// Cache generated vtables - vtables: RefCell<FnvHashMap<(ty::t,Rc<ty::TraitRef>), ValueRef>>, + vtables: RefCell<FnvHashMap<(Ty, Rc<ty::TraitRef>), ValueRef>>, /// Cache of constant strings, const_cstr_cache: RefCell<FnvHashMap<InternedString, ValueRef>>, @@ -126,10 +126,10 @@ pub struct LocalCrateContext { /// Cache of closure wrappers for bare fn's. closure_bare_wrapper_cache: RefCell<FnvHashMap<ValueRef, ValueRef>>, - lltypes: RefCell<FnvHashMap<ty::t, Type>>, - llsizingtypes: RefCell<FnvHashMap<ty::t, Type>>, - adt_reprs: RefCell<FnvHashMap<ty::t, Rc<adt::Repr>>>, - type_hashcodes: RefCell<FnvHashMap<ty::t, String>>, + lltypes: RefCell<FnvHashMap<Ty, Type>>, + llsizingtypes: RefCell<FnvHashMap<Ty, Type>>, + adt_reprs: RefCell<FnvHashMap<Ty, Rc<adt::Repr>>>, + type_hashcodes: RefCell<FnvHashMap<Ty, String>>, all_llvm_symbols: RefCell<FnvHashSet<String>>, int_type: Type, opaque_vec_type: Type, @@ -574,11 +574,11 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { &self.shared.link_meta } - pub fn drop_glues<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, ValueRef>> { + pub fn drop_glues<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, ValueRef>> { &self.local.drop_glues } - pub fn tydescs<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, Rc<tydesc_info>>> { + pub fn tydescs<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, Rc<tydesc_info>>> { &self.local.tydescs } @@ -602,7 +602,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { &self.local.monomorphizing } - pub fn vtables<'a>(&'a self) -> &'a RefCell<FnvHashMap<(ty::t,Rc<ty::TraitRef>), ValueRef>> { + pub fn vtables<'a>(&'a self) -> &'a RefCell<FnvHashMap<(Ty, Rc<ty::TraitRef>), ValueRef>> { &self.local.vtables } @@ -635,15 +635,15 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { &self.local.closure_bare_wrapper_cache } - pub fn lltypes<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, Type>> { + pub fn lltypes<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, Type>> { &self.local.lltypes } - pub fn llsizingtypes<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, Type>> { + pub fn llsizingtypes<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, Type>> { &self.local.llsizingtypes } - pub fn adt_reprs<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, Rc<adt::Repr>>> { + pub fn adt_reprs<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, Rc<adt::Repr>>> { &self.local.adt_reprs } @@ -651,7 +651,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { &self.shared.symbol_hasher } - pub fn type_hashcodes<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, String>> { + pub fn type_hashcodes<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, String>> { &self.local.type_hashcodes } @@ -667,7 +667,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { &self.shared.available_monomorphizations } - pub fn available_drop_glues<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::t, String>> { + pub fn available_drop_glues<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty, String>> { &self.shared.available_drop_glues } @@ -707,7 +707,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { 1<<31 /* FIXME #18069: select based on architecture */ } - pub fn report_overbig_object(&self, obj: ty::t) -> ! { + pub fn report_overbig_object(&self, obj: Ty) -> ! { self.sess().fatal( format!("the type `{}` is too big for the current architecture", obj.repr(self.tcx())).as_slice()) diff --git a/src/librustc_trans/trans/datum.rs b/src/librustc_trans/trans/datum.rs index c4be6bf27b8..c778bc7eb27 100644 --- a/src/librustc_trans/trans/datum.rs +++ b/src/librustc_trans/trans/datum.rs @@ -25,7 +25,7 @@ use trans::cleanup::CleanupMethods; use trans::expr; use trans::tvec; use trans::type_of; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux::{ty_to_string}; use std::fmt; @@ -44,7 +44,7 @@ pub struct Datum<K> { pub val: ValueRef, /// The rust type of the value. - pub ty: ty::t, + pub ty: Ty, /// Indicates whether this is by-ref or by-value. pub kind: K, @@ -95,20 +95,20 @@ pub enum RvalueMode { ByValue, } -pub fn immediate_rvalue(val: ValueRef, ty: ty::t) -> Datum<Rvalue> { +pub fn immediate_rvalue(val: ValueRef, ty: Ty) -> Datum<Rvalue> { return Datum::new(val, ty, Rvalue::new(ByValue)); } pub fn immediate_rvalue_bcx<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, val: ValueRef, - ty: ty::t) + ty: Ty) -> DatumBlock<'blk, 'tcx, Rvalue> { return DatumBlock::new(bcx, immediate_rvalue(val, ty)) } pub fn lvalue_scratch_datum<'blk, 'tcx, A>(bcx: Block<'blk, 'tcx>, - ty: ty::t, + ty: Ty, name: &str, zero: bool, scope: cleanup::ScopeId, @@ -141,7 +141,7 @@ pub fn lvalue_scratch_datum<'blk, 'tcx, A>(bcx: Block<'blk, 'tcx>, } pub fn rvalue_scratch_datum(bcx: Block, - ty: ty::t, + ty: Ty, name: &str) -> Datum<Rvalue> { /*! @@ -159,7 +159,7 @@ pub fn rvalue_scratch_datum(bcx: Block, Datum::new(scratch, ty, Rvalue::new(ByRef)) } -pub fn appropriate_rvalue_mode(ccx: &CrateContext, ty: ty::t) -> RvalueMode { +pub fn appropriate_rvalue_mode(ccx: &CrateContext, ty: Ty) -> RvalueMode { /*! * Indicates the "appropriate" mode for this value, * which is either by ref or by value, depending @@ -177,7 +177,7 @@ fn add_rvalue_clean(mode: RvalueMode, fcx: &FunctionContext, scope: cleanup::ScopeId, val: ValueRef, - ty: ty::t) { + ty: Ty) { match mode { ByValue => { fcx.schedule_drop_immediate(scope, val, ty); } ByRef => { @@ -196,7 +196,7 @@ pub trait KindOps { fn post_store<'blk, 'tcx>(&self, bcx: Block<'blk, 'tcx>, val: ValueRef, - ty: ty::t) + ty: Ty) -> Block<'blk, 'tcx>; /** @@ -216,7 +216,7 @@ impl KindOps for Rvalue { fn post_store<'blk, 'tcx>(&self, bcx: Block<'blk, 'tcx>, _val: ValueRef, - _ty: ty::t) + _ty: Ty) -> Block<'blk, 'tcx> { // No cleanup is scheduled for an rvalue, so we don't have // to do anything after a move to cancel or duplicate it. @@ -236,7 +236,7 @@ impl KindOps for Lvalue { fn post_store<'blk, 'tcx>(&self, bcx: Block<'blk, 'tcx>, val: ValueRef, - ty: ty::t) + ty: Ty) -> Block<'blk, 'tcx> { /*! * If an lvalue is moved, we must zero out the memory in which @@ -266,7 +266,7 @@ impl KindOps for Expr { fn post_store<'blk, 'tcx>(&self, bcx: Block<'blk, 'tcx>, val: ValueRef, - ty: ty::t) + ty: Ty) -> Block<'blk, 'tcx> { match *self { LvalueExpr => Lvalue.post_store(bcx, val, ty), @@ -515,7 +515,7 @@ impl Datum<Lvalue> { // datum may also be unsized _without the size information_. It is the // callers responsibility to package the result in some way to make a valid // datum in that case (e.g., by making a fat pointer or opened pair). - pub fn get_element(&self, bcx: Block, ty: ty::t, + pub fn get_element(&self, bcx: Block, ty: Ty, gep: |ValueRef| -> ValueRef) -> Datum<Lvalue> { let val = match ty::get(self.ty).sty { @@ -546,7 +546,7 @@ impl Datum<Lvalue> { * Generic methods applicable to any sort of datum. */ impl<K: KindOps + fmt::Show> Datum<K> { - pub fn new(val: ValueRef, ty: ty::t, kind: K) -> Datum<K> { + pub fn new(val: ValueRef, ty: Ty, kind: K) -> Datum<K> { Datum { val: val, ty: ty, kind: kind } } diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 65fd9566760..6e8b3b2d915 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -172,9 +172,9 @@ to always map crate and node IDs back to the original crate context. As a side-effect these unique type IDs also help to solve a problem arising from lifetime parameters. Since lifetime parameters are completely omitted in -debuginfo, more than one `ty::t` instance may map to the same debuginfo type +debuginfo, more than one `Ty` instance may map to the same debuginfo type metadata, that is, some struct `Struct<'a>` may have N instantiations with -different concrete substitutions for `'a`, and thus there will be N `ty::t` +different concrete substitutions for `'a`, and thus there will be N `Ty` instances for the type `Struct<'a>` even though it is not generic otherwise. Unfortunately this means that we cannot use `ty::type_id()` as cheap identifier for type metadata---we have done this in the past, but it led to unnecessary @@ -204,7 +204,7 @@ use trans::_match::{BindingInfo, TrByCopy, TrByMove, TrByRef}; use trans::type_of; use trans::type_::Type; use trans; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::pat_util; use session::config::{mod, FullDebugInfo, LimitedDebugInfo, NoDebugInfo}; use util::nodemap::{DefIdMap, NodeMap, FnvHashMap, FnvHashSet}; @@ -258,7 +258,7 @@ struct UniqueTypeId(ast::Name); // The TypeMap is where the CrateDebugContext holds the type metadata nodes // created so far. The metadata nodes are indexed by UniqueTypeId, and, for -// faster lookup, also by ty::t. The TypeMap is responsible for creating +// faster lookup, also by Ty. The TypeMap is responsible for creating // UniqueTypeIds. struct TypeMap { // The UniqueTypeIds created so far @@ -266,9 +266,9 @@ struct TypeMap { // A map from UniqueTypeId to debuginfo metadata for that type. This is a 1:1 mapping. unique_id_to_metadata: FnvHashMap<UniqueTypeId, DIType>, // A map from types to debuginfo metadata. This is a N:1 mapping. - type_to_metadata: FnvHashMap<ty::t, DIType>, + type_to_metadata: FnvHashMap<Ty, DIType>, // A map from types to UniqueTypeId. This is a N:1 mapping. - type_to_unique_id: FnvHashMap<ty::t, UniqueTypeId> + type_to_unique_id: FnvHashMap<Ty, UniqueTypeId> } impl TypeMap { @@ -282,14 +282,14 @@ impl TypeMap { } } - // Adds a ty::t to metadata mapping to the TypeMap. The method will fail if + // Adds a Ty to metadata mapping to the TypeMap. The method will fail if // the mapping already exists. fn register_type_with_metadata(&mut self, cx: &CrateContext, - type_: ty::t, + type_: Ty, metadata: DIType) { if self.type_to_metadata.insert(type_, metadata).is_some() { - cx.sess().bug(format!("Type metadata for ty::t '{}' is already in the TypeMap!", + cx.sess().bug(format!("Type metadata for Ty '{}' is already in the TypeMap!", ppaux::ty_to_string(cx.tcx(), type_)).as_slice()); } } @@ -307,7 +307,7 @@ impl TypeMap { } } - fn find_metadata_for_type(&self, type_: ty::t) -> Option<DIType> { + fn find_metadata_for_type(&self, type_: Ty) -> Option<DIType> { self.type_to_metadata.get(&type_).cloned() } @@ -325,7 +325,7 @@ impl TypeMap { // Get the UniqueTypeId for the given type. If the UniqueTypeId for the given // type has been requested before, this is just a table lookup. Otherwise an // ID will be generated and stored for later lookup. - fn get_unique_type_id_of_type(&mut self, cx: &CrateContext, type_: ty::t) -> UniqueTypeId { + fn get_unique_type_id_of_type(&mut self, cx: &CrateContext, type_: Ty) -> UniqueTypeId { // basic type -> {:name of the type:} // tuple -> {tuple_(:param-uid:)*} @@ -621,7 +621,7 @@ impl TypeMap { // UniqueTypeId for them, since to debuginfo they *are* real types. fn get_unique_type_id_of_enum_variant(&mut self, cx: &CrateContext, - enum_type: ty::t, + enum_type: Ty, variant_name: &str) -> UniqueTypeId { let enum_type_id = self.get_unique_type_id_of_type(cx, enum_type); @@ -886,7 +886,7 @@ pub fn create_local_var_metadata(bcx: Block, local: &ast::Local) { /// Adds the created metadata nodes directly to the crate's IR. pub fn create_captured_var_metadata(bcx: Block, node_id: ast::NodeId, - env_data_type: ty::t, + env_data_type: Ty, env_pointer: ValueRef, env_index: uint, closure_store: ty::TraitStore, @@ -1592,7 +1592,7 @@ fn compile_unit_metadata(cx: &CrateContext) { fn declare_local(bcx: Block, variable_ident: ast::Ident, - variable_type: ty::t, + variable_type: Ty, scope_metadata: DIScope, variable_access: VariableAccess, variable_kind: VariableKind, @@ -1739,7 +1739,7 @@ fn diverging_type_metadata(cx: &CrateContext) -> DIType { }) } -fn basic_type_metadata(cx: &CrateContext, t: ty::t) -> DIType { +fn basic_type_metadata(cx: &CrateContext, t: Ty) -> DIType { debug!("basic_type_metadata: {}", ty::get(t)); @@ -1786,7 +1786,7 @@ fn basic_type_metadata(cx: &CrateContext, t: ty::t) -> DIType { } fn pointer_type_metadata(cx: &CrateContext, - pointer_type: ty::t, + pointer_type: Ty, pointee_type_metadata: DIType) -> DIType { let pointer_llvm_type = type_of::type_of(cx, pointer_type); @@ -1861,7 +1861,7 @@ impl MemberDescriptionFactory { // section on Recursive Types at the top of this file for more information. enum RecursiveTypeDescription { UnfinishedMetadata { - unfinished_type: ty::t, + unfinished_type: Ty, unique_type_id: UniqueTypeId, metadata_stub: DICompositeType, llvm_type: Type, @@ -1872,7 +1872,7 @@ enum RecursiveTypeDescription { fn create_and_register_recursive_type_forward_declaration( cx: &CrateContext, - unfinished_type: ty::t, + unfinished_type: Ty, unique_type_id: UniqueTypeId, metadata_stub: DICompositeType, llvm_type: Type, @@ -1989,7 +1989,7 @@ impl StructMemberDescriptionFactory { fn prepare_struct_metadata(cx: &CrateContext, - struct_type: ty::t, + struct_type: Ty, def_id: ast::DefId, substs: &subst::Substs, unique_type_id: UniqueTypeId, @@ -2029,7 +2029,7 @@ fn prepare_struct_metadata(cx: &CrateContext, // Creates MemberDescriptions for the fields of a tuple struct TupleMemberDescriptionFactory { - component_types: Vec<ty::t> , + component_types: Vec<Ty> , span: Span, } @@ -2049,8 +2049,8 @@ impl TupleMemberDescriptionFactory { } fn prepare_tuple_metadata(cx: &CrateContext, - tuple_type: ty::t, - component_types: &[ty::t], + tuple_type: Ty, + component_types: &[Ty], unique_type_id: UniqueTypeId, span: Span) -> RecursiveTypeDescription { @@ -2085,7 +2085,7 @@ fn prepare_tuple_metadata(cx: &CrateContext, // will produce one MemberDescription (all with no name and a fixed offset of // zero bytes). struct EnumMemberDescriptionFactory { - enum_type: ty::t, + enum_type: Ty, type_rep: Rc<adt::Repr>, variants: Rc<Vec<Rc<ty::VariantInfo>>>, discriminant_type_metadata: Option<DIType>, @@ -2287,7 +2287,7 @@ impl EnumMemberDescriptionFactory { // Creates MemberDescriptions for the fields of a single enum variant. struct VariantMemberDescriptionFactory { - args: Vec<(String, ty::t)> , + args: Vec<(String, Ty)> , discriminant_type_metadata: Option<DIType>, span: Span, } @@ -2320,7 +2320,7 @@ enum EnumDiscriminantInfo { // descriptions of the fields of the variant. This is a rudimentary version of a // full RecursiveTypeDescription. fn describe_enum_variant(cx: &CrateContext, - enum_type: ty::t, + enum_type: Ty, struct_def: &adt::Struct, variant_info: &ty::VariantInfo, discriminant_info: EnumDiscriminantInfo, @@ -2369,7 +2369,7 @@ fn describe_enum_variant(cx: &CrateContext, }; // Build an array of (field name, field type) pairs to be captured in the factory closure. - let args: Vec<(String, ty::t)> = arg_names.iter() + let args: Vec<(String, Ty)> = arg_names.iter() .zip(struct_def.fields.iter()) .map(|(s, &t)| (s.to_string(), t)) .collect(); @@ -2390,7 +2390,7 @@ fn describe_enum_variant(cx: &CrateContext, } fn prepare_enum_metadata(cx: &CrateContext, - enum_type: ty::t, + enum_type: Ty, enum_def_id: ast::DefId, unique_type_id: UniqueTypeId, span: Span) @@ -2677,7 +2677,7 @@ fn create_struct_stub(cx: &CrateContext, fn fixed_vec_metadata(cx: &CrateContext, unique_type_id: UniqueTypeId, - element_type: ty::t, + element_type: Ty, len: uint, span: Span) -> MetadataCreationResult { @@ -2709,8 +2709,8 @@ fn fixed_vec_metadata(cx: &CrateContext, } fn vec_slice_metadata(cx: &CrateContext, - vec_type: ty::t, - element_type: ty::t, + vec_type: Ty, + element_type: Ty, unique_type_id: UniqueTypeId, span: Span) -> MetadataCreationResult { @@ -2764,7 +2764,7 @@ fn vec_slice_metadata(cx: &CrateContext, fn slice_layout_is_correct(cx: &CrateContext, member_llvm_types: &[Type], - element_type: ty::t) + element_type: Ty) -> bool { member_llvm_types.len() == 2 && member_llvm_types[0] == type_of::type_of(cx, element_type).ptr_to() && @@ -2812,8 +2812,8 @@ fn subroutine_type_metadata(cx: &CrateContext, // of a DST struct, there is no trait_object_type and the results of this // function will be a little bit weird. fn trait_pointer_metadata(cx: &CrateContext, - trait_type: ty::t, - trait_object_type: Option<ty::t>, + trait_type: Ty, + trait_object_type: Option<Ty>, unique_type_id: UniqueTypeId) -> DIType { // The implementation provided here is a stub. It makes sure that the trait @@ -2849,7 +2849,7 @@ fn trait_pointer_metadata(cx: &CrateContext, } fn type_metadata(cx: &CrateContext, - t: ty::t, + t: Ty, usage_site_span: Span) -> DIType { // Get the unique type id of this type. @@ -2862,7 +2862,7 @@ fn type_metadata(cx: &CrateContext, return metadata; }, None => { - // The ty::t is not in the TypeMap but maybe we have already seen + // The Ty is not in the TypeMap but maybe we have already seen // an equivalent type (e.g. only differing in region arguments). // In order to find out, generate the unique type id and look // that up. @@ -2870,7 +2870,7 @@ fn type_metadata(cx: &CrateContext, match type_map.find_metadata_for_unique_id(unique_type_id) { Some(metadata) => { // There is already an equivalent type in the TypeMap. - // Register this ty::t as an alias in the cache and + // Register this Ty as an alias in the cache and // return the cached metadata. type_map.register_type_with_metadata(cx, t, metadata); return metadata; @@ -2986,7 +2986,7 @@ fn type_metadata(cx: &CrateContext, let error_message = format!("Expected type metadata for unique \ type id '{}' to already be in \ the debuginfo::TypeMap but it \ - was not. (ty::t = {})", + was not. (Ty = {})", unique_type_id_str.as_slice(), ppaux::ty_to_string(cx.tcx(), t)); cx.sess().span_bug(usage_site_span, error_message.as_slice()); @@ -2998,10 +2998,10 @@ fn type_metadata(cx: &CrateContext, if metadata != metadata_for_uid { let unique_type_id_str = type_map.get_unique_type_id_as_string(unique_type_id); - let error_message = format!("Mismatch between ty::t and \ + let error_message = format!("Mismatch between Ty and \ UniqueTypeId maps in \ debuginfo::TypeMap. \ - UniqueTypeId={}, ty::t={}", + UniqueTypeId={}, Ty={}", unique_type_id_str.as_slice(), ppaux::ty_to_string(cx.tcx(), t)); cx.sess().span_bug(usage_site_span, error_message.as_slice()); @@ -3667,7 +3667,7 @@ fn populate_scope_map(cx: &CrateContext, // the work twice. The `qualified` parameter only affects the first level of the // type name, further levels (i.e. type parameters) are always fully qualified. fn compute_debuginfo_type_name(cx: &CrateContext, - t: ty::t, + t: Ty, qualified: bool) -> String { let mut result = String::with_capacity(64); @@ -3678,7 +3678,7 @@ fn compute_debuginfo_type_name(cx: &CrateContext, // Pushes the name of the type as it should be stored in debuginfo on the // `output` String. See also compute_debuginfo_type_name(). fn push_debuginfo_type_name(cx: &CrateContext, - t: ty::t, + t: Ty, qualified: bool, output: &mut String) { match ty::get(t).sty { diff --git a/src/librustc_trans/trans/doc.rs b/src/librustc_trans/trans/doc.rs index 013483d0003..a5281e582f1 100644 --- a/src/librustc_trans/trans/doc.rs +++ b/src/librustc_trans/trans/doc.rs @@ -40,7 +40,7 @@ up expressions into: ## The Datum module A `Datum` encapsulates the result of evaluating a Rust expression. It -contains a `ValueRef` indicating the result, a `ty::t` describing +contains a `ValueRef` indicating the result, a `Ty` describing the Rust type, but also a *kind*. The kind indicates whether the datum has cleanup scheduled (lvalue) or not (rvalue) and -- in the case of rvalues -- whether or not the value is "by ref" or "by value". diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index 40a4d6047aa..abf1718b498 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -68,7 +68,7 @@ use trans::type_of; use middle::ty::{struct_fields, tup_fields}; use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe}; use middle::ty::{AutoPtr}; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck; use middle::typeck::MethodCall; use util::common::indenter; @@ -314,8 +314,8 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, fn unsized_info<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, kind: &ty::UnsizeKind, id: ast::NodeId, - unsized_ty: ty::t, - mk_ty: |ty::t| -> ty::t) -> ValueRef { + unsized_ty: Ty, + mk_ty: |Ty| -> Ty) -> ValueRef { match kind { &ty::UnsizeLength(len) => C_uint(bcx.ccx(), len), &ty::UnsizeStruct(box ref k, tp_index) => match ty::get(unsized_ty).sty { @@ -391,7 +391,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, fn into_fat_ptr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr, datum: Datum<Expr>, - dest_ty: ty::t, + dest_ty: Ty, base: |Block<'blk, 'tcx>, ValueRef| -> ValueRef, info: |Block<'blk, 'tcx>, ValueRef| -> ValueRef) -> DatumBlock<'blk, 'tcx, Expr> { @@ -566,7 +566,7 @@ fn trans_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, } }; - fn nil<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ty: ty::t) + fn nil<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ty: Ty) -> DatumBlock<'blk, 'tcx, Expr> { let llval = C_undef(type_of::type_of(bcx.ccx(), ty)); let datum = immediate_rvalue(llval, ty); @@ -858,7 +858,7 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, let const_ty = expr_ty(bcx, ref_expr); fn get_val<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, did: ast::DefId, - const_ty: ty::t) -> ValueRef { + const_ty: Ty) -> ValueRef { // For external constants, we don't inline. if did.krate == ast::LOCAL_CRATE { // Case 1. @@ -1267,7 +1267,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, } pub fn with_field_tys<R>(tcx: &ty::ctxt, - ty: ty::t, + ty: Ty, node_id_opt: Option<ast::NodeId>, op: |ty::Disr, (&[ty::field])| -> R) -> R { @@ -1393,7 +1393,7 @@ pub struct StructBaseInfo<'a> { /// The base expression; will be evaluated after all explicit fields. expr: &'a ast::Expr, /// The indices of fields to copy paired with their types. - fields: Vec<(uint, ty::t)> + fields: Vec<(uint, Ty)> } /** @@ -1407,7 +1407,7 @@ pub struct StructBaseInfo<'a> { * which remaining fields are copied; see comments on `StructBaseInfo`. */ pub fn trans_adt<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, - ty: ty::t, + ty: Ty, discr: ty::Disr, fields: &[(uint, &ast::Expr)], optbase: Option<StructBaseInfo>, @@ -1572,9 +1572,9 @@ fn trans_unary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, } fn trans_uniq_expr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - box_ty: ty::t, + box_ty: Ty, contents: &ast::Expr, - contents_ty: ty::t) + contents_ty: Ty) -> DatumBlock<'blk, 'tcx, Expr> { let _icx = push_ctxt("trans_uniq_expr"); let fcx = bcx.fcx; @@ -1635,11 +1635,11 @@ fn trans_addr_of<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // and the other not. fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, binop_expr: &ast::Expr, - binop_ty: ty::t, + binop_ty: Ty, op: ast::BinOp, - lhs_t: ty::t, + lhs_t: Ty, lhs: ValueRef, - rhs_t: ty::t, + rhs_t: Ty, rhs: ValueRef) -> DatumBlock<'blk, 'tcx, Expr> { let _icx = push_ctxt("trans_eager_binop"); @@ -1907,7 +1907,7 @@ pub enum cast_kind { cast_other, } -pub fn cast_type_kind(tcx: &ty::ctxt, t: ty::t) -> cast_kind { +pub fn cast_type_kind(tcx: &ty::ctxt, t: Ty) -> cast_kind { match ty::get(t).sty { ty::ty_char => cast_integral, ty::ty_float(..) => cast_float, @@ -1927,7 +1927,7 @@ pub fn cast_type_kind(tcx: &ty::ctxt, t: ty::t) -> cast_kind { } } -fn cast_is_noop(t_in: ty::t, t_out: ty::t) -> bool { +fn cast_is_noop(t_in: Ty, t_out: Ty) -> bool { match (ty::deref(t_in, true), ty::deref(t_out, true)) { (Some(ty::mt{ ty: t_in, .. }), Some(ty::mt{ ty: t_out, .. })) => { t_in == t_out @@ -2196,7 +2196,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, fn deref_owned_pointer<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr, datum: Datum<Expr>, - content_ty: ty::t) + content_ty: Ty) -> DatumBlock<'blk, 'tcx, Expr> { /*! * We microoptimize derefs of owned pointers a bit here. diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs index f86a0994bf9..78a0fc08fbc 100644 --- a/src/librustc_trans/trans/foreign.rs +++ b/src/librustc_trans/trans/foreign.rs @@ -23,7 +23,7 @@ use trans::type_::Type; use trans::type_of::*; use trans::type_of; use middle::ty::FnSig; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::subst::Subst; use std::cmp; use libc::c_uint; @@ -161,7 +161,7 @@ pub fn register_static(ccx: &CrateContext, } } -pub fn register_foreign_item_fn(ccx: &CrateContext, abi: Abi, fty: ty::t, +pub fn register_foreign_item_fn(ccx: &CrateContext, abi: Abi, fty: Ty, name: &str) -> ValueRef { /*! * Registers a foreign function found in a library. @@ -201,11 +201,11 @@ pub fn register_foreign_item_fn(ccx: &CrateContext, abi: Abi, fty: ty::t, } pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - callee_ty: ty::t, + callee_ty: Ty, llfn: ValueRef, llretptr: ValueRef, llargs_rust: &[ValueRef], - passed_arg_tys: Vec<ty::t> ) + passed_arg_tys: Vec<Ty> ) -> Block<'blk, 'tcx> { /*! * Prepares a call to a native function. This requires adapting @@ -484,7 +484,7 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) { // correct code in the first place, but this is much simpler. pub fn decl_rust_fn_with_foreign_abi(ccx: &CrateContext, - t: ty::t, + t: Ty, name: &str) -> ValueRef { let tys = foreign_types_for_fn_ty(ccx, t); @@ -593,7 +593,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext, llrustfn: ValueRef, llwrapfn: ValueRef, tys: &ForeignTypes, - t: ty::t) { + t: Ty) { let _icx = push_ctxt( "foreign::trans_rust_fn_with_foreign_abi::build_wrap_fn"); let tcx = ccx.tcx(); @@ -832,7 +832,7 @@ pub fn link_name(i: &ast::ForeignItem) -> InternedString { } } -fn foreign_signature(ccx: &CrateContext, fn_sig: &ty::FnSig, arg_tys: &[ty::t]) +fn foreign_signature(ccx: &CrateContext, fn_sig: &ty::FnSig, arg_tys: &[Ty]) -> LlvmSignature { /*! * The ForeignSignature is the LLVM types of the arguments/return type @@ -862,7 +862,7 @@ fn foreign_types_for_id(ccx: &CrateContext, } fn foreign_types_for_fn_ty(ccx: &CrateContext, - ty: ty::t) -> ForeignTypes { + ty: Ty) -> ForeignTypes { let fn_sig = match ty::get(ty).sty { ty::ty_bare_fn(ref fn_ty) => fn_ty.sig.clone(), _ => ccx.sess().bug("foreign_types_for_fn_ty called on non-function type") @@ -934,7 +934,7 @@ fn lltype_for_fn_from_foreign_types(ccx: &CrateContext, tys: &ForeignTypes) -> T } } -pub fn lltype_for_foreign_fn(ccx: &CrateContext, ty: ty::t) -> Type { +pub fn lltype_for_foreign_fn(ccx: &CrateContext, ty: Ty) -> Type { lltype_for_fn_from_foreign_types(ccx, &foreign_types_for_fn_ty(ccx, ty)) } diff --git a/src/librustc_trans/trans/glue.rs b/src/librustc_trans/trans/glue.rs index 5188ca77350..ea17f65dd65 100644 --- a/src/librustc_trans/trans/glue.rs +++ b/src/librustc_trans/trans/glue.rs @@ -34,7 +34,7 @@ use trans::machine::*; use trans::tvec; use trans::type_::Type; use trans::type_of::{type_of, sizing_type_of, align_of}; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux::{ty_to_short_str, Repr}; use util::ppaux; @@ -62,7 +62,7 @@ pub fn trans_exchange_free<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef, } pub fn trans_exchange_free_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ptr: ValueRef, - content_ty: ty::t) -> Block<'blk, 'tcx> { + content_ty: Ty) -> Block<'blk, 'tcx> { assert!(ty::type_is_sized(bcx.ccx().tcx(), content_ty)); let sizing_type = sizing_type_of(bcx.ccx(), content_ty); let content_size = llsize_of_alloc(bcx.ccx(), sizing_type); @@ -76,7 +76,7 @@ pub fn trans_exchange_free_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ptr: ValueRef, } } -pub fn get_drop_glue_type(ccx: &CrateContext, t: ty::t) -> ty::t { +pub fn get_drop_glue_type(ccx: &CrateContext, t: Ty) -> Ty { let tcx = ccx.tcx(); // Even if there is no dtor for t, there might be one deeper down and we // might need to pass in the vtable ptr. @@ -103,7 +103,7 @@ pub fn get_drop_glue_type(ccx: &CrateContext, t: ty::t) -> ty::t { pub fn drop_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v: ValueRef, - t: ty::t, + t: Ty, source_location: Option<NodeInfo>) -> Block<'blk, 'tcx> { // NB: v is an *alias* of type t here, not a direct value. @@ -131,7 +131,7 @@ pub fn drop_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn drop_ty_immediate<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v: ValueRef, - t: ty::t, + t: Ty, source_location: Option<NodeInfo>) -> Block<'blk, 'tcx> { let _icx = push_ctxt("drop_ty_immediate"); @@ -140,7 +140,7 @@ pub fn drop_ty_immediate<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, drop_ty(bcx, vp, t, source_location) } -pub fn get_drop_glue(ccx: &CrateContext, t: ty::t) -> ValueRef { +pub fn get_drop_glue(ccx: &CrateContext, t: Ty) -> ValueRef { debug!("make drop glue for {}", ppaux::ty_to_string(ccx.tcx(), t)); let t = get_drop_glue_type(ccx, t); debug!("drop glue type {}", ppaux::ty_to_string(ccx.tcx(), t)); @@ -185,7 +185,7 @@ pub fn get_drop_glue(ccx: &CrateContext, t: ty::t) -> ValueRef { } fn trans_struct_drop_flag<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, - t: ty::t, + t: Ty, v0: ValueRef, dtor_did: ast::DefId, class_did: ast::DefId, @@ -205,7 +205,7 @@ fn trans_struct_drop_flag<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, } fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - t: ty::t, + t: Ty, v0: ValueRef, dtor_did: ast::DefId, class_did: ast::DefId, @@ -297,7 +297,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, }) } -fn size_and_align_of_dst(bcx: Block, t :ty::t, info: ValueRef) -> (ValueRef, ValueRef) { +fn size_and_align_of_dst(bcx: Block, t :Ty, info: ValueRef) -> (ValueRef, ValueRef) { debug!("calculate size of DST: {}; with lost info: {}", bcx.ty_to_string(t), bcx.val_to_string(info)); if ty::type_is_sized(bcx.tcx(), t) { @@ -352,7 +352,7 @@ fn size_and_align_of_dst(bcx: Block, t :ty::t, info: ValueRef) -> (ValueRef, Val } } -fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: ty::t) +fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty) -> Block<'blk, 'tcx> { // NB: v0 is an *alias* of type t here, not a direct value. let _icx = push_ctxt("make_drop_glue"); @@ -477,7 +477,7 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: ty::t) } // Generates the declaration for (but doesn't emit) a type descriptor. -pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> tydesc_info { +pub fn declare_tydesc(ccx: &CrateContext, t: Ty) -> tydesc_info { // If emit_tydescs already ran, then we shouldn't be creating any new // tydescs. assert!(!ccx.finished_tydescs().get()); @@ -514,7 +514,7 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> tydesc_info { } } -fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type, +fn declare_generic_glue(ccx: &CrateContext, t: Ty, llfnty: Type, name: &str) -> (String, ValueRef) { let _icx = push_ctxt("declare_generic_glue"); let fn_nm = mangle_internal_name_by_type_and_seq( @@ -527,9 +527,9 @@ fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type, } fn make_generic_glue(ccx: &CrateContext, - t: ty::t, + t: Ty, llfn: ValueRef, - helper: for<'blk, 'tcx> |Block<'blk, 'tcx>, ValueRef, ty::t| + helper: for<'blk, 'tcx> |Block<'blk, 'tcx>, ValueRef, Ty| -> Block<'blk, 'tcx>, name: &str) -> ValueRef { diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 3bc6c30f8d6..8a523525ce1 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -28,7 +28,7 @@ use trans::type_of; use trans::machine; use trans::machine::llsize_of; use trans::type_::Type; -use middle::ty; +use middle::ty::{mod, Ty}; use syntax::abi::RustIntrinsic; use syntax::ast; use syntax::parse::token; @@ -136,7 +136,7 @@ pub fn check_intrinsics(ccx: &CrateContext) { } pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::NodeId, - callee_ty: ty::t, cleanup_scope: cleanup::CustomScopeIndex, + callee_ty: Ty, cleanup_scope: cleanup::CustomScopeIndex, args: callee::CallArgs, dest: expr::Dest, substs: subst::Substs, call_info: NodeInfo) -> Result<'blk, 'tcx> { @@ -554,7 +554,7 @@ pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::N } fn copy_intrinsic(bcx: Block, allow_overlap: bool, volatile: bool, - tp_ty: ty::t, dst: ValueRef, src: ValueRef, count: ValueRef) -> ValueRef { + tp_ty: Ty, dst: ValueRef, src: ValueRef, count: ValueRef) -> ValueRef { let ccx = bcx.ccx(); let lltp_ty = type_of::type_of(ccx, tp_ty); let align = C_i32(ccx, type_of::align_of(ccx, tp_ty) as i32); @@ -582,7 +582,7 @@ fn copy_intrinsic(bcx: Block, allow_overlap: bool, volatile: bool, C_bool(ccx, volatile)], None) } -fn memset_intrinsic(bcx: Block, volatile: bool, tp_ty: ty::t, +fn memset_intrinsic(bcx: Block, volatile: bool, tp_ty: Ty, dst: ValueRef, val: ValueRef, count: ValueRef) -> ValueRef { let ccx = bcx.ccx(); let lltp_ty = type_of::type_of(ccx, tp_ty); @@ -607,7 +607,7 @@ fn count_zeros_intrinsic(bcx: Block, name: &'static str, val: ValueRef) -> Value Call(bcx, llfn, &[val, y], None) } -fn with_overflow_intrinsic(bcx: Block, name: &'static str, t: ty::t, +fn with_overflow_intrinsic(bcx: Block, name: &'static str, t: Ty, a: ValueRef, b: ValueRef) -> ValueRef { let llfn = bcx.ccx().get_intrinsic(&name); diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs index 90777afff7e..ae36a7a2622 100644 --- a/src/librustc_trans/trans/meth.rs +++ b/src/librustc_trans/trans/meth.rs @@ -30,7 +30,7 @@ use trans::glue; use trans::machine; use trans::type_::Type; use trans::type_of::*; -use middle::ty; +use middle::ty::{mod, Ty}; use middle::typeck; use middle::typeck::MethodCall; use util::ppaux::Repr; @@ -424,7 +424,7 @@ fn combine_impl_and_methods_tps(bcx: Block, } fn trans_trait_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - method_ty: ty::t, + method_ty: Ty, n_method: uint, self_expr: &ast::Expr, arg_cleanup_scope: cleanup::ScopeId) @@ -468,7 +468,7 @@ fn trans_trait_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, } pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, - callee_ty: ty::t, + callee_ty: Ty, n_method: uint, llpair: ValueRef) -> Callee<'blk, 'tcx> { @@ -527,7 +527,7 @@ pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, /// `Foo<T>`. This `box_ty` is primarily used to encode the destructor. /// This will hopefully change now that DST is underway. pub fn get_vtable(bcx: Block, - box_ty: ty::t, + box_ty: Ty, trait_ref: Rc<ty::TraitRef>) -> ValueRef { diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs index 52aa81fa427..3dfa3e10e26 100644 --- a/src/librustc_trans/trans/monomorphize.rs +++ b/src/librustc_trans/trans/monomorphize.rs @@ -20,7 +20,7 @@ use trans::base::{trans_fn, decl_internal_rust_fn}; use trans::base; use trans::common::*; use trans::foreign; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux::Repr; use syntax::abi; @@ -286,5 +286,5 @@ pub fn monomorphic_fn(ccx: &CrateContext, #[deriving(PartialEq, Eq, Hash, Show)] pub struct MonoId { pub def: ast::DefId, - pub params: subst::VecPerParamSpace<ty::t> + pub params: subst::VecPerParamSpace<Ty> } diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/trans/tvec.rs index 0590d7c785a..1d34ad29a23 100644 --- a/src/librustc_trans/trans/tvec.rs +++ b/src/librustc_trans/trans/tvec.rs @@ -27,7 +27,7 @@ use trans::machine; use trans::machine::{nonzero_llsize_of, llsize_of_alloc}; use trans::type_::Type; use trans::type_of; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux::ty_to_string; use syntax::ast; @@ -52,7 +52,7 @@ pub fn pointer_add_byte(bcx: Block, ptr: ValueRef, bytes: ValueRef) -> ValueRef pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, vptr: ValueRef, - unit_ty: ty::t, + unit_ty: Ty, should_deallocate: bool) -> Block<'blk, 'tcx> { let not_null = IsNotNull(bcx, vptr); @@ -90,7 +90,7 @@ pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, } pub struct VecTypes { - pub unit_ty: ty::t, + pub unit_ty: Ty, pub llunit_ty: Type, pub llunit_size: ValueRef, pub llunit_alloc_size: u64 @@ -342,7 +342,7 @@ pub fn vec_types_from_expr(bcx: Block, vec_expr: &ast::Expr) -> VecTypes { vec_types(bcx, ty::sequence_element_type(bcx.tcx(), vec_ty)) } -pub fn vec_types(bcx: Block, unit_ty: ty::t) -> VecTypes { +pub fn vec_types(bcx: Block, unit_ty: Ty) -> VecTypes { let ccx = bcx.ccx(); let llunit_ty = type_of::type_of(ccx, unit_ty); let llunit_size = nonzero_llsize_of(ccx, llunit_ty); @@ -404,7 +404,7 @@ fn get_slice_base_and_len(bcx: Block, pub fn get_base_and_len(bcx: Block, llval: ValueRef, - vec_ty: ty::t) + vec_ty: Ty) -> (ValueRef, ValueRef) { /*! * Converts a vector into the slice pair. The vector should be @@ -437,7 +437,7 @@ pub fn get_base_and_len(bcx: Block, } pub type iter_vec_block<'a, 'blk, 'tcx> = - |Block<'blk, 'tcx>, ValueRef, ty::t|: 'a -> Block<'blk, 'tcx>; + |Block<'blk, 'tcx>, ValueRef, Ty|: 'a -> Block<'blk, 'tcx>; pub fn iter_vec_loop<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>, data_ptr: ValueRef, @@ -497,7 +497,7 @@ pub fn iter_vec_loop<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn iter_vec_raw<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>, data_ptr: ValueRef, - unit_ty: ty::t, + unit_ty: Ty, len: ValueRef, f: iter_vec_block<'a, 'blk, 'tcx>) -> Block<'blk, 'tcx> { diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs index 5fa21984637..b466aecf7bb 100644 --- a/src/librustc_trans/trans/type_of.rs +++ b/src/librustc_trans/trans/type_of.rs @@ -17,7 +17,7 @@ use trans::adt; use trans::common::*; use trans::foreign; use trans::machine; -use middle::ty; +use middle::ty::{mod, Ty}; use util::ppaux; use util::ppaux::Repr; @@ -31,7 +31,7 @@ use syntax::ast; fn ensure_array_fits_in_address_space(ccx: &CrateContext, llet: Type, size: machine::llsize, - scapegoat: ty::t) { + scapegoat: Ty) { let esz = machine::llsize_of_alloc(ccx, llet); match esz.checked_mul(size) { Some(n) if n < ccx.max_obj_size() => {} @@ -39,15 +39,15 @@ fn ensure_array_fits_in_address_space(ccx: &CrateContext, } } -pub fn arg_is_indirect(ccx: &CrateContext, arg_ty: ty::t) -> bool { +pub fn arg_is_indirect(ccx: &CrateContext, arg_ty: Ty) -> bool { !type_is_immediate(ccx, arg_ty) } -pub fn return_uses_outptr(ccx: &CrateContext, ty: ty::t) -> bool { +pub fn return_uses_outptr(ccx: &CrateContext, ty: Ty) -> bool { !type_is_immediate(ccx, ty) } -pub fn type_of_explicit_arg(ccx: &CrateContext, arg_ty: ty::t) -> Type { +pub fn type_of_explicit_arg(ccx: &CrateContext, arg_ty: Ty) -> Type { let llty = arg_type_of(ccx, arg_ty); if arg_is_indirect(ccx, arg_ty) { llty.ptr_to() @@ -60,9 +60,9 @@ pub fn type_of_explicit_arg(ccx: &CrateContext, arg_ty: ty::t) -> Type { /// functions, these are simply the types of the arguments. For functions with /// the `RustCall` ABI, however, this untuples the arguments of the function. pub fn untuple_arguments_if_necessary(ccx: &CrateContext, - inputs: &[ty::t], + inputs: &[Ty], abi: abi::Abi) - -> Vec<ty::t> { + -> Vec<Ty> { if abi != abi::RustCall { return inputs.iter().map(|x| (*x).clone()).collect() } @@ -96,7 +96,7 @@ pub fn untuple_arguments_if_necessary(ccx: &CrateContext, pub fn type_of_rust_fn(cx: &CrateContext, llenvironment_type: Option<Type>, - inputs: &[ty::t], + inputs: &[Ty], output: ty::FnOutput, abi: abi::Abi) -> Type { @@ -138,7 +138,7 @@ pub fn type_of_rust_fn(cx: &CrateContext, } // Given a function type and a count of ty params, construct an llvm type -pub fn type_of_fn_from_ty(cx: &CrateContext, fty: ty::t) -> Type { +pub fn type_of_fn_from_ty(cx: &CrateContext, fty: Ty) -> Type { match ty::get(fty).sty { ty::ty_closure(ref f) => { type_of_rust_fn(cx, @@ -175,7 +175,7 @@ pub fn type_of_fn_from_ty(cx: &CrateContext, fty: ty::t) -> Type { // type behind pointers. This can help prevent infinite loops for // recursive types. For example, enum types rely on this behavior. -pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type { +pub fn sizing_type_of(cx: &CrateContext, t: Ty) -> Type { match cx.llsizingtypes().borrow().get(&t).cloned() { Some(t) => return t, None => () @@ -247,7 +247,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type { llsizingty } -pub fn arg_type_of(cx: &CrateContext, t: ty::t) -> Type { +pub fn arg_type_of(cx: &CrateContext, t: Ty) -> Type { if ty::type_is_bool(t) { Type::i1(cx) } else { @@ -256,8 +256,8 @@ pub fn arg_type_of(cx: &CrateContext, t: ty::t) -> Type { } // NB: If you update this, be sure to update `sizing_type_of()` as well. -pub fn type_of(cx: &CrateContext, t: ty::t) -> Type { - fn type_of_unsize_info(cx: &CrateContext, t: ty::t) -> Type { +pub fn type_of(cx: &CrateContext, t: Ty) -> Type { + fn type_of_unsize_info(cx: &CrateContext, t: Ty) -> Type { // It is possible to end up here with a sized type. This happens with a // struct which might be unsized, but is monomorphised to a sized type. // In this case we'll fake a fat pointer with no unsize info (we use 0). @@ -433,7 +433,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type { return llty; } -pub fn align_of(cx: &CrateContext, t: ty::t) -> machine::llalign { +pub fn align_of(cx: &CrateContext, t: Ty) -> machine::llalign { let llty = sizing_type_of(cx, t); machine::llalign_of_min(cx, llty) } @@ -448,7 +448,7 @@ pub enum named_ty { pub fn llvm_type_name(cx: &CrateContext, what: named_ty, did: ast::DefId, - tps: &[ty::t]) + tps: &[Ty]) -> String { let name = match what { @@ -472,7 +472,7 @@ pub fn llvm_type_name(cx: &CrateContext, } } -pub fn type_of_dtor(ccx: &CrateContext, self_ty: ty::t) -> Type { +pub fn type_of_dtor(ccx: &CrateContext, self_ty: Ty) -> Type { let self_ty = type_of(ccx, self_ty).ptr_to(); Type::func(&[self_ty], &Type::void(ccx)) } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index d622965dac7..48cec8bfecb 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1257,7 +1257,7 @@ impl Clean<Type> for ast::Ty { } } -impl Clean<Type> for ty::t { +impl Clean<Type> for Ty { fn clean(&self, cx: &DocContext) -> Type { match ty::get(*self).sty { ty::ty_bool => Primitive(Bool), @@ -2255,7 +2255,7 @@ impl Clean<Item> for ast::Typedef { } fn lang_struct(cx: &DocContext, did: Option<ast::DefId>, - t: ty::t, name: &str, + t: Ty, name: &str, fallback: fn(Box<Type>) -> Type) -> Type { let did = match did { Some(did) => did, |
