Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
This commit is contained in:
parent
54f16b818b
commit
43bfaa4a33
1391 changed files with 5180 additions and 5238 deletions
|
|
@ -30,7 +30,6 @@
|
|||
#![feature(collections)]
|
||||
#![feature(core)]
|
||||
#![feature(hash)]
|
||||
#![feature(int_uint)]
|
||||
#![feature(libc)]
|
||||
#![feature(old_path)]
|
||||
#![feature(quote)]
|
||||
|
|
|
|||
|
|
@ -21,82 +21,82 @@ use back::svh::Svh;
|
|||
// 0xf0..0xff: internally used by RBML to encode 0x100..0xfff in two bytes
|
||||
// 0x100..0xfff: free for use, preferred for infrequent tags
|
||||
|
||||
pub const tag_items: uint = 0x100; // top-level only
|
||||
pub const tag_items: usize = 0x100; // top-level only
|
||||
|
||||
pub const tag_paths_data_name: uint = 0x20;
|
||||
pub const tag_paths_data_name: usize = 0x20;
|
||||
|
||||
pub const tag_def_id: uint = 0x21;
|
||||
pub const tag_def_id: usize = 0x21;
|
||||
|
||||
pub const tag_items_data: uint = 0x22;
|
||||
pub const tag_items_data: usize = 0x22;
|
||||
|
||||
pub const tag_items_data_item: uint = 0x23;
|
||||
pub const tag_items_data_item: usize = 0x23;
|
||||
|
||||
pub const tag_items_data_item_family: uint = 0x24;
|
||||
pub const tag_items_data_item_family: usize = 0x24;
|
||||
|
||||
pub const tag_items_data_item_type: uint = 0x25;
|
||||
pub const tag_items_data_item_type: usize = 0x25;
|
||||
|
||||
pub const tag_items_data_item_symbol: uint = 0x26;
|
||||
pub const tag_items_data_item_symbol: usize = 0x26;
|
||||
|
||||
pub const tag_items_data_item_variant: uint = 0x27;
|
||||
pub const tag_items_data_item_variant: usize = 0x27;
|
||||
|
||||
pub const tag_items_data_parent_item: uint = 0x28;
|
||||
pub const tag_items_data_parent_item: usize = 0x28;
|
||||
|
||||
pub const tag_items_data_item_is_tuple_struct_ctor: uint = 0x29;
|
||||
pub const tag_items_data_item_is_tuple_struct_ctor: usize = 0x29;
|
||||
|
||||
pub const tag_index: uint = 0x2a;
|
||||
pub const tag_index: usize = 0x2a;
|
||||
|
||||
pub const tag_index_buckets: uint = 0x2b;
|
||||
pub const tag_index_buckets: usize = 0x2b;
|
||||
|
||||
pub const tag_index_buckets_bucket: uint = 0x2c;
|
||||
pub const tag_index_buckets_bucket: usize = 0x2c;
|
||||
|
||||
pub const tag_index_buckets_bucket_elt: uint = 0x2d;
|
||||
pub const tag_index_buckets_bucket_elt: usize = 0x2d;
|
||||
|
||||
pub const tag_index_table: uint = 0x2e;
|
||||
pub const tag_index_table: usize = 0x2e;
|
||||
|
||||
pub const tag_meta_item_name_value: uint = 0x2f;
|
||||
pub const tag_meta_item_name_value: usize = 0x2f;
|
||||
|
||||
pub const tag_meta_item_name: uint = 0x30;
|
||||
pub const tag_meta_item_name: usize = 0x30;
|
||||
|
||||
pub const tag_meta_item_value: uint = 0x31;
|
||||
pub const tag_meta_item_value: usize = 0x31;
|
||||
|
||||
pub const tag_attributes: uint = 0x101; // top-level only
|
||||
pub const tag_attributes: usize = 0x101; // top-level only
|
||||
|
||||
pub const tag_attribute: uint = 0x32;
|
||||
pub const tag_attribute: usize = 0x32;
|
||||
|
||||
pub const tag_meta_item_word: uint = 0x33;
|
||||
pub const tag_meta_item_word: usize = 0x33;
|
||||
|
||||
pub const tag_meta_item_list: uint = 0x34;
|
||||
pub const tag_meta_item_list: usize = 0x34;
|
||||
|
||||
// The list of crates that this crate depends on
|
||||
pub const tag_crate_deps: uint = 0x102; // top-level only
|
||||
pub const tag_crate_deps: usize = 0x102; // top-level only
|
||||
|
||||
// A single crate dependency
|
||||
pub const tag_crate_dep: uint = 0x35;
|
||||
pub const tag_crate_dep: usize = 0x35;
|
||||
|
||||
pub const tag_crate_hash: uint = 0x103; // top-level only
|
||||
pub const tag_crate_crate_name: uint = 0x104; // top-level only
|
||||
pub const tag_crate_hash: usize = 0x103; // top-level only
|
||||
pub const tag_crate_crate_name: usize = 0x104; // top-level only
|
||||
|
||||
pub const tag_crate_dep_crate_name: uint = 0x36;
|
||||
pub const tag_crate_dep_hash: uint = 0x37;
|
||||
pub const tag_crate_dep_crate_name: usize = 0x36;
|
||||
pub const tag_crate_dep_hash: usize = 0x37;
|
||||
|
||||
pub const tag_mod_impl: uint = 0x38;
|
||||
pub const tag_mod_impl: usize = 0x38;
|
||||
|
||||
pub const tag_item_trait_item: uint = 0x39;
|
||||
pub const tag_item_trait_item: usize = 0x39;
|
||||
|
||||
pub const tag_item_trait_ref: uint = 0x3a;
|
||||
pub const tag_item_trait_ref: usize = 0x3a;
|
||||
|
||||
// discriminator value for variants
|
||||
pub const tag_disr_val: uint = 0x3c;
|
||||
pub const tag_disr_val: usize = 0x3c;
|
||||
|
||||
// used to encode ast_map::PathElem
|
||||
pub const tag_path: uint = 0x3d;
|
||||
pub const tag_path_len: uint = 0x3e;
|
||||
pub const tag_path_elem_mod: uint = 0x3f;
|
||||
pub const tag_path_elem_name: uint = 0x40;
|
||||
pub const tag_item_field: uint = 0x41;
|
||||
pub const tag_item_field_origin: uint = 0x42;
|
||||
pub const tag_path: usize = 0x3d;
|
||||
pub const tag_path_len: usize = 0x3e;
|
||||
pub const tag_path_elem_mod: usize = 0x3f;
|
||||
pub const tag_path_elem_name: usize = 0x40;
|
||||
pub const tag_item_field: usize = 0x41;
|
||||
pub const tag_item_field_origin: usize = 0x42;
|
||||
|
||||
pub const tag_item_variances: uint = 0x43;
|
||||
pub const tag_item_variances: usize = 0x43;
|
||||
/*
|
||||
trait items contain tag_item_trait_item elements,
|
||||
impl items contain tag_item_impl_item elements, and classes
|
||||
|
|
@ -105,19 +105,19 @@ pub const tag_item_variances: uint = 0x43;
|
|||
both, tag_item_trait_item and tag_item_impl_item have to be two
|
||||
different tags.
|
||||
*/
|
||||
pub const tag_item_impl_item: uint = 0x44;
|
||||
pub const tag_item_trait_method_explicit_self: uint = 0x45;
|
||||
pub const tag_item_impl_item: usize = 0x44;
|
||||
pub const tag_item_trait_method_explicit_self: usize = 0x45;
|
||||
|
||||
|
||||
// Reexports are found within module tags. Each reexport contains def_ids
|
||||
// and names.
|
||||
pub const tag_items_data_item_reexport: uint = 0x46;
|
||||
pub const tag_items_data_item_reexport_def_id: uint = 0x47;
|
||||
pub const tag_items_data_item_reexport_name: uint = 0x48;
|
||||
pub const tag_items_data_item_reexport: usize = 0x46;
|
||||
pub const tag_items_data_item_reexport_def_id: usize = 0x47;
|
||||
pub const tag_items_data_item_reexport_name: usize = 0x48;
|
||||
|
||||
// used to encode crate_ctxt side tables
|
||||
#[derive(Copy, PartialEq, FromPrimitive)]
|
||||
#[repr(uint)]
|
||||
#[repr(usize)]
|
||||
pub enum astencode_tag { // Reserves 0x50 -- 0x6f
|
||||
tag_ast = 0x50,
|
||||
|
||||
|
|
@ -149,15 +149,15 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
|
|||
tag_table_const_qualif = 0x69,
|
||||
}
|
||||
|
||||
pub const tag_item_trait_item_sort: uint = 0x70;
|
||||
pub const tag_item_trait_item_sort: usize = 0x70;
|
||||
|
||||
pub const tag_item_trait_parent_sort: uint = 0x71;
|
||||
pub const tag_item_trait_parent_sort: usize = 0x71;
|
||||
|
||||
pub const tag_item_impl_type_basename: uint = 0x72;
|
||||
pub const tag_item_impl_type_basename: usize = 0x72;
|
||||
|
||||
pub const tag_crate_triple: uint = 0x105; // top-level only
|
||||
pub const tag_crate_triple: usize = 0x105; // top-level only
|
||||
|
||||
pub const tag_dylib_dependency_formats: uint = 0x106; // top-level only
|
||||
pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only
|
||||
|
||||
// Language items are a top-level directory (for speed). Hierarchy:
|
||||
//
|
||||
|
|
@ -166,47 +166,47 @@ pub const tag_dylib_dependency_formats: uint = 0x106; // top-level only
|
|||
// - tag_lang_items_item_id: u32
|
||||
// - tag_lang_items_item_node_id: u32
|
||||
|
||||
pub const tag_lang_items: uint = 0x107; // top-level only
|
||||
pub const tag_lang_items_item: uint = 0x73;
|
||||
pub const tag_lang_items_item_id: uint = 0x74;
|
||||
pub const tag_lang_items_item_node_id: uint = 0x75;
|
||||
pub const tag_lang_items_missing: uint = 0x76;
|
||||
pub const tag_lang_items: usize = 0x107; // top-level only
|
||||
pub const tag_lang_items_item: usize = 0x73;
|
||||
pub const tag_lang_items_item_id: usize = 0x74;
|
||||
pub const tag_lang_items_item_node_id: usize = 0x75;
|
||||
pub const tag_lang_items_missing: usize = 0x76;
|
||||
|
||||
pub const tag_item_unnamed_field: uint = 0x77;
|
||||
pub const tag_items_data_item_visibility: uint = 0x78;
|
||||
pub const tag_item_unnamed_field: usize = 0x77;
|
||||
pub const tag_items_data_item_visibility: usize = 0x78;
|
||||
|
||||
pub const tag_item_method_tps: uint = 0x79;
|
||||
pub const tag_item_method_fty: uint = 0x7a;
|
||||
pub const tag_item_method_tps: usize = 0x79;
|
||||
pub const tag_item_method_fty: usize = 0x7a;
|
||||
|
||||
pub const tag_mod_child: uint = 0x7b;
|
||||
pub const tag_misc_info: uint = 0x108; // top-level only
|
||||
pub const tag_misc_info_crate_items: uint = 0x7c;
|
||||
pub const tag_mod_child: usize = 0x7b;
|
||||
pub const tag_misc_info: usize = 0x108; // top-level only
|
||||
pub const tag_misc_info_crate_items: usize = 0x7c;
|
||||
|
||||
pub const tag_item_method_provided_source: uint = 0x7d;
|
||||
pub const tag_item_impl_vtables: uint = 0x7e;
|
||||
pub const tag_item_method_provided_source: usize = 0x7d;
|
||||
pub const tag_item_impl_vtables: usize = 0x7e;
|
||||
|
||||
pub const tag_impls: uint = 0x109; // top-level only
|
||||
pub const tag_impls_impl: uint = 0x7f;
|
||||
pub const tag_impls: usize = 0x109; // top-level only
|
||||
pub const tag_impls_impl: usize = 0x7f;
|
||||
|
||||
pub const tag_items_data_item_inherent_impl: uint = 0x80;
|
||||
pub const tag_items_data_item_extension_impl: uint = 0x81;
|
||||
pub const tag_items_data_item_inherent_impl: usize = 0x80;
|
||||
pub const tag_items_data_item_extension_impl: usize = 0x81;
|
||||
|
||||
pub const tag_native_libraries: uint = 0x10a; // top-level only
|
||||
pub const tag_native_libraries_lib: uint = 0x82;
|
||||
pub const tag_native_libraries_name: uint = 0x83;
|
||||
pub const tag_native_libraries_kind: uint = 0x84;
|
||||
pub const tag_native_libraries: usize = 0x10a; // top-level only
|
||||
pub const tag_native_libraries_lib: usize = 0x82;
|
||||
pub const tag_native_libraries_name: usize = 0x83;
|
||||
pub const tag_native_libraries_kind: usize = 0x84;
|
||||
|
||||
pub const tag_plugin_registrar_fn: uint = 0x10b; // top-level only
|
||||
pub const tag_plugin_registrar_fn: usize = 0x10b; // top-level only
|
||||
|
||||
pub const tag_method_argument_names: uint = 0x85;
|
||||
pub const tag_method_argument_name: uint = 0x86;
|
||||
pub const tag_method_argument_names: usize = 0x85;
|
||||
pub const tag_method_argument_name: usize = 0x86;
|
||||
|
||||
pub const tag_reachable_extern_fns: uint = 0x10c; // top-level only
|
||||
pub const tag_reachable_extern_fn_id: uint = 0x87;
|
||||
pub const tag_reachable_extern_fns: usize = 0x10c; // top-level only
|
||||
pub const tag_reachable_extern_fn_id: usize = 0x87;
|
||||
|
||||
pub const tag_items_data_item_stability: uint = 0x88;
|
||||
pub const tag_items_data_item_stability: usize = 0x88;
|
||||
|
||||
pub const tag_items_data_item_repr: uint = 0x89;
|
||||
pub const tag_items_data_item_repr: usize = 0x89;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct LinkMeta {
|
||||
|
|
@ -214,45 +214,45 @@ pub struct LinkMeta {
|
|||
pub crate_hash: Svh,
|
||||
}
|
||||
|
||||
pub const tag_struct_fields: uint = 0x10d; // top-level only
|
||||
pub const tag_struct_field: uint = 0x8a;
|
||||
pub const tag_struct_field_id: uint = 0x8b;
|
||||
pub const tag_struct_fields: usize = 0x10d; // top-level only
|
||||
pub const tag_struct_field: usize = 0x8a;
|
||||
pub const tag_struct_field_id: usize = 0x8b;
|
||||
|
||||
pub const tag_attribute_is_sugared_doc: uint = 0x8c;
|
||||
pub const tag_attribute_is_sugared_doc: usize = 0x8c;
|
||||
|
||||
pub const tag_items_data_region: uint = 0x8e;
|
||||
pub const tag_items_data_region: usize = 0x8e;
|
||||
|
||||
pub const tag_region_param_def: uint = 0x8f;
|
||||
pub const tag_region_param_def_ident: uint = 0x90;
|
||||
pub const tag_region_param_def_def_id: uint = 0x91;
|
||||
pub const tag_region_param_def_space: uint = 0x92;
|
||||
pub const tag_region_param_def_index: uint = 0x93;
|
||||
pub const tag_region_param_def: usize = 0x8f;
|
||||
pub const tag_region_param_def_ident: usize = 0x90;
|
||||
pub const tag_region_param_def_def_id: usize = 0x91;
|
||||
pub const tag_region_param_def_space: usize = 0x92;
|
||||
pub const tag_region_param_def_index: usize = 0x93;
|
||||
|
||||
pub const tag_type_param_def: uint = 0x94;
|
||||
pub const tag_type_param_def: usize = 0x94;
|
||||
|
||||
pub const tag_item_generics: uint = 0x95;
|
||||
pub const tag_method_ty_generics: uint = 0x96;
|
||||
pub const tag_item_generics: usize = 0x95;
|
||||
pub const tag_method_ty_generics: usize = 0x96;
|
||||
|
||||
pub const tag_predicate: uint = 0x97;
|
||||
pub const tag_predicate_space: uint = 0x98;
|
||||
pub const tag_predicate_data: uint = 0x99;
|
||||
pub const tag_predicate: usize = 0x97;
|
||||
pub const tag_predicate_space: usize = 0x98;
|
||||
pub const tag_predicate_data: usize = 0x99;
|
||||
|
||||
pub const tag_unsafety: uint = 0x9a;
|
||||
pub const tag_unsafety: usize = 0x9a;
|
||||
|
||||
pub const tag_associated_type_names: uint = 0x9b;
|
||||
pub const tag_associated_type_name: uint = 0x9c;
|
||||
pub const tag_associated_type_names: usize = 0x9b;
|
||||
pub const tag_associated_type_name: usize = 0x9c;
|
||||
|
||||
pub const tag_polarity: uint = 0x9d;
|
||||
pub const tag_polarity: usize = 0x9d;
|
||||
|
||||
pub const tag_macro_defs: uint = 0x10e; // top-level only
|
||||
pub const tag_macro_def: uint = 0x9e;
|
||||
pub const tag_macro_def_body: uint = 0x9f;
|
||||
pub const tag_macro_defs: usize = 0x10e; // top-level only
|
||||
pub const tag_macro_def: usize = 0x9e;
|
||||
pub const tag_macro_def_body: usize = 0x9f;
|
||||
|
||||
pub const tag_paren_sugar: uint = 0xa0;
|
||||
pub const tag_paren_sugar: usize = 0xa0;
|
||||
|
||||
pub const tag_codemap: uint = 0xa1;
|
||||
pub const tag_codemap_filemap: uint = 0xa2;
|
||||
pub const tag_codemap: usize = 0xa1;
|
||||
pub const tag_codemap_filemap: usize = 0xa2;
|
||||
|
||||
pub const tag_item_super_predicates: uint = 0xa3;
|
||||
pub const tag_item_super_predicates: usize = 0xa3;
|
||||
|
||||
pub const tag_defaulted_trait: uint = 0xa4;
|
||||
pub const tag_defaulted_trait: usize = 0xa4;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ pub fn each_lang_item<F>(cstore: &cstore::CStore,
|
|||
cnum: ast::CrateNum,
|
||||
f: F)
|
||||
-> bool where
|
||||
F: FnMut(ast::NodeId, uint) -> bool,
|
||||
F: FnMut(ast::NodeId, usize) -> bool,
|
||||
{
|
||||
let crate_data = cstore.get_crate_data(cnum);
|
||||
decoder::each_lang_item(&*crate_data, f)
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ impl MetadataBlob {
|
|||
let len = (((slice[0] as u32) << 24) |
|
||||
((slice[1] as u32) << 16) |
|
||||
((slice[2] as u32) << 8) |
|
||||
((slice[3] as u32) << 0)) as uint;
|
||||
((slice[3] as u32) << 0)) as usize;
|
||||
if len + 4 <= slice.len() {
|
||||
&slice[4.. len + 4]
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -71,15 +71,15 @@ fn lookup_hash<'a, F>(d: rbml::Doc<'a>, mut eq_fn: F, hash: u64) -> Option<rbml:
|
|||
{
|
||||
let index = reader::get_doc(d, tag_index);
|
||||
let table = reader::get_doc(index, tag_index_table);
|
||||
let hash_pos = table.start + (hash % 256 * 4) as uint;
|
||||
let pos = u32_from_be_bytes(&d.data[hash_pos..]) as uint;
|
||||
let hash_pos = table.start + (hash % 256 * 4) as usize;
|
||||
let pos = u32_from_be_bytes(&d.data[hash_pos..]) as usize;
|
||||
let tagged_doc = reader::doc_at(d.data, pos).unwrap();
|
||||
|
||||
let belt = tag_index_buckets_bucket_elt;
|
||||
|
||||
let mut ret = None;
|
||||
reader::tagged_docs(tagged_doc.doc, belt, |elt| {
|
||||
let pos = u32_from_be_bytes(&elt.data[elt.start..]) as uint;
|
||||
let pos = u32_from_be_bytes(&elt.data[elt.start..]) as usize;
|
||||
if eq_fn(&elt.data[elt.start + 4 .. elt.end]) {
|
||||
ret = Some(reader::doc_at(d.data, pos).unwrap().doc);
|
||||
false
|
||||
|
|
@ -274,7 +274,7 @@ fn item_path(item_doc: rbml::Doc) -> Vec<ast_map::PathElem> {
|
|||
let path_doc = reader::get_doc(item_doc, tag_path);
|
||||
|
||||
let len_doc = reader::get_doc(path_doc, tag_path_len);
|
||||
let len = reader::doc_as_u32(len_doc) as uint;
|
||||
let len = reader::doc_as_u32(len_doc) as usize;
|
||||
|
||||
let mut result = Vec::with_capacity(len);
|
||||
reader::docs(path_doc, |tag, elt_doc| {
|
||||
|
|
@ -513,13 +513,13 @@ pub enum DefLike {
|
|||
|
||||
/// Iterates over the language items in the given crate.
|
||||
pub fn each_lang_item<F>(cdata: Cmd, mut f: F) -> bool where
|
||||
F: FnMut(ast::NodeId, uint) -> bool,
|
||||
F: FnMut(ast::NodeId, usize) -> bool,
|
||||
{
|
||||
let root = rbml::Doc::new(cdata.data());
|
||||
let lang_items = reader::get_doc(root, tag_lang_items);
|
||||
reader::tagged_docs(lang_items, tag_lang_items_item, |item_doc| {
|
||||
let id_doc = reader::get_doc(item_doc, tag_lang_items_item_id);
|
||||
let id = reader::doc_as_u32(id_doc) as uint;
|
||||
let id = reader::doc_as_u32(id_doc) as usize;
|
||||
let node_id_doc = reader::get_doc(item_doc,
|
||||
tag_lang_items_item_node_id);
|
||||
let node_id = reader::doc_as_u32(node_id_doc) as ast::NodeId;
|
||||
|
|
@ -1194,7 +1194,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
|
|||
let cratedoc = rbml::Doc::new(data);
|
||||
let depsdoc = reader::get_doc(cratedoc, tag_crate_deps);
|
||||
let mut crate_num = 1;
|
||||
fn docstr(doc: rbml::Doc, tag_: uint) -> String {
|
||||
fn docstr(doc: rbml::Doc, tag_: usize) -> String {
|
||||
let d = reader::get_doc(doc, tag_);
|
||||
d.as_str_slice().to_string()
|
||||
}
|
||||
|
|
@ -1454,7 +1454,7 @@ pub fn is_typedef(cdata: Cmd, id: ast::NodeId) -> bool {
|
|||
fn doc_generics<'tcx>(base_doc: rbml::Doc,
|
||||
tcx: &ty::ctxt<'tcx>,
|
||||
cdata: Cmd,
|
||||
tag: uint)
|
||||
tag: usize)
|
||||
-> ty::Generics<'tcx>
|
||||
{
|
||||
let doc = reader::get_doc(base_doc, tag);
|
||||
|
|
@ -1479,7 +1479,7 @@ fn doc_generics<'tcx>(base_doc: rbml::Doc,
|
|||
let def_id = translate_def_id(cdata, def_id);
|
||||
|
||||
let doc = reader::get_doc(rp_doc, tag_region_param_def_space);
|
||||
let space = subst::ParamSpace::from_uint(reader::doc_as_u64(doc) as uint);
|
||||
let space = subst::ParamSpace::from_uint(reader::doc_as_u64(doc) as usize);
|
||||
|
||||
let doc = reader::get_doc(rp_doc, tag_region_param_def_index);
|
||||
let index = reader::doc_as_u64(doc) as u32;
|
||||
|
|
@ -1508,7 +1508,7 @@ fn doc_generics<'tcx>(base_doc: rbml::Doc,
|
|||
fn doc_predicates<'tcx>(base_doc: rbml::Doc,
|
||||
tcx: &ty::ctxt<'tcx>,
|
||||
cdata: Cmd,
|
||||
tag: uint)
|
||||
tag: usize)
|
||||
-> ty::GenericPredicates<'tcx>
|
||||
{
|
||||
let doc = reader::get_doc(base_doc, tag);
|
||||
|
|
@ -1516,7 +1516,7 @@ fn doc_predicates<'tcx>(base_doc: rbml::Doc,
|
|||
let mut predicates = subst::VecPerParamSpace::empty();
|
||||
reader::tagged_docs(doc, tag_predicate, |predicate_doc| {
|
||||
let space_doc = reader::get_doc(predicate_doc, tag_predicate_space);
|
||||
let space = subst::ParamSpace::from_uint(reader::doc_as_u8(space_doc) as uint);
|
||||
let space = subst::ParamSpace::from_uint(reader::doc_as_u8(space_doc) as usize);
|
||||
|
||||
let data_doc = reader::get_doc(predicate_doc, tag_predicate_data);
|
||||
let data = parse_predicate_data(data_doc.data, data_doc.start, cdata.cnum, tcx,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ struct entry<T> {
|
|||
fn encode_trait_ref<'a, 'tcx>(rbml_w: &mut Encoder,
|
||||
ecx: &EncodeContext<'a, 'tcx>,
|
||||
trait_ref: &ty::TraitRef<'tcx>,
|
||||
tag: uint) {
|
||||
tag: usize) {
|
||||
let ty_str_ctxt = &tyencode::ctxt {
|
||||
diag: ecx.diag,
|
||||
ds: def_to_string,
|
||||
|
|
@ -703,7 +703,7 @@ fn encode_generics<'a, 'tcx>(rbml_w: &mut Encoder,
|
|||
ecx: &EncodeContext<'a, 'tcx>,
|
||||
generics: &ty::Generics<'tcx>,
|
||||
predicates: &ty::GenericPredicates<'tcx>,
|
||||
tag: uint)
|
||||
tag: usize)
|
||||
{
|
||||
rbml_w.start_tag(tag);
|
||||
|
||||
|
|
@ -777,7 +777,7 @@ fn encode_predicates_in_current_doc<'a,'tcx>(rbml_w: &mut Encoder,
|
|||
fn encode_predicates<'a,'tcx>(rbml_w: &mut Encoder,
|
||||
ecx: &EncodeContext<'a,'tcx>,
|
||||
predicates: &ty::GenericPredicates<'tcx>,
|
||||
tag: uint)
|
||||
tag: usize)
|
||||
{
|
||||
rbml_w.start_tag(tag);
|
||||
encode_predicates_in_current_doc(rbml_w, ecx, predicates);
|
||||
|
|
@ -1538,7 +1538,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
|
|||
for elt in index {
|
||||
let mut s = SipHasher::new();
|
||||
elt.val.hash(&mut s);
|
||||
let h = s.finish() as uint;
|
||||
let h = s.finish() as usize;
|
||||
(&mut buckets[h % 256]).push(elt);
|
||||
}
|
||||
|
||||
|
|
@ -1944,7 +1944,7 @@ pub fn encode_metadata(parms: EncodeParams, krate: &ast::Crate) -> Vec<u8> {
|
|||
|
||||
// RBML compacts the encoded bytes whenever appropriate,
|
||||
// so there are some garbages left after the end of the data.
|
||||
let metalen = wr.seek(SeekFrom::Current(0)).unwrap() as uint;
|
||||
let metalen = wr.seek(SeekFrom::Current(0)).unwrap() as usize;
|
||||
let mut v = wr.into_inner();
|
||||
v.truncate(metalen);
|
||||
assert_eq!(v.len(), metalen);
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
|
|||
unsafe {
|
||||
let buf = common::path2cstr(filename);
|
||||
let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr());
|
||||
if mb as int == 0 {
|
||||
if mb as isize == 0 {
|
||||
return Err(format!("error reading library: '{}'",
|
||||
filename.display()))
|
||||
}
|
||||
|
|
@ -761,12 +761,12 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
|
|||
let mut name_buf = ptr::null();
|
||||
let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
|
||||
let name = slice::from_raw_parts(name_buf as *const u8,
|
||||
name_len as uint).to_vec();
|
||||
name_len as usize).to_vec();
|
||||
let name = String::from_utf8(name).unwrap();
|
||||
debug!("get_metadata_section: name {}", name);
|
||||
if read_meta_section_name(is_osx) == name {
|
||||
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
|
||||
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
|
||||
let csz = llvm::LLVMGetSectionSize(si.llsi) as usize;
|
||||
let cvbuf: *const u8 = cbuf as *const u8;
|
||||
let vlen = encoder::metadata_encoding_version.len();
|
||||
debug!("checking {} bytes of metadata-version stamp",
|
||||
|
|
@ -779,7 +779,7 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
|
|||
filename.display())));
|
||||
}
|
||||
|
||||
let cvbuf1 = cvbuf.offset(vlen as int);
|
||||
let cvbuf1 = cvbuf.offset(vlen as isize);
|
||||
debug!("inflating {} bytes of compressed metadata",
|
||||
csz - vlen);
|
||||
let bytes = slice::from_raw_parts(cvbuf1, csz - vlen);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ pub enum DefIdSource {
|
|||
pub struct PState<'a, 'tcx: 'a> {
|
||||
data: &'a [u8],
|
||||
krate: ast::CrateNum,
|
||||
pos: uint,
|
||||
pos: usize,
|
||||
tcx: &'a ty::ctxt<'tcx>
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ fn parse_name_<F>(st: &mut PState, is_last: F) -> ast::Name where
|
|||
}
|
||||
|
||||
pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum,
|
||||
pos: uint, tcx: &'a ty::ctxt<'tcx>)
|
||||
pos: usize, tcx: &'a ty::ctxt<'tcx>)
|
||||
-> PState<'a, 'tcx> {
|
||||
PState {
|
||||
data: data,
|
||||
|
|
@ -129,7 +129,7 @@ pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum,
|
|||
}
|
||||
}
|
||||
|
||||
fn data_log_string(data: &[u8], pos: uint) -> String {
|
||||
fn data_log_string(data: &[u8], pos: usize) -> String {
|
||||
let mut buf = String::new();
|
||||
buf.push_str("<<");
|
||||
for i in pos..data.len() {
|
||||
|
|
@ -146,7 +146,7 @@ fn data_log_string(data: &[u8], pos: uint) -> String {
|
|||
|
||||
pub fn parse_ty_closure_data<'tcx, F>(data: &[u8],
|
||||
crate_num: ast::CrateNum,
|
||||
pos: uint,
|
||||
pos: usize,
|
||||
tcx: &ty::ctxt<'tcx>,
|
||||
conv: F)
|
||||
-> ty::ClosureTy<'tcx> where
|
||||
|
|
@ -156,7 +156,7 @@ pub fn parse_ty_closure_data<'tcx, F>(data: &[u8],
|
|||
parse_closure_ty(&mut st, conv)
|
||||
}
|
||||
|
||||
pub fn parse_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
|
||||
pub fn parse_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
|
||||
tcx: &ty::ctxt<'tcx>, conv: F) -> Ty<'tcx> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
{
|
||||
|
|
@ -165,7 +165,7 @@ pub fn parse_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
|
|||
parse_ty(&mut st, conv)
|
||||
}
|
||||
|
||||
pub fn parse_region_data<F>(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx: &ty::ctxt,
|
||||
pub fn parse_region_data<F>(data: &[u8], crate_num: ast::CrateNum, pos: usize, tcx: &ty::ctxt,
|
||||
conv: F) -> ty::Region where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
{
|
||||
|
|
@ -174,7 +174,7 @@ pub fn parse_region_data<F>(data: &[u8], crate_num: ast::CrateNum, pos: uint, tc
|
|||
parse_region(&mut st, conv)
|
||||
}
|
||||
|
||||
pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
|
||||
pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
|
||||
tcx: &ty::ctxt<'tcx>, conv: F)
|
||||
-> ty::BareFnTy<'tcx> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
|
|
@ -184,7 +184,7 @@ pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos
|
|||
parse_bare_fn_ty(&mut st, conv)
|
||||
}
|
||||
|
||||
pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
|
||||
pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
|
||||
tcx: &ty::ctxt<'tcx>, conv: F)
|
||||
-> Rc<ty::TraitRef<'tcx>> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
|
|
@ -194,7 +194,7 @@ pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos:
|
|||
parse_trait_ref(&mut st, conv)
|
||||
}
|
||||
|
||||
pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
|
||||
pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
|
||||
tcx: &ty::ctxt<'tcx>, conv: F) -> subst::Substs<'tcx> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
{
|
||||
|
|
@ -204,7 +204,7 @@ pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: ui
|
|||
}
|
||||
|
||||
pub fn parse_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
|
||||
pos: uint, tcx: &ty::ctxt<'tcx>, conv: F)
|
||||
pos: usize, tcx: &ty::ctxt<'tcx>, conv: F)
|
||||
-> ty::ParamBounds<'tcx> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
{
|
||||
|
|
@ -213,7 +213,7 @@ pub fn parse_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
|
|||
}
|
||||
|
||||
pub fn parse_existential_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
|
||||
pos: uint, tcx: &ty::ctxt<'tcx>, conv: F)
|
||||
pos: usize, tcx: &ty::ctxt<'tcx>, conv: F)
|
||||
-> ty::ExistentialBounds<'tcx> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
{
|
||||
|
|
@ -222,7 +222,7 @@ pub fn parse_existential_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::Crate
|
|||
}
|
||||
|
||||
pub fn parse_builtin_bounds_data<F>(data: &[u8], crate_num: ast::CrateNum,
|
||||
pos: uint, tcx: &ty::ctxt, conv: F)
|
||||
pos: usize, tcx: &ty::ctxt, conv: F)
|
||||
-> ty::BuiltinBounds where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
{
|
||||
|
|
@ -230,7 +230,7 @@ pub fn parse_builtin_bounds_data<F>(data: &[u8], crate_num: ast::CrateNum,
|
|||
parse_builtin_bounds(&mut st, conv)
|
||||
}
|
||||
|
||||
fn parse_size(st: &mut PState) -> Option<uint> {
|
||||
fn parse_size(st: &mut PState) -> Option<usize> {
|
||||
assert_eq!(next(st), '/');
|
||||
|
||||
if peek(st) == '|' {
|
||||
|
|
@ -447,8 +447,8 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w
|
|||
let tcx = st.tcx;
|
||||
match next(st) {
|
||||
'b' => return tcx.types.bool,
|
||||
'i' => { /* eat the s of is */ next(st); return tcx.types.int },
|
||||
'u' => { /* eat the s of us */ next(st); return tcx.types.uint },
|
||||
'i' => { /* eat the s of is */ next(st); return tcx.types.isize },
|
||||
'u' => { /* eat the s of us */ next(st); return tcx.types.usize },
|
||||
'M' => {
|
||||
match next(st) {
|
||||
'b' => return tcx.types.u8,
|
||||
|
|
@ -592,21 +592,21 @@ fn parse_def_<F>(st: &mut PState, source: DefIdSource, conv: &mut F) -> ast::Def
|
|||
return (*conv)(source, scan(st, |c| { c == '|' }, parse_def_id));
|
||||
}
|
||||
|
||||
fn parse_uint(st: &mut PState) -> uint {
|
||||
fn parse_uint(st: &mut PState) -> usize {
|
||||
let mut n = 0;
|
||||
loop {
|
||||
let cur = peek(st);
|
||||
if cur < '0' || cur > '9' { return n; }
|
||||
st.pos = st.pos + 1;
|
||||
n *= 10;
|
||||
n += (cur as uint) - ('0' as uint);
|
||||
n += (cur as usize) - ('0' as usize);
|
||||
};
|
||||
}
|
||||
|
||||
fn parse_u32(st: &mut PState) -> u32 {
|
||||
let n = parse_uint(st);
|
||||
let m = n as u32;
|
||||
assert_eq!(m as uint, n);
|
||||
assert_eq!(m as usize, n);
|
||||
m
|
||||
}
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ fn parse_param_space(st: &mut PState) -> subst::ParamSpace {
|
|||
subst::ParamSpace::from_uint(parse_uint(st))
|
||||
}
|
||||
|
||||
fn parse_hex(st: &mut PState) -> uint {
|
||||
fn parse_hex(st: &mut PState) -> usize {
|
||||
let mut n = 0;
|
||||
loop {
|
||||
let cur = peek(st);
|
||||
|
|
@ -622,8 +622,8 @@ fn parse_hex(st: &mut PState) -> uint {
|
|||
st.pos = st.pos + 1;
|
||||
n *= 16;
|
||||
if '0' <= cur && cur <= '9' {
|
||||
n += (cur as uint) - ('0' as uint);
|
||||
} else { n += 10 + (cur as uint) - ('a' as uint); }
|
||||
n += (cur as usize) - ('0' as usize);
|
||||
} else { n += 10 + (cur as usize) - ('a' as usize); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -725,14 +725,14 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
|
|||
let def_part = &buf[colon_idx + 1..len];
|
||||
|
||||
let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| {
|
||||
s.parse::<uint>().ok()
|
||||
s.parse::<usize>().ok()
|
||||
}) {
|
||||
Some(cn) => cn as ast::CrateNum,
|
||||
None => panic!("internal error: parse_def_id: crate number expected, found {:?}",
|
||||
crate_part)
|
||||
};
|
||||
let def_num = match str::from_utf8(def_part).ok().and_then(|s| {
|
||||
s.parse::<uint>().ok()
|
||||
s.parse::<usize>().ok()
|
||||
}) {
|
||||
Some(dn) => dn as ast::NodeId,
|
||||
None => panic!("internal error: parse_def_id: id expected, found {:?}",
|
||||
|
|
@ -742,7 +742,7 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
|
|||
}
|
||||
|
||||
pub fn parse_predicate_data<'tcx, F>(data: &[u8],
|
||||
start: uint,
|
||||
start: usize,
|
||||
crate_num: ast::CrateNum,
|
||||
tcx: &ty::ctxt<'tcx>,
|
||||
conv: F)
|
||||
|
|
@ -794,7 +794,7 @@ fn parse_projection_predicate_<'a,'tcx, F>(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_type_param_def_data<'tcx, F>(data: &[u8], start: uint,
|
||||
pub fn parse_type_param_def_data<'tcx, F>(data: &[u8], start: usize,
|
||||
crate_num: ast::CrateNum, tcx: &ty::ctxt<'tcx>,
|
||||
conv: F) -> ty::TypeParameterDef<'tcx> where
|
||||
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ use middle::ty::{self, Ty};
|
|||
use syntax::ast;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
pub const NO_REGIONS: uint = 1;
|
||||
pub const NO_TPS: uint = 2;
|
||||
pub const NO_REGIONS: usize = 1;
|
||||
pub const NO_TPS: usize = 2;
|
||||
|
||||
pub fn check_path_args(tcx: &ty::ctxt, segments: &[ast::PathSegment], flags: uint) {
|
||||
pub fn check_path_args(tcx: &ty::ctxt, segments: &[ast::PathSegment], flags: usize) {
|
||||
for segment in segments {
|
||||
if (flags & NO_TPS) != 0 {
|
||||
for typ in segment.parameters.types() {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
|
|||
let ii = simplify_ast(ii);
|
||||
let id_range = ast_util::compute_id_range_for_inlined_item(&ii);
|
||||
|
||||
rbml_w.start_tag(c::tag_ast as uint);
|
||||
rbml_w.start_tag(c::tag_ast as usize);
|
||||
id_range.encode(rbml_w);
|
||||
encode_ast(rbml_w, &ii);
|
||||
encode_side_tables_for_ii(ecx, rbml_w, &ii);
|
||||
|
|
@ -360,7 +360,7 @@ impl<D:serialize::Decoder> def_id_decoder_helpers for D
|
|||
// but eventually we should add entries to the local codemap as required.
|
||||
|
||||
fn encode_ast(rbml_w: &mut Encoder, item: &ast::InlinedItem) {
|
||||
rbml_w.start_tag(c::tag_tree as uint);
|
||||
rbml_w.start_tag(c::tag_tree as usize);
|
||||
item.encode(rbml_w);
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
|
@ -437,7 +437,7 @@ fn simplify_ast(ii: e::InlinedItemRef) -> ast::InlinedItem {
|
|||
}
|
||||
|
||||
fn decode_ast(par_doc: rbml::Doc) -> ast::InlinedItem {
|
||||
let chi_doc = par_doc.get(c::tag_tree as uint);
|
||||
let chi_doc = par_doc.get(c::tag_tree as usize);
|
||||
let mut d = reader::Decoder::new(chi_doc);
|
||||
Decodable::decode(&mut d).unwrap()
|
||||
}
|
||||
|
|
@ -1150,7 +1150,7 @@ impl<'a> write_tag_and_id for Encoder<'a> {
|
|||
f: F) where
|
||||
F: FnOnce(&mut Encoder<'a>),
|
||||
{
|
||||
self.start_tag(tag_id as uint);
|
||||
self.start_tag(tag_id as usize);
|
||||
f(self);
|
||||
self.end_tag();
|
||||
}
|
||||
|
|
@ -1175,7 +1175,7 @@ impl<'a, 'b, 'c, 'tcx> ast_util::IdVisitingOperation for
|
|||
fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
|
||||
rbml_w: &mut Encoder,
|
||||
ii: &ast::InlinedItem) {
|
||||
rbml_w.start_tag(c::tag_table as uint);
|
||||
rbml_w.start_tag(c::tag_table as usize);
|
||||
ast_util::visit_ids_for_inlined_item(ii, &mut SideTableEncodingIdVisitor {
|
||||
ecx: ecx,
|
||||
rbml_w: rbml_w
|
||||
|
|
@ -1323,14 +1323,14 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
|
|||
}
|
||||
|
||||
trait doc_decoder_helpers {
|
||||
fn as_int(&self) -> int;
|
||||
fn as_int(&self) -> isize;
|
||||
fn opt_child(&self, tag: c::astencode_tag) -> Option<Self>;
|
||||
}
|
||||
|
||||
impl<'a> doc_decoder_helpers for rbml::Doc<'a> {
|
||||
fn as_int(&self) -> int { reader::doc_as_u64(*self) as int }
|
||||
fn as_int(&self) -> isize { reader::doc_as_u64(*self) as isize }
|
||||
fn opt_child(&self, tag: c::astencode_tag) -> Option<rbml::Doc<'a>> {
|
||||
reader::maybe_get_doc(*self, tag as uint)
|
||||
reader::maybe_get_doc(*self, tag as usize)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1746,7 +1746,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
|
|||
this.read_enum_variant(variants, |this, i| {
|
||||
Ok(match i {
|
||||
0 => {
|
||||
let len: uint =
|
||||
let len: usize =
|
||||
this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
|
||||
|
||||
ty::UnsizeLength(len)
|
||||
|
|
@ -1755,7 +1755,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
|
|||
let uk: ty::UnsizeKind =
|
||||
this.read_enum_variant_arg(0,
|
||||
|this| Ok(this.read_unsize_kind(dcx))).unwrap();
|
||||
let idx: uint =
|
||||
let idx: usize =
|
||||
this.read_enum_variant_arg(1, |this| Decodable::decode(this)).unwrap();
|
||||
|
||||
ty::UnsizeStruct(box uk, idx)
|
||||
|
|
@ -1851,7 +1851,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
|
|||
|
||||
fn decode_side_tables(dcx: &DecodeContext,
|
||||
ast_doc: rbml::Doc) {
|
||||
let tbl_doc = ast_doc.get(c::tag_table as uint);
|
||||
let tbl_doc = ast_doc.get(c::tag_table as usize);
|
||||
reader::docs(tbl_doc, |tag, entry_doc| {
|
||||
let mut entry_dsr = reader::Decoder::new(entry_doc);
|
||||
let id0: ast::NodeId = Decodable::decode(&mut entry_dsr).unwrap();
|
||||
|
|
@ -1969,14 +1969,14 @@ fn decode_side_tables(dcx: &DecodeContext,
|
|||
|
||||
#[cfg(test)]
|
||||
fn encode_item_ast(rbml_w: &mut Encoder, item: &ast::Item) {
|
||||
rbml_w.start_tag(c::tag_tree as uint);
|
||||
rbml_w.start_tag(c::tag_tree as usize);
|
||||
(*item).encode(rbml_w);
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn decode_item_ast(par_doc: rbml::Doc) -> ast::Item {
|
||||
let chi_doc = par_doc.get(c::tag_tree as uint);
|
||||
let chi_doc = par_doc.get(c::tag_tree as usize);
|
||||
let mut d = reader::Decoder::new(chi_doc);
|
||||
Decodable::decode(&mut d).unwrap()
|
||||
}
|
||||
|
|
@ -2035,7 +2035,7 @@ fn test_basic() {
|
|||
fn test_smalltalk() {
|
||||
let cx = mk_ctxt();
|
||||
roundtrip(quote_item!(&cx,
|
||||
fn foo() -> int { 3 + 4 } // first smalltalk program ever executed.
|
||||
fn foo() -> isize { 3 + 4 } // first smalltalk program ever executed.
|
||||
));
|
||||
}
|
||||
*/
|
||||
|
|
@ -2044,7 +2044,7 @@ fn test_smalltalk() {
|
|||
fn test_more() {
|
||||
let cx = mk_ctxt();
|
||||
roundtrip(quote_item!(&cx,
|
||||
fn foo(x: uint, y: uint) -> uint {
|
||||
fn foo(x: usize, y: usize) -> usize {
|
||||
let z = x + y;
|
||||
return z;
|
||||
}
|
||||
|
|
@ -2055,15 +2055,15 @@ fn test_more() {
|
|||
fn test_simplification() {
|
||||
let cx = mk_ctxt();
|
||||
let item = quote_item!(&cx,
|
||||
fn new_int_alist<B>() -> alist<int, B> {
|
||||
fn eq_int(a: int, b: int) -> bool { a == b }
|
||||
fn new_int_alist<B>() -> alist<isize, B> {
|
||||
fn eq_int(a: isize, b: isize) -> bool { a == b }
|
||||
return alist {eq_fn: eq_int, data: Vec::new()};
|
||||
}
|
||||
).unwrap();
|
||||
let item_in = e::IIItemRef(&*item);
|
||||
let item_out = simplify_ast(item_in);
|
||||
let item_exp = ast::IIItem(quote_item!(&cx,
|
||||
fn new_int_alist<B>() -> alist<int, B> {
|
||||
fn new_int_alist<B>() -> alist<isize, B> {
|
||||
return alist {eq_fn: eq_int, data: Vec::new()};
|
||||
}
|
||||
).unwrap());
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ impl<'a> fmt::Debug for Matrix<'a> {
|
|||
|
||||
let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0);
|
||||
assert!(m.iter().all(|row| row.len() == column_count));
|
||||
let column_widths: Vec<uint> = (0..column_count).map(|col| {
|
||||
let column_widths: Vec<usize> = (0..column_count).map(|col| {
|
||||
pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0)
|
||||
}).collect();
|
||||
|
||||
|
|
@ -116,9 +116,9 @@ pub enum Constructor {
|
|||
/// Ranges of literal values (2..5).
|
||||
ConstantRange(const_val, const_val),
|
||||
/// Array patterns of length n.
|
||||
Slice(uint),
|
||||
Slice(usize),
|
||||
/// Array patterns with a subslice.
|
||||
SliceWithSubslice(uint, uint)
|
||||
SliceWithSubslice(usize, usize)
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
|
|
@ -498,7 +498,7 @@ impl<'a, 'tcx> Folder for StaticInliner<'a, 'tcx> {
|
|||
/// left_ty: tuple of 3 elements
|
||||
/// pats: [10, 20, _] => (10, 20, _)
|
||||
///
|
||||
/// left_ty: struct X { a: (bool, &'static str), b: uint}
|
||||
/// left_ty: struct X { a: (bool, &'static str), b: usize}
|
||||
/// pats: [(false, "foo"), 42] => X { a: (false, "foo"), b: 42 }
|
||||
fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
|
||||
pats: Vec<&Pat>, left_ty: Ty) -> P<Pat> {
|
||||
|
|
@ -580,7 +580,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
|
|||
}
|
||||
|
||||
fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
|
||||
left_ty: Ty, max_slice_length: uint) -> Option<Constructor> {
|
||||
left_ty: Ty, max_slice_length: usize) -> 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();
|
||||
|
|
@ -594,7 +594,7 @@ fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
|
|||
/// 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,
|
||||
max_slice_length: uint) -> Vec<Constructor> {
|
||||
max_slice_length: usize) -> Vec<Constructor> {
|
||||
match left_ty.sty {
|
||||
ty::ty_bool =>
|
||||
[true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
|
||||
|
|
@ -741,7 +741,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, max_slice_length: uint) -> Vec<Constructor> {
|
||||
left_ty: Ty, max_slice_length: usize) -> Vec<Constructor> {
|
||||
let pat = raw_pat(p);
|
||||
match pat.node {
|
||||
ast::PatIdent(..) =>
|
||||
|
|
@ -798,7 +798,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
|
|||
///
|
||||
/// For instance, a tuple pattern (_, 42, 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) -> uint {
|
||||
pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usize {
|
||||
match ty.sty {
|
||||
ty::ty_tup(ref fs) => fs.len(),
|
||||
ty::ty_uniq(_) => 1,
|
||||
|
|
@ -850,7 +850,7 @@ fn range_covered_by_constructor(ctor: &Constructor,
|
|||
/// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing
|
||||
/// fields filled with wild patterns.
|
||||
pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
|
||||
constructor: &Constructor, col: uint, arity: uint) -> Option<Vec<&'a Pat>> {
|
||||
constructor: &Constructor, col: usize, arity: usize) -> Option<Vec<&'a Pat>> {
|
||||
let &Pat {
|
||||
id: pat_id, ref node, span: pat_span
|
||||
} = raw_pat(r[col]);
|
||||
|
|
|
|||
|
|
@ -262,8 +262,8 @@ impl ConstEvalErr {
|
|||
CannotCastTo(s) => format!("can't cast this type to {}", s).into_cow(),
|
||||
InvalidOpForBools(_) => "can't do this op on bools".into_cow(),
|
||||
InvalidOpForFloats(_) => "can't do this op on floats".into_cow(),
|
||||
InvalidOpForIntUint(..) => "can't do this op on an int and uint".into_cow(),
|
||||
InvalidOpForUintInt(..) => "can't do this op on a uint and int".into_cow(),
|
||||
InvalidOpForIntUint(..) => "can't do this op on an isize and usize".into_cow(),
|
||||
InvalidOpForUintInt(..) => "can't do this op on a usize and isize".into_cow(),
|
||||
NegateOnString => "negate on string".into_cow(),
|
||||
NegateOnBoolean => "negate on boolean".into_cow(),
|
||||
NegateOnBinary => "negate on binary literal".into_cow(),
|
||||
|
|
@ -369,7 +369,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
}
|
||||
ast::ExprBinary(op, ref a, ref b) => {
|
||||
let b_ty = match op.node {
|
||||
ast::BiShl | ast::BiShr => Some(tcx.types.uint),
|
||||
ast::BiShl | ast::BiShr => Some(tcx.types.usize),
|
||||
_ => ety
|
||||
};
|
||||
match (try!(eval_const_expr_partial(tcx, &**a, ety)),
|
||||
|
|
@ -434,8 +434,8 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
ast::BiAnd | ast::BiBitAnd => const_int(a & b),
|
||||
ast::BiOr | ast::BiBitOr => const_int(a | b),
|
||||
ast::BiBitXor => const_int(a ^ b),
|
||||
ast::BiShl => const_int(a << b as uint),
|
||||
ast::BiShr => const_int(a >> b as uint),
|
||||
ast::BiShl => const_int(a << b as usize),
|
||||
ast::BiShr => const_int(a >> b as usize),
|
||||
ast::BiEq => fromb(a == b),
|
||||
ast::BiLt => fromb(a < b),
|
||||
ast::BiLe => fromb(a <= b),
|
||||
|
|
@ -456,8 +456,8 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
ast::BiAnd | ast::BiBitAnd => const_uint(a & b),
|
||||
ast::BiOr | ast::BiBitOr => const_uint(a | b),
|
||||
ast::BiBitXor => const_uint(a ^ b),
|
||||
ast::BiShl => const_uint(a << b as uint),
|
||||
ast::BiShr => const_uint(a >> b as uint),
|
||||
ast::BiShl => const_uint(a << b as usize),
|
||||
ast::BiShr => const_uint(a >> b as usize),
|
||||
ast::BiEq => fromb(a == b),
|
||||
ast::BiLt => fromb(a < b),
|
||||
ast::BiLe => fromb(a <= b),
|
||||
|
|
@ -469,15 +469,15 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
// shifts can have any integral type as their rhs
|
||||
(const_int(a), const_uint(b)) => {
|
||||
match op.node {
|
||||
ast::BiShl => const_int(a << b as uint),
|
||||
ast::BiShr => const_int(a >> b as uint),
|
||||
ast::BiShl => const_int(a << b as usize),
|
||||
ast::BiShr => const_int(a >> b as usize),
|
||||
_ => signal!(e, InvalidOpForIntUint(op.node)),
|
||||
}
|
||||
}
|
||||
(const_uint(a), const_int(b)) => {
|
||||
match op.node {
|
||||
ast::BiShl => const_uint(a << b as uint),
|
||||
ast::BiShr => const_uint(a >> b as uint),
|
||||
ast::BiShl => const_uint(a << b as usize),
|
||||
ast::BiShr => const_uint(a >> b as usize),
|
||||
_ => signal!(e, InvalidOpForUintInt(op.node)),
|
||||
}
|
||||
}
|
||||
|
|
@ -628,12 +628,12 @@ fn cast_const(val: const_val, ty: Ty) -> Result<const_val, ErrKind> {
|
|||
}
|
||||
|
||||
define_casts!{
|
||||
ty::ty_int(ast::TyIs) => (int, const_int, i64),
|
||||
ty::ty_int(ast::TyIs) => (isize, const_int, i64),
|
||||
ty::ty_int(ast::TyI8) => (i8, const_int, i64),
|
||||
ty::ty_int(ast::TyI16) => (i16, const_int, i64),
|
||||
ty::ty_int(ast::TyI32) => (i32, const_int, i64),
|
||||
ty::ty_int(ast::TyI64) => (i64, const_int, i64),
|
||||
ty::ty_uint(ast::TyUs) => (uint, const_uint, u64),
|
||||
ty::ty_uint(ast::TyUs) => (usize, const_uint, u64),
|
||||
ty::ty_uint(ast::TyU8) => (u8, const_uint, u64),
|
||||
ty::ty_uint(ast::TyU16) => (u16, const_uint, u64),
|
||||
ty::ty_uint(ast::TyU32) => (u32, const_uint, u64),
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> {
|
|||
oper: O,
|
||||
|
||||
/// number of bits to propagate per id
|
||||
bits_per_id: uint,
|
||||
bits_per_id: usize,
|
||||
|
||||
/// number of words we will use to store bits_per_id.
|
||||
/// equal to bits_per_id/usize::BITS rounded up.
|
||||
words_per_id: uint,
|
||||
words_per_id: usize,
|
||||
|
||||
// mapping from node to cfg node index
|
||||
// FIXME (#6298): Shouldn't this go with CFG?
|
||||
|
|
@ -62,19 +62,19 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> {
|
|||
// the full vector (see the method `compute_id_range()`).
|
||||
|
||||
/// bits generated as we exit the cfg node. Updated by `add_gen()`.
|
||||
gens: Vec<uint>,
|
||||
gens: Vec<usize>,
|
||||
|
||||
/// bits killed as we exit the cfg node. Updated by `add_kill()`.
|
||||
kills: Vec<uint>,
|
||||
kills: Vec<usize>,
|
||||
|
||||
/// bits that are valid on entry to the cfg node. Updated by
|
||||
/// `propagate()`.
|
||||
on_entry: Vec<uint>,
|
||||
on_entry: Vec<usize>,
|
||||
}
|
||||
|
||||
pub trait BitwiseOperator {
|
||||
/// Joins two predecessor bits together, typically either `|` or `&`
|
||||
fn join(&self, succ: uint, pred: uint) -> uint;
|
||||
fn join(&self, succ: usize, pred: usize) -> usize;
|
||||
}
|
||||
|
||||
/// Parameterization for the precise form of data flow that is used.
|
||||
|
|
@ -204,7 +204,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
cfg: &cfg::CFG,
|
||||
oper: O,
|
||||
id_range: IdRange,
|
||||
bits_per_id: uint) -> DataFlowContext<'a, 'tcx, O> {
|
||||
bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> {
|
||||
let words_per_id = (bits_per_id + usize::BITS as usize - 1) / usize::BITS as usize;
|
||||
let num_nodes = cfg.graph.all_nodes().len();
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) {
|
||||
pub fn add_gen(&mut self, id: ast::NodeId, bit: usize) {
|
||||
//! Indicates that `id` generates `bit`
|
||||
debug!("{} add_gen(id={}, bit={})",
|
||||
self.analysis_name, id, bit);
|
||||
|
|
@ -250,7 +250,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
|
||||
pub fn add_kill(&mut self, id: ast::NodeId, bit: usize) {
|
||||
//! Indicates that `id` kills `bit`
|
||||
debug!("{} add_kill(id={}, bit={})",
|
||||
self.analysis_name, id, bit);
|
||||
|
|
@ -265,7 +265,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
}
|
||||
}
|
||||
|
||||
fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [uint]) {
|
||||
fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [usize]) {
|
||||
//! Applies the gen and kill sets for `cfgidx` to `bits`
|
||||
debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [before]",
|
||||
self.analysis_name, cfgidx, mut_bits_to_string(bits));
|
||||
|
|
@ -281,7 +281,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
self.analysis_name, cfgidx, mut_bits_to_string(bits));
|
||||
}
|
||||
|
||||
fn compute_id_range(&self, cfgidx: CFGIndex) -> (uint, uint) {
|
||||
fn compute_id_range(&self, cfgidx: CFGIndex) -> (usize, usize) {
|
||||
let n = cfgidx.node_id();
|
||||
let start = n * self.words_per_id;
|
||||
let end = start + self.words_per_id;
|
||||
|
|
@ -296,7 +296,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
|
||||
|
||||
pub fn each_bit_on_entry<F>(&self, id: ast::NodeId, mut f: F) -> bool where
|
||||
F: FnMut(uint) -> bool,
|
||||
F: FnMut(usize) -> bool,
|
||||
{
|
||||
//! Iterates through each bit that is set on entry to `id`.
|
||||
//! Only useful after `propagate()` has been called.
|
||||
|
|
@ -313,7 +313,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
}
|
||||
|
||||
pub fn each_bit_for_node<F>(&self, e: EntryOrExit, cfgidx: CFGIndex, f: F) -> bool where
|
||||
F: FnMut(uint) -> bool,
|
||||
F: FnMut(usize) -> bool,
|
||||
{
|
||||
//! Iterates through each bit that is set on entry/exit to `cfgidx`.
|
||||
//! Only useful after `propagate()` has been called.
|
||||
|
|
@ -342,7 +342,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
}
|
||||
|
||||
pub fn each_gen_bit<F>(&self, id: ast::NodeId, mut f: F) -> bool where
|
||||
F: FnMut(uint) -> bool,
|
||||
F: FnMut(usize) -> bool,
|
||||
{
|
||||
//! Iterates through each bit in the gen set for `id`.
|
||||
if !self.has_bitset_for_nodeid(id) {
|
||||
|
|
@ -368,8 +368,8 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
return true;
|
||||
}
|
||||
|
||||
fn each_bit<F>(&self, words: &[uint], mut f: F) -> bool where
|
||||
F: FnMut(uint) -> bool,
|
||||
fn each_bit<F>(&self, words: &[usize], mut f: F) -> bool where
|
||||
F: FnMut(usize) -> bool,
|
||||
{
|
||||
//! Helper for iterating over the bits in a bit set.
|
||||
//! Returns false on the first call to `f` that returns false;
|
||||
|
|
@ -505,7 +505,7 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
|
|||
impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
||||
fn walk_cfg(&mut self,
|
||||
cfg: &cfg::CFG,
|
||||
in_out: &mut [uint]) {
|
||||
in_out: &mut [usize]) {
|
||||
debug!("DataFlowContext::walk_cfg(in_out={}) {}",
|
||||
bits_to_string(in_out), self.dfcx.analysis_name);
|
||||
assert!(self.dfcx.bits_per_id > 0);
|
||||
|
|
@ -529,7 +529,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
|||
});
|
||||
}
|
||||
|
||||
fn reset(&mut self, bits: &mut [uint]) {
|
||||
fn reset(&mut self, bits: &mut [usize]) {
|
||||
let e = if self.dfcx.oper.initial_value() {usize::MAX} else {0};
|
||||
for b in bits {
|
||||
*b = e;
|
||||
|
|
@ -537,7 +537,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
|||
}
|
||||
|
||||
fn propagate_bits_into_graph_successors_of(&mut self,
|
||||
pred_bits: &[uint],
|
||||
pred_bits: &[usize],
|
||||
cfg: &cfg::CFG,
|
||||
cfgidx: CFGIndex) {
|
||||
cfg.graph.each_outgoing_edge(cfgidx, |_e_idx, edge| {
|
||||
|
|
@ -547,7 +547,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
|||
}
|
||||
|
||||
fn propagate_bits_into_entry_set_for(&mut self,
|
||||
pred_bits: &[uint],
|
||||
pred_bits: &[usize],
|
||||
edge: &cfg::CFGEdge) {
|
||||
let source = edge.source();
|
||||
let cfgidx = edge.target();
|
||||
|
|
@ -570,11 +570,11 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
|||
}
|
||||
}
|
||||
|
||||
fn mut_bits_to_string(words: &mut [uint]) -> String {
|
||||
fn mut_bits_to_string(words: &mut [usize]) -> String {
|
||||
bits_to_string(words)
|
||||
}
|
||||
|
||||
fn bits_to_string(words: &[uint]) -> String {
|
||||
fn bits_to_string(words: &[usize]) -> String {
|
||||
let mut result = String::new();
|
||||
let mut sep = '[';
|
||||
|
||||
|
|
@ -594,8 +594,8 @@ fn bits_to_string(words: &[uint]) -> String {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
|
||||
in_vec: &[uint],
|
||||
fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
|
||||
in_vec: &[usize],
|
||||
op: &Op) -> bool {
|
||||
assert_eq!(out_vec.len(), in_vec.len());
|
||||
let mut changed = false;
|
||||
|
|
@ -608,7 +608,7 @@ fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
|
|||
changed
|
||||
}
|
||||
|
||||
fn set_bit(words: &mut [uint], bit: uint) -> bool {
|
||||
fn set_bit(words: &mut [usize], bit: usize) -> bool {
|
||||
debug!("set_bit: words={} bit={}",
|
||||
mut_bits_to_string(words), bit_str(bit));
|
||||
let word = bit / usize::BITS as usize;
|
||||
|
|
@ -621,7 +621,7 @@ fn set_bit(words: &mut [uint], bit: uint) -> bool {
|
|||
oldv != newv
|
||||
}
|
||||
|
||||
fn bit_str(bit: uint) -> String {
|
||||
fn bit_str(bit: usize) -> String {
|
||||
let byte = bit >> 8;
|
||||
let lobits = 1 << (bit & 0xFF);
|
||||
format!("[{}:{}-{:02x}]", bit, byte, lobits)
|
||||
|
|
@ -629,9 +629,9 @@ fn bit_str(bit: uint) -> String {
|
|||
|
||||
struct Union;
|
||||
impl BitwiseOperator for Union {
|
||||
fn join(&self, a: uint, b: uint) -> uint { a | b }
|
||||
fn join(&self, a: usize, b: usize) -> usize { a | b }
|
||||
}
|
||||
struct Subtract;
|
||||
impl BitwiseOperator for Subtract {
|
||||
fn join(&self, a: uint, b: uint) -> uint { a & !b }
|
||||
fn join(&self, a: usize, b: usize) -> usize { a & !b }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: uint) {
|
||||
fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: usize) {
|
||||
match ty::expr_ty_adjusted(self.tcx, lhs).sty {
|
||||
ty::ty_struct(id, _) => {
|
||||
let fields = ty::lookup_struct_fields(self.tcx, id);
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ fn calculate_type(sess: &session::Session,
|
|||
assert!(src.rlib.is_some());
|
||||
debug!("adding staticlib: {}", data.name);
|
||||
add_library(sess, cnum, cstore::RequireStatic, &mut formats);
|
||||
ret[cnum as uint - 1] = Some(cstore::RequireStatic);
|
||||
ret[cnum as usize - 1] = Some(cstore::RequireStatic);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
|
|||
/// `deref()` is declared with `&self`, this is an autoref of `x`.
|
||||
fn walk_autoderefs(&mut self,
|
||||
expr: &ast::Expr,
|
||||
autoderefs: uint) {
|
||||
autoderefs: usize) {
|
||||
debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(self.tcx()), autoderefs);
|
||||
|
||||
for i in 0..autoderefs {
|
||||
|
|
@ -855,7 +855,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
|
|||
fn walk_autoref(&mut self,
|
||||
expr: &ast::Expr,
|
||||
autoref: &ty::AutoRef,
|
||||
n: uint) {
|
||||
n: usize) {
|
||||
debug!("walk_autoref expr={}", expr.repr(self.tcx()));
|
||||
|
||||
match *autoref {
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ pub enum SimplifiedType {
|
|||
StrSimplifiedType,
|
||||
VecSimplifiedType,
|
||||
PtrSimplifiedType,
|
||||
TupleSimplifiedType(uint),
|
||||
TupleSimplifiedType(usize),
|
||||
TraitSimplifiedType(ast::DefId),
|
||||
StructSimplifiedType(ast::DefId),
|
||||
ClosureSimplifiedType(ast::DefId),
|
||||
FunctionSimplifiedType(uint),
|
||||
FunctionSimplifiedType(usize),
|
||||
ParameterSimplifiedType,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,33 +62,33 @@ impl<E: Debug> Debug for Edge<E> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub struct NodeIndex(pub uint);
|
||||
pub struct NodeIndex(pub usize);
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const InvalidNodeIndex: NodeIndex = NodeIndex(usize::MAX);
|
||||
|
||||
#[derive(Copy, PartialEq, Debug)]
|
||||
pub struct EdgeIndex(pub uint);
|
||||
pub struct EdgeIndex(pub usize);
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(usize::MAX);
|
||||
|
||||
// Use a private field here to guarantee no more instances are created:
|
||||
#[derive(Copy, Debug)]
|
||||
pub struct Direction { repr: uint }
|
||||
pub struct Direction { repr: usize }
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const Outgoing: Direction = Direction { repr: 0 };
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const Incoming: Direction = Direction { repr: 1 };
|
||||
|
||||
impl NodeIndex {
|
||||
fn get(&self) -> uint { let NodeIndex(v) = *self; v }
|
||||
fn get(&self) -> usize { let NodeIndex(v) = *self; v }
|
||||
/// Returns unique id (unique with respect to the graph holding associated node).
|
||||
pub fn node_id(&self) -> uint { self.get() }
|
||||
pub fn node_id(&self) -> usize { self.get() }
|
||||
}
|
||||
|
||||
impl EdgeIndex {
|
||||
fn get(&self) -> uint { let EdgeIndex(v) = *self; v }
|
||||
fn get(&self) -> usize { let EdgeIndex(v) = *self; v }
|
||||
/// Returns unique id (unique with respect to the graph holding associated edge).
|
||||
pub fn edge_id(&self) -> uint { self.get() }
|
||||
pub fn edge_id(&self) -> usize { self.get() }
|
||||
}
|
||||
|
||||
impl<N,E> Graph<N,E> {
|
||||
|
|
@ -99,8 +99,8 @@ impl<N,E> Graph<N,E> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn with_capacity(num_nodes: uint,
|
||||
num_edges: uint) -> Graph<N,E> {
|
||||
pub fn with_capacity(num_nodes: usize,
|
||||
num_edges: usize) -> Graph<N,E> {
|
||||
Graph {
|
||||
nodes: Vec::with_capacity(num_nodes),
|
||||
edges: Vec::with_capacity(num_edges),
|
||||
|
|
@ -275,7 +275,7 @@ impl<N,E> Graph<N,E> {
|
|||
// computation.
|
||||
|
||||
pub fn iterate_until_fixed_point<'a, F>(&'a self, mut op: F) where
|
||||
F: FnMut(uint, EdgeIndex, &'a Edge<E>) -> bool,
|
||||
F: FnMut(usize, EdgeIndex, &'a Edge<E>) -> bool,
|
||||
{
|
||||
let mut iteration = 0;
|
||||
let mut changed = true;
|
||||
|
|
|
|||
|
|
@ -1766,7 +1766,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt,
|
|||
// LifeGiver is responsible for generating fresh lifetime names
|
||||
struct LifeGiver {
|
||||
taken: HashSet<String>,
|
||||
counter: Cell<uint>,
|
||||
counter: Cell<usize>,
|
||||
generated: RefCell<Vec<ast::Lifetime>>,
|
||||
}
|
||||
|
||||
|
|
@ -1806,7 +1806,7 @@ impl LifeGiver {
|
|||
return lifetime;
|
||||
|
||||
// 0 .. 25 generates a .. z, 26 .. 51 generates aa .. zz, and so on
|
||||
fn num_to_string(counter: uint) -> String {
|
||||
fn num_to_string(counter: usize) -> String {
|
||||
let mut s = String::new();
|
||||
let (n, r) = (counter/26 + 1, counter % 26);
|
||||
let letter: char = from_u32((r+97) as u32).unwrap();
|
||||
|
|
|
|||
|
|
@ -811,7 +811,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
ty::mk_var(self.tcx, self.next_ty_var_id(true))
|
||||
}
|
||||
|
||||
pub fn next_ty_vars(&self, n: uint) -> Vec<Ty<'tcx>> {
|
||||
pub fn next_ty_vars(&self, n: usize) -> Vec<Ty<'tcx>> {
|
||||
(0..n).map(|_i| self.next_ty_var()).collect()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ struct ConstraintGraph<'a, 'tcx: 'a> {
|
|||
tcx: &'a ty::ctxt<'tcx>,
|
||||
graph_name: String,
|
||||
map: &'a FnvHashMap<Constraint, SubregionOrigin<'tcx>>,
|
||||
node_ids: FnvHashMap<Node, uint>,
|
||||
node_ids: FnvHashMap<Node, usize>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Hash, PartialEq, Eq, Debug, Copy)]
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ pub enum UndoLogEntry {
|
|||
CommitedSnapshot,
|
||||
AddVar(RegionVid),
|
||||
AddConstraint(Constraint),
|
||||
AddVerify(uint),
|
||||
AddVerify(usize),
|
||||
AddGiven(ty::FreeRegion, ty::RegionVid),
|
||||
AddCombination(CombineMapType, TwoRegions)
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct RegionSnapshot {
|
||||
length: uint,
|
||||
length: usize,
|
||||
skolemization_count: u32,
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
AddVar(vid) => {
|
||||
let mut var_origins = self.var_origins.borrow_mut();
|
||||
var_origins.pop().unwrap();
|
||||
assert_eq!(var_origins.len(), vid.index as uint);
|
||||
assert_eq!(var_origins.len(), vid.index as usize);
|
||||
}
|
||||
AddConstraint(ref constraint) => {
|
||||
self.constraints.borrow_mut().remove(constraint);
|
||||
|
|
@ -312,7 +312,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
pub fn num_vars(&self) -> u32 {
|
||||
let len = self.var_origins.borrow().len();
|
||||
// enforce no overflow
|
||||
assert!(len as u32 as uint == len);
|
||||
assert!(len as u32 as usize == len);
|
||||
len as u32
|
||||
}
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
match *self.values.borrow() {
|
||||
None => {
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[rid.index as uint].span(),
|
||||
(*self.var_origins.borrow())[rid.index as usize].span(),
|
||||
"attempt to resolve region variable before values have \
|
||||
been computed!")
|
||||
}
|
||||
|
|
@ -629,7 +629,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
let mut result_set = vec!(r0);
|
||||
let mut result_index = 0;
|
||||
while result_index < result_set.len() {
|
||||
// nb: can't use uint::range() here because result_set grows
|
||||
// nb: can't use usize::range() here because result_set grows
|
||||
let r = result_set[result_index];
|
||||
debug!("result_index={}, r={:?}", result_index, r);
|
||||
|
||||
|
|
@ -746,7 +746,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
|
||||
(ReInfer(ReVar(v_id)), _) | (_, ReInfer(ReVar(v_id))) => {
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[v_id.index as uint].span(),
|
||||
(*self.var_origins.borrow())[v_id.index as usize].span(),
|
||||
&format!("lub_concrete_regions invoked with \
|
||||
non-concrete regions: {:?}, {:?}",
|
||||
a,
|
||||
|
|
@ -850,7 +850,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
(ReInfer(ReVar(v_id)), _) |
|
||||
(_, ReInfer(ReVar(v_id))) => {
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[v_id.index as uint].span(),
|
||||
(*self.var_origins.borrow())[v_id.index as usize].span(),
|
||||
&format!("glb_concrete_regions invoked with \
|
||||
non-concrete regions: {:?}, {:?}",
|
||||
a,
|
||||
|
|
@ -984,7 +984,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn construct_var_data(&self) -> Vec<VarData> {
|
||||
(0..self.num_vars() as uint).map(|_| {
|
||||
(0..self.num_vars() as usize).map(|_| {
|
||||
VarData {
|
||||
// All nodes are initially classified as contracting; during
|
||||
// the expansion phase, we will shift the classification for
|
||||
|
|
@ -1013,14 +1013,14 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
.repr(self.tcx));
|
||||
match *constraint {
|
||||
ConstrainRegSubVar(a_region, b_vid) => {
|
||||
let b_data = &mut var_data[b_vid.index as uint];
|
||||
let b_data = &mut var_data[b_vid.index as usize];
|
||||
self.expand_node(a_region, b_vid, b_data)
|
||||
}
|
||||
ConstrainVarSubVar(a_vid, b_vid) => {
|
||||
match var_data[a_vid.index as uint].value {
|
||||
match var_data[a_vid.index as usize].value {
|
||||
NoValue | ErrorValue => false,
|
||||
Value(a_region) => {
|
||||
let b_node = &mut var_data[b_vid.index as uint];
|
||||
let b_node = &mut var_data[b_vid.index as usize];
|
||||
self.expand_node(a_region, b_vid, b_node)
|
||||
}
|
||||
}
|
||||
|
|
@ -1101,16 +1101,16 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
false
|
||||
}
|
||||
ConstrainVarSubVar(a_vid, b_vid) => {
|
||||
match var_data[b_vid.index as uint].value {
|
||||
match var_data[b_vid.index as usize].value {
|
||||
NoValue | ErrorValue => false,
|
||||
Value(b_region) => {
|
||||
let a_data = &mut var_data[a_vid.index as uint];
|
||||
let a_data = &mut var_data[a_vid.index as usize];
|
||||
self.contract_node(a_vid, a_data, b_region)
|
||||
}
|
||||
}
|
||||
}
|
||||
ConstrainVarSubReg(a_vid, b_region) => {
|
||||
let a_data = &mut var_data[a_vid.index as uint];
|
||||
let a_data = &mut var_data[a_vid.index as usize];
|
||||
self.contract_node(a_vid, a_data, b_region)
|
||||
}
|
||||
}
|
||||
|
|
@ -1250,11 +1250,11 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
// idea is to report errors that derive from independent
|
||||
// regions of the graph, but not those that derive from
|
||||
// overlapping locations.
|
||||
let mut dup_vec: Vec<_> = repeat(u32::MAX).take(self.num_vars() as uint).collect();
|
||||
let mut dup_vec: Vec<_> = repeat(u32::MAX).take(self.num_vars() as usize).collect();
|
||||
|
||||
let mut opt_graph = None;
|
||||
|
||||
for idx in 0..self.num_vars() as uint {
|
||||
for idx in 0..self.num_vars() as usize {
|
||||
match var_data[idx].value {
|
||||
Value(_) => {
|
||||
/* Inference successful */
|
||||
|
|
@ -1311,7 +1311,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
(0..self.num_vars() as uint).map(|idx| var_data[idx].value).collect()
|
||||
(0..self.num_vars() as usize).map(|idx| var_data[idx].value).collect()
|
||||
}
|
||||
|
||||
fn construct_graph(&self) -> RegionGraph {
|
||||
|
|
@ -1320,7 +1320,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
let constraints = self.constraints.borrow();
|
||||
let num_edges = constraints.len();
|
||||
|
||||
let mut graph = graph::Graph::with_capacity(num_vars as uint + 1,
|
||||
let mut graph = graph::Graph::with_capacity(num_vars as usize + 1,
|
||||
num_edges);
|
||||
|
||||
for _ in 0..num_vars {
|
||||
|
|
@ -1331,17 +1331,17 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
for (constraint, _) in &*constraints {
|
||||
match *constraint {
|
||||
ConstrainVarSubVar(a_id, b_id) => {
|
||||
graph.add_edge(NodeIndex(a_id.index as uint),
|
||||
NodeIndex(b_id.index as uint),
|
||||
graph.add_edge(NodeIndex(a_id.index as usize),
|
||||
NodeIndex(b_id.index as usize),
|
||||
*constraint);
|
||||
}
|
||||
ConstrainRegSubVar(_, b_id) => {
|
||||
graph.add_edge(dummy_idx,
|
||||
NodeIndex(b_id.index as uint),
|
||||
NodeIndex(b_id.index as usize),
|
||||
*constraint);
|
||||
}
|
||||
ConstrainVarSubReg(a_id, _) => {
|
||||
graph.add_edge(NodeIndex(a_id.index as uint),
|
||||
graph.add_edge(NodeIndex(a_id.index as usize),
|
||||
dummy_idx,
|
||||
*constraint);
|
||||
}
|
||||
|
|
@ -1395,7 +1395,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
debug!("pushing SubSupConflict sub: {:?} sup: {:?}",
|
||||
lower_bound.region, upper_bound.region);
|
||||
errors.push(SubSupConflict(
|
||||
(*self.var_origins.borrow())[node_idx.index as uint].clone(),
|
||||
(*self.var_origins.borrow())[node_idx.index as usize].clone(),
|
||||
lower_bound.origin.clone(),
|
||||
lower_bound.region,
|
||||
upper_bound.origin.clone(),
|
||||
|
|
@ -1406,7 +1406,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
}
|
||||
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[node_idx.index as uint].span(),
|
||||
(*self.var_origins.borrow())[node_idx.index as usize].span(),
|
||||
&format!("collect_error_for_expanding_node() could not find error \
|
||||
for var {:?}, lower_bounds={}, upper_bounds={}",
|
||||
node_idx,
|
||||
|
|
@ -1439,7 +1439,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
Ok(_) => {}
|
||||
Err(_) => {
|
||||
errors.push(SupSupConflict(
|
||||
(*self.var_origins.borrow())[node_idx.index as uint].clone(),
|
||||
(*self.var_origins.borrow())[node_idx.index as usize].clone(),
|
||||
upper_bound_1.origin.clone(),
|
||||
upper_bound_1.region,
|
||||
upper_bound_2.origin.clone(),
|
||||
|
|
@ -1451,7 +1451,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
}
|
||||
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[node_idx.index as uint].span(),
|
||||
(*self.var_origins.borrow())[node_idx.index as usize].span(),
|
||||
&format!("collect_error_for_contracting_node() could not find error \
|
||||
for var {:?}, upper_bounds={}",
|
||||
node_idx,
|
||||
|
|
@ -1485,12 +1485,12 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
|
||||
while !state.stack.is_empty() {
|
||||
let node_idx = state.stack.pop().unwrap();
|
||||
let classification = var_data[node_idx.index as uint].classification;
|
||||
let classification = var_data[node_idx.index as usize].classification;
|
||||
|
||||
// check whether we've visited this node on some previous walk
|
||||
if dup_vec[node_idx.index as uint] == u32::MAX {
|
||||
dup_vec[node_idx.index as uint] = orig_node_idx.index;
|
||||
} else if dup_vec[node_idx.index as uint] != orig_node_idx.index {
|
||||
if dup_vec[node_idx.index as usize] == u32::MAX {
|
||||
dup_vec[node_idx.index as usize] = orig_node_idx.index;
|
||||
} else if dup_vec[node_idx.index as usize] != orig_node_idx.index {
|
||||
state.dup_found = true;
|
||||
}
|
||||
|
||||
|
|
@ -1518,7 +1518,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
dir: Direction) {
|
||||
debug!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir);
|
||||
|
||||
let source_node_index = NodeIndex(source_vid.index as uint);
|
||||
let source_node_index = NodeIndex(source_vid.index as usize);
|
||||
graph.each_adjacent_edge(source_node_index, dir, |_, edge| {
|
||||
match edge.data {
|
||||
ConstrainVarSubVar(from_vid, to_vid) => {
|
||||
|
|
@ -1603,7 +1603,7 @@ fn normalize(values: &Vec<VarValue>, r: ty::Region) -> ty::Region {
|
|||
}
|
||||
|
||||
fn lookup(values: &Vec<VarValue>, rid: ty::RegionVid) -> ty::Region {
|
||||
match values[rid.index as uint] {
|
||||
match values[rid.index as usize] {
|
||||
Value(r) => r,
|
||||
NoValue => ReEmpty, // No constraints, return ty::ReEmpty
|
||||
ErrorValue => ReStatic, // Previously reported error.
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
|||
}
|
||||
|
||||
fn relations<'a>(&'a mut self, a: ty::TyVid) -> &'a mut Vec<Relation> {
|
||||
relations(self.values.get_mut(a.index as uint))
|
||||
relations(self.values.get_mut(a.index as usize))
|
||||
}
|
||||
|
||||
pub fn var_diverges<'a>(&'a self, vid: ty::TyVid) -> bool {
|
||||
self.values.get(vid.index as uint).diverging
|
||||
self.values.get(vid.index as usize).diverging
|
||||
}
|
||||
|
||||
/// Records that `a <: b`, `a :> b`, or `a == b`, depending on `dir`.
|
||||
|
|
@ -97,7 +97,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
|||
stack: &mut Vec<(Ty<'tcx>, RelationDir, ty::TyVid)>)
|
||||
{
|
||||
let old_value = {
|
||||
let value_ptr = &mut self.values.get_mut(vid.index as uint).value;
|
||||
let value_ptr = &mut self.values.get_mut(vid.index as usize).value;
|
||||
mem::replace(value_ptr, Known(ty))
|
||||
};
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
|||
}
|
||||
|
||||
pub fn probe(&self, vid: ty::TyVid) -> Option<Ty<'tcx>> {
|
||||
match self.values.get(vid.index as uint).value {
|
||||
match self.values.get(vid.index as usize).value {
|
||||
Bounded(..) => None,
|
||||
Known(t) => Some(t)
|
||||
}
|
||||
|
|
@ -206,12 +206,12 @@ impl<'tcx> sv::SnapshotVecDelegate for Delegate<'tcx> {
|
|||
action: UndoEntry) {
|
||||
match action {
|
||||
SpecifyVar(vid, relations) => {
|
||||
values[vid.index as uint].value = Bounded(relations);
|
||||
values[vid.index as usize].value = Bounded(relations);
|
||||
}
|
||||
|
||||
Relate(a, b) => {
|
||||
relations(&mut (*values)[a.index as uint]).pop();
|
||||
relations(&mut (*values)[b.index as uint]).pop();
|
||||
relations(&mut (*values)[a.index as usize]).pop();
|
||||
relations(&mut (*values)[b.index as usize]).pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ use util::snapshot_vec as sv;
|
|||
pub trait UnifyKey : Clone + Debug + PartialEq {
|
||||
type Value : UnifyValue;
|
||||
|
||||
fn index(&self) -> uint;
|
||||
fn index(&self) -> usize;
|
||||
|
||||
fn from_index(u: uint) -> Self;
|
||||
fn from_index(u: usize) -> Self;
|
||||
|
||||
// Given an inference context, returns the unification table
|
||||
// appropriate to this key type.
|
||||
|
|
@ -67,7 +67,7 @@ pub trait UnifyValue : Clone + PartialEq + Debug {
|
|||
#[derive(PartialEq,Clone,Debug)]
|
||||
pub enum VarValue<K:UnifyKey> {
|
||||
Redirect(K),
|
||||
Root(K::Value, uint),
|
||||
Root(K::Value, usize),
|
||||
}
|
||||
|
||||
/// Table of unification keys and their values.
|
||||
|
|
@ -89,7 +89,7 @@ pub struct Snapshot<K:UnifyKey> {
|
|||
pub struct Node<K:UnifyKey> {
|
||||
pub key: K,
|
||||
pub value: K::Value,
|
||||
pub rank: uint,
|
||||
pub rank: usize,
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
|
|
@ -186,7 +186,7 @@ impl<K:UnifyKey> UnificationTable<K> {
|
|||
tcx: &ty::ctxt<'tcx>,
|
||||
node_a: &Node<K>,
|
||||
node_b: &Node<K>)
|
||||
-> (K, uint)
|
||||
-> (K, usize)
|
||||
{
|
||||
debug!("unify(node_a(id={:?}, rank={:?}), node_b(id={:?}, rank={:?}))",
|
||||
node_a.key,
|
||||
|
|
@ -358,9 +358,9 @@ impl<'a,'tcx,V,K> InferCtxtMethodsForSimplyUnifiableTypes<'tcx,K,V> for InferCtx
|
|||
impl UnifyKey for ty::IntVid {
|
||||
type Value = Option<IntVarValue>;
|
||||
|
||||
fn index(&self) -> uint { self.index as uint }
|
||||
fn index(&self) -> usize { self.index as usize }
|
||||
|
||||
fn from_index(i: uint) -> ty::IntVid { ty::IntVid { index: i as u32 } }
|
||||
fn from_index(i: usize) -> ty::IntVid { ty::IntVid { index: i as u32 } }
|
||||
|
||||
fn unification_table<'v>(infcx: &'v InferCtxt) -> &'v RefCell<UnificationTable<ty::IntVid>> {
|
||||
return &infcx.int_unification_table;
|
||||
|
|
@ -391,9 +391,9 @@ impl UnifyValue for Option<IntVarValue> { }
|
|||
impl UnifyKey for ty::FloatVid {
|
||||
type Value = Option<ast::FloatTy>;
|
||||
|
||||
fn index(&self) -> uint { self.index as uint }
|
||||
fn index(&self) -> usize { self.index as usize }
|
||||
|
||||
fn from_index(i: uint) -> ty::FloatVid { ty::FloatVid { index: i as u32 } }
|
||||
fn from_index(i: usize) -> ty::FloatVid { ty::FloatVid { index: i as u32 } }
|
||||
|
||||
fn unification_table<'v>(infcx: &'v InferCtxt) -> &'v RefCell<UnificationTable<ty::FloatVid>> {
|
||||
return &infcx.float_unification_table;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ pub fn check_crate(tcx: &ctxt) {
|
|||
let mut visitor = IntrinsicCheckingVisitor {
|
||||
tcx: tcx,
|
||||
param_envs: Vec::new(),
|
||||
dummy_sized_ty: tcx.types.int,
|
||||
dummy_unsized_ty: ty::mk_vec(tcx, tcx.types.int, None),
|
||||
dummy_sized_ty: tcx.types.isize,
|
||||
dummy_unsized_ty: ty::mk_vec(tcx, tcx.types.isize, None),
|
||||
};
|
||||
visit::walk_crate(&mut visitor, tcx.map.krate());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ impl LanguageItems {
|
|||
self.items.iter().enumerate()
|
||||
}
|
||||
|
||||
pub fn item_name(index: uint) -> &'static str {
|
||||
pub fn item_name(index: usize) -> &'static str {
|
||||
let item: Option<LangItem> = FromPrimitive::from_usize(index);
|
||||
match item {
|
||||
$( Some($variant) => $name, )*
|
||||
|
|
@ -79,11 +79,11 @@ impl LanguageItems {
|
|||
}
|
||||
|
||||
pub fn require(&self, it: LangItem) -> Result<ast::DefId, String> {
|
||||
match self.items[it as uint] {
|
||||
match self.items[it as usize] {
|
||||
Some(id) => Ok(id),
|
||||
None => {
|
||||
Err(format!("requires `{}` lang_item",
|
||||
LanguageItems::item_name(it as uint)))
|
||||
LanguageItems::item_name(it as usize)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ impl LanguageItems {
|
|||
$(
|
||||
#[allow(dead_code)]
|
||||
pub fn $method(&self) -> Option<ast::DefId> {
|
||||
self.items[$variant as uint]
|
||||
self.items[$variant as usize]
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ struct LanguageItemCollector<'a> {
|
|||
|
||||
session: &'a Session,
|
||||
|
||||
item_refs: FnvHashMap<&'static str, uint>,
|
||||
item_refs: FnvHashMap<&'static str, usize>,
|
||||
}
|
||||
|
||||
impl<'a, 'v> Visitor<'v> for LanguageItemCollector<'a> {
|
||||
|
|
@ -163,7 +163,7 @@ impl<'a> LanguageItemCollector<'a> {
|
|||
pub fn new(session: &'a Session) -> LanguageItemCollector<'a> {
|
||||
let mut item_refs = FnvHashMap();
|
||||
|
||||
$( item_refs.insert($name, $variant as uint); )*
|
||||
$( item_refs.insert($name, $variant as usize); )*
|
||||
|
||||
LanguageItemCollector {
|
||||
session: session,
|
||||
|
|
@ -172,7 +172,7 @@ impl<'a> LanguageItemCollector<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn collect_item(&mut self, item_index: uint,
|
||||
pub fn collect_item(&mut self, item_index: usize,
|
||||
item_def_id: ast::DefId, span: Span) {
|
||||
// Check for duplicates.
|
||||
match self.items.items[item_index] {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ pub enum categorization<'tcx> {
|
|||
cat_static_item,
|
||||
cat_upvar(Upvar), // upvar referenced by closure env
|
||||
cat_local(ast::NodeId), // local variable
|
||||
cat_deref(cmt<'tcx>, uint, PointerKind), // deref of a ptr
|
||||
cat_deref(cmt<'tcx>, usize, PointerKind), // deref of a ptr
|
||||
cat_interior(cmt<'tcx>, InteriorKind), // something interior: field, tuple, etc
|
||||
cat_downcast(cmt<'tcx>, ast::DefId), // selects a particular enum variant (*1)
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ pub enum InteriorKind {
|
|||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum FieldName {
|
||||
NamedField(ast::Name),
|
||||
PositionalField(uint)
|
||||
PositionalField(usize)
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
|
|
@ -462,7 +462,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
|
||||
pub fn cat_expr_autoderefd(&self,
|
||||
expr: &ast::Expr,
|
||||
autoderefs: uint)
|
||||
autoderefs: usize)
|
||||
-> McResult<cmt<'tcx>> {
|
||||
let mut cmt = try!(self.cat_expr_unadjusted(expr));
|
||||
debug!("cat_expr_autoderefd: autoderefs={}, cmt={}",
|
||||
|
|
@ -868,7 +868,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
pub fn cat_tup_field<N:ast_node>(&self,
|
||||
node: &N,
|
||||
base_cmt: cmt<'tcx>,
|
||||
f_idx: uint,
|
||||
f_idx: usize,
|
||||
f_ty: Ty<'tcx>)
|
||||
-> cmt<'tcx> {
|
||||
Rc::new(cmt_ {
|
||||
|
|
@ -884,7 +884,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
fn cat_deref<N:ast_node>(&self,
|
||||
node: &N,
|
||||
base_cmt: cmt<'tcx>,
|
||||
deref_cnt: uint,
|
||||
deref_cnt: usize,
|
||||
deref_context: DerefKindContext)
|
||||
-> McResult<cmt<'tcx>> {
|
||||
let adjustment = match self.typer.adjustments().borrow().get(&node.id()) {
|
||||
|
|
@ -928,7 +928,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
fn cat_deref_common<N:ast_node>(&self,
|
||||
node: &N,
|
||||
base_cmt: cmt<'tcx>,
|
||||
deref_cnt: uint,
|
||||
deref_cnt: usize,
|
||||
deref_ty: Ty<'tcx>,
|
||||
deref_context: DerefKindContext,
|
||||
implicit: bool)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ impl DestructionScopeData {
|
|||
RustcDecodable, Debug, Copy)]
|
||||
pub struct BlockRemainder {
|
||||
pub block: ast::NodeId,
|
||||
pub first_statement_index: uint,
|
||||
pub first_statement_index: usize,
|
||||
}
|
||||
|
||||
impl CodeExtent {
|
||||
|
|
@ -284,7 +284,7 @@ impl InnermostDeclaringBlock {
|
|||
struct DeclaringStatementContext {
|
||||
stmt_id: ast::NodeId,
|
||||
block_id: ast::NodeId,
|
||||
stmt_index: uint,
|
||||
stmt_index: usize,
|
||||
}
|
||||
|
||||
impl DeclaringStatementContext {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ impl<'tcx> Substs<'tcx> {
|
|||
}
|
||||
|
||||
pub fn type_for_def(&self, ty_param_def: &ty::TypeParameterDef) -> Ty<'tcx> {
|
||||
*self.types.get(ty_param_def.space, ty_param_def.index as uint)
|
||||
*self.types.get(ty_param_def.space, ty_param_def.index as usize)
|
||||
}
|
||||
|
||||
pub fn has_regions_escaping_depth(&self, depth: u32) -> bool {
|
||||
|
|
@ -193,7 +193,7 @@ impl ParamSpace {
|
|||
[TypeSpace, SelfSpace, FnSpace]
|
||||
}
|
||||
|
||||
pub fn to_uint(self) -> uint {
|
||||
pub fn to_uint(self) -> usize {
|
||||
match self {
|
||||
TypeSpace => 0,
|
||||
SelfSpace => 1,
|
||||
|
|
@ -201,7 +201,7 @@ impl ParamSpace {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_uint(u: uint) -> ParamSpace {
|
||||
pub fn from_uint(u: usize) -> ParamSpace {
|
||||
match u {
|
||||
0 => TypeSpace,
|
||||
1 => SelfSpace,
|
||||
|
|
@ -226,8 +226,8 @@ pub struct VecPerParamSpace<T> {
|
|||
// AF(self) = (self.content[..self.type_limit],
|
||||
// self.content[self.type_limit..self.self_limit],
|
||||
// self.content[self.self_limit..])
|
||||
type_limit: uint,
|
||||
self_limit: uint,
|
||||
type_limit: usize,
|
||||
self_limit: usize,
|
||||
content: Vec<T>,
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ impl<T: fmt::Debug> fmt::Debug for VecPerParamSpace<T> {
|
|||
}
|
||||
|
||||
impl<T> VecPerParamSpace<T> {
|
||||
fn limits(&self, space: ParamSpace) -> (uint, uint) {
|
||||
fn limits(&self, space: ParamSpace) -> (usize, usize) {
|
||||
match space {
|
||||
TypeSpace => (0, self.type_limit),
|
||||
SelfSpace => (self.type_limit, self.self_limit),
|
||||
|
|
@ -290,7 +290,7 @@ impl<T> VecPerParamSpace<T> {
|
|||
}
|
||||
}
|
||||
|
||||
fn new_internal(content: Vec<T>, type_limit: uint, self_limit: uint)
|
||||
fn new_internal(content: Vec<T>, type_limit: usize, self_limit: usize)
|
||||
-> VecPerParamSpace<T>
|
||||
{
|
||||
VecPerParamSpace {
|
||||
|
|
@ -343,7 +343,7 @@ impl<T> VecPerParamSpace<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn truncate(&mut self, space: ParamSpace, len: uint) {
|
||||
pub fn truncate(&mut self, space: ParamSpace, len: usize) {
|
||||
// FIXME (#15435): slow; O(n^2); could enhance vec to make it O(n).
|
||||
while self.len(space) > len {
|
||||
self.pop(space);
|
||||
|
|
@ -364,7 +364,7 @@ impl<T> VecPerParamSpace<T> {
|
|||
if v.len() == 0 { None } else { Some(&v[0]) }
|
||||
}
|
||||
|
||||
pub fn len(&self, space: ParamSpace) -> uint {
|
||||
pub fn len(&self, space: ParamSpace) -> usize {
|
||||
self.get_slice(space).len()
|
||||
}
|
||||
|
||||
|
|
@ -384,13 +384,13 @@ impl<T> VecPerParamSpace<T> {
|
|||
|
||||
pub fn opt_get<'a>(&'a self,
|
||||
space: ParamSpace,
|
||||
index: uint)
|
||||
index: usize)
|
||||
-> Option<&'a T> {
|
||||
let v = self.get_slice(space);
|
||||
if index < v.len() { Some(&v[index]) } else { None }
|
||||
}
|
||||
|
||||
pub fn get<'a>(&'a self, space: ParamSpace, index: uint) -> &'a T {
|
||||
pub fn get<'a>(&'a self, space: ParamSpace, index: usize) -> &'a T {
|
||||
&self.get_slice(space)[index]
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ impl<T> VecPerParamSpace<T> {
|
|||
}
|
||||
|
||||
pub fn map_enumerated<U, P>(&self, pred: P) -> VecPerParamSpace<U> where
|
||||
P: FnMut((ParamSpace, uint, &T)) -> U,
|
||||
P: FnMut((ParamSpace, usize, &T)) -> U,
|
||||
{
|
||||
let result = self.iter_enumerated().map(pred).collect();
|
||||
VecPerParamSpace::new_internal(result,
|
||||
|
|
@ -487,8 +487,8 @@ impl<T> VecPerParamSpace<T> {
|
|||
#[derive(Clone)]
|
||||
pub struct EnumeratedItems<'a,T:'a> {
|
||||
vec: &'a VecPerParamSpace<T>,
|
||||
space_index: uint,
|
||||
elem_index: uint
|
||||
space_index: usize,
|
||||
elem_index: usize
|
||||
}
|
||||
|
||||
impl<'a,T> EnumeratedItems<'a,T> {
|
||||
|
|
@ -511,9 +511,9 @@ impl<'a,T> EnumeratedItems<'a,T> {
|
|||
}
|
||||
|
||||
impl<'a,T> Iterator for EnumeratedItems<'a,T> {
|
||||
type Item = (ParamSpace, uint, &'a T);
|
||||
type Item = (ParamSpace, usize, &'a T);
|
||||
|
||||
fn next(&mut self) -> Option<(ParamSpace, uint, &'a T)> {
|
||||
fn next(&mut self) -> Option<(ParamSpace, usize, &'a T)> {
|
||||
let spaces = ParamSpace::all();
|
||||
if self.space_index < spaces.len() {
|
||||
let space = spaces[self.space_index];
|
||||
|
|
@ -598,7 +598,7 @@ struct SubstFolder<'a, 'tcx: 'a> {
|
|||
root_ty: Option<Ty<'tcx>>,
|
||||
|
||||
// Depth of type stack
|
||||
ty_stack_depth: uint,
|
||||
ty_stack_depth: usize,
|
||||
|
||||
// Number of region binders we have passed through while doing the substitution
|
||||
region_binders_passed: u32,
|
||||
|
|
@ -626,7 +626,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
|
|||
match self.substs.regions {
|
||||
ErasedRegions => ty::ReStatic,
|
||||
NonerasedRegions(ref regions) =>
|
||||
match regions.opt_get(space, i as uint) {
|
||||
match regions.opt_get(space, i as usize) {
|
||||
Some(&r) => {
|
||||
self.shift_region_through_binders(r)
|
||||
}
|
||||
|
|
@ -682,7 +682,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<'tcx>) -> Ty<'tcx> {
|
||||
// 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 as uint);
|
||||
let opt_ty = self.substs.types.opt_get(p.space, p.idx as usize);
|
||||
let ty = match opt_ty {
|
||||
Some(t) => *t,
|
||||
None => {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ pub struct FulfillmentContext<'tcx> {
|
|||
// Remembers the count of trait obligations that we have already
|
||||
// attempted to select. This is used to avoid repeating work
|
||||
// when `select_new_obligations` is called.
|
||||
attempted_mark: uint,
|
||||
attempted_mark: usize,
|
||||
|
||||
// A set of constraints that regionck must validate. Each
|
||||
// constraint has the form `T:'a`, meaning "some type `T` must
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ mod util;
|
|||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct Obligation<'tcx, T> {
|
||||
pub cause: ObligationCause<'tcx>,
|
||||
pub recursion_depth: uint,
|
||||
pub recursion_depth: usize,
|
||||
pub predicate: T,
|
||||
}
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ impl<'tcx,O> Obligation<'tcx,O> {
|
|||
}
|
||||
|
||||
fn with_depth(cause: ObligationCause<'tcx>,
|
||||
recursion_depth: uint,
|
||||
recursion_depth: usize,
|
||||
trait_ref: O)
|
||||
-> Obligation<'tcx, O>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ pub fn normalize<'a,'b,'tcx,T>(selcx: &'a mut SelectionContext<'b,'tcx>,
|
|||
/// As `normalize`, but with a custom depth.
|
||||
pub fn normalize_with_depth<'a,'b,'tcx,T>(selcx: &'a mut SelectionContext<'b,'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
depth: uint,
|
||||
depth: usize,
|
||||
value: &T)
|
||||
-> Normalized<'tcx, T>
|
||||
where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr<'tcx>
|
||||
|
|
@ -214,13 +214,13 @@ struct AssociatedTypeNormalizer<'a,'b:'a,'tcx:'b> {
|
|||
selcx: &'a mut SelectionContext<'b,'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
obligations: Vec<PredicateObligation<'tcx>>,
|
||||
depth: uint,
|
||||
depth: usize,
|
||||
}
|
||||
|
||||
impl<'a,'b,'tcx> AssociatedTypeNormalizer<'a,'b,'tcx> {
|
||||
fn new(selcx: &'a mut SelectionContext<'b,'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
depth: uint)
|
||||
depth: usize)
|
||||
-> AssociatedTypeNormalizer<'a,'b,'tcx>
|
||||
{
|
||||
AssociatedTypeNormalizer {
|
||||
|
|
@ -314,7 +314,7 @@ pub fn normalize_projection_type<'a,'b,'tcx>(
|
|||
selcx: &'a mut SelectionContext<'b,'tcx>,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
depth: uint)
|
||||
depth: usize)
|
||||
-> NormalizedTy<'tcx>
|
||||
{
|
||||
opt_normalize_projection_type(selcx, projection_ty.clone(), cause.clone(), depth)
|
||||
|
|
@ -344,7 +344,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
|
|||
selcx: &'a mut SelectionContext<'b,'tcx>,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
depth: uint)
|
||||
depth: usize)
|
||||
-> Option<NormalizedTy<'tcx>>
|
||||
{
|
||||
debug!("normalize_projection_type(\
|
||||
|
|
@ -412,7 +412,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
|
|||
fn normalize_to_error<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
depth: uint)
|
||||
depth: usize)
|
||||
-> NormalizedTy<'tcx>
|
||||
{
|
||||
let trait_ref = projection_ty.trait_ref.to_poly_trait_ref();
|
||||
|
|
@ -699,10 +699,10 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
|
|||
// But wait, you say! What about an example like this:
|
||||
//
|
||||
// ```
|
||||
// fn bar<T:SomeTrait<Foo=uint>>(...) { ... }
|
||||
// fn bar<T:SomeTrait<Foo=usize>>(...) { ... }
|
||||
// ```
|
||||
//
|
||||
// Doesn't the `T : Sometrait<Foo=uint>` predicate help
|
||||
// Doesn't the `T : Sometrait<Foo=usize>` predicate help
|
||||
// resolve `T::Foo`? And of course it does, but in fact
|
||||
// that single predicate is desugared into two predicates
|
||||
// in the compiler: a trait predicate (`T : SomeTrait`) and a
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ pub enum MethodMatchedData {
|
|||
/// The selection process begins by considering all impls, where
|
||||
/// clauses, and so forth that might resolve an obligation. Sometimes
|
||||
/// we'll be able to say definitively that (e.g.) an impl does not
|
||||
/// apply to the obligation: perhaps it is defined for `uint` but the
|
||||
/// apply to the obligation: perhaps it is defined for `usize` but the
|
||||
/// obligation is for `int`. In that case, we drop the impl out of the
|
||||
/// list. But the other cases are considered *candidates*.
|
||||
///
|
||||
|
|
@ -627,7 +627,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// for example, we are looking for $0:Eq where $0 is some
|
||||
// unconstrained type variable. In that case, we'll get a
|
||||
// candidate which assumes $0 == int, one that assumes $0 ==
|
||||
// uint, etc. This spells an ambiguity.
|
||||
// usize, etc. This spells an ambiguity.
|
||||
|
||||
// If there is more than one candidate, first winnow them down
|
||||
// by considering extra conditions (nested obligations and so
|
||||
|
|
@ -2010,7 +2010,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
impl_def_id: ast::DefId,
|
||||
substs: Normalized<'tcx, Substs<'tcx>>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
recursion_depth: uint,
|
||||
recursion_depth: usize,
|
||||
skol_map: infer::SkolemizationMap,
|
||||
snapshot: &infer::CombinedSnapshot)
|
||||
-> VtableImplData<'tcx, PredicateObligation<'tcx>>
|
||||
|
|
@ -2142,9 +2142,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
///
|
||||
/// impl Fn(int) for Closure { ... }
|
||||
///
|
||||
/// Now imagine our obligation is `Fn(uint) for Closure`. So far
|
||||
/// Now imagine our obligation is `Fn(usize) for Closure`. So far
|
||||
/// we have matched the self-type `Closure`. At this point we'll
|
||||
/// compare the `int` to `uint` and generate an error.
|
||||
/// compare the `int` to `usize` and generate an error.
|
||||
///
|
||||
/// Note that this checking occurs *after* the impl has selected,
|
||||
/// because these output type parameters should not affect the
|
||||
|
|
@ -2441,7 +2441,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
/// impl.
|
||||
fn impl_or_trait_obligations(&mut self,
|
||||
cause: ObligationCause<'tcx>,
|
||||
recursion_depth: uint,
|
||||
recursion_depth: usize,
|
||||
def_id: ast::DefId, // of impl or trait
|
||||
substs: &Substs<'tcx>, // for impl or trait
|
||||
skol_map: infer::SkolemizationMap,
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ impl<'tcx> fmt::Debug for super::VtableObjectData<'tcx> {
|
|||
/// See `super::obligations_for_generics`
|
||||
pub fn predicates_for_generics<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
recursion_depth: uint,
|
||||
recursion_depth: usize,
|
||||
generic_bounds: &ty::InstantiatedPredicates<'tcx>)
|
||||
-> VecPerParamSpace<PredicateObligation<'tcx>>
|
||||
{
|
||||
|
|
@ -316,7 +316,7 @@ pub fn trait_ref_for_builtin_bound<'tcx>(
|
|||
pub fn predicate_for_trait_ref<'tcx>(
|
||||
cause: ObligationCause<'tcx>,
|
||||
trait_ref: Rc<ty::TraitRef<'tcx>>,
|
||||
recursion_depth: uint)
|
||||
recursion_depth: usize)
|
||||
-> Result<PredicateObligation<'tcx>, ErrorReported>
|
||||
{
|
||||
Ok(Obligation {
|
||||
|
|
@ -330,7 +330,7 @@ pub fn predicate_for_trait_def<'tcx>(
|
|||
tcx: &ty::ctxt<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
trait_def_id: ast::DefId,
|
||||
recursion_depth: uint,
|
||||
recursion_depth: usize,
|
||||
param_ty: Ty<'tcx>)
|
||||
-> Result<PredicateObligation<'tcx>, ErrorReported>
|
||||
{
|
||||
|
|
@ -345,7 +345,7 @@ pub fn predicate_for_builtin_bound<'tcx>(
|
|||
tcx: &ty::ctxt<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
builtin_bound: ty::BuiltinBound,
|
||||
recursion_depth: uint,
|
||||
recursion_depth: usize,
|
||||
param_ty: Ty<'tcx>)
|
||||
-> Result<PredicateObligation<'tcx>, ErrorReported>
|
||||
{
|
||||
|
|
@ -377,7 +377,7 @@ pub fn upcast<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
pub fn get_vtable_index_of_object_method<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||
object_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
trait_def_id: ast::DefId,
|
||||
method_offset_in_trait: uint) -> uint {
|
||||
method_offset_in_trait: usize) -> usize {
|
||||
// We need to figure the "real index" of the method in a
|
||||
// listing of all the methods of an object. We do this by
|
||||
// iterating down the supertraits of the object's trait until
|
||||
|
|
|
|||
|
|
@ -261,8 +261,8 @@ pub struct field_ty {
|
|||
#[derive(Copy, PartialEq, Eq, Hash)]
|
||||
pub struct creader_cache_key {
|
||||
pub cnum: CrateNum,
|
||||
pub pos: uint,
|
||||
pub len: uint
|
||||
pub pos: usize,
|
||||
pub len: usize
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable)]
|
||||
|
|
@ -288,18 +288,18 @@ pub enum AutoAdjustment<'tcx> {
|
|||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub enum UnsizeKind<'tcx> {
|
||||
// [T, ..n] -> [T], the uint field is n.
|
||||
UnsizeLength(uint),
|
||||
// [T, ..n] -> [T], the usize field is n.
|
||||
UnsizeLength(usize),
|
||||
// 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<'tcx>>, uint),
|
||||
// The usize is the index of the type parameter which is unsized.
|
||||
UnsizeStruct(Box<UnsizeKind<'tcx>>, usize),
|
||||
UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>),
|
||||
UnsizeUpcast(Ty<'tcx>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AutoDerefRef<'tcx> {
|
||||
pub autoderefs: uint,
|
||||
pub autoderefs: usize,
|
||||
pub autoref: Option<AutoRef<'tcx>>
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +423,7 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti
|
|||
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Debug)]
|
||||
pub struct param_index {
|
||||
pub space: subst::ParamSpace,
|
||||
pub index: uint
|
||||
pub index: usize
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
@ -452,10 +452,10 @@ pub struct MethodParam<'tcx> {
|
|||
// instantiated with fresh variables at this point.
|
||||
pub trait_ref: Rc<ty::TraitRef<'tcx>>,
|
||||
|
||||
// index of uint in the list of trait items. Note that this is NOT
|
||||
// index of usize in the list of trait items. Note that this is NOT
|
||||
// the index into the vtable, because the list of trait items
|
||||
// includes associated types.
|
||||
pub method_num: uint,
|
||||
pub method_num: usize,
|
||||
|
||||
/// The impl for the trait from which the method comes. This
|
||||
/// should only be used for certain linting/heuristic purposes
|
||||
|
|
@ -474,13 +474,13 @@ pub struct MethodObject<'tcx> {
|
|||
pub object_trait_id: ast::DefId,
|
||||
|
||||
// index of the method to be invoked amongst the trait's items
|
||||
pub method_num: uint,
|
||||
pub method_num: usize,
|
||||
|
||||
// index into the actual runtime vtable.
|
||||
// the vtable is formed by concatenating together the method lists of
|
||||
// the base object trait and all supertraits; this is the index into
|
||||
// that vtable
|
||||
pub vtable_index: uint,
|
||||
pub vtable_index: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
@ -511,7 +511,7 @@ pub struct MethodCall {
|
|||
#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)]
|
||||
pub enum ExprAdjustment {
|
||||
NoAdjustment,
|
||||
AutoDeref(uint),
|
||||
AutoDeref(usize),
|
||||
AutoObject
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +530,7 @@ impl MethodCall {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn autoderef(expr_id: ast::NodeId, autoderef: uint) -> MethodCall {
|
||||
pub fn autoderef(expr_id: ast::NodeId, autoderef: usize) -> MethodCall {
|
||||
MethodCall {
|
||||
expr_id: expr_id,
|
||||
adjustment: AutoDeref(1 + autoderef)
|
||||
|
|
@ -564,7 +564,7 @@ pub enum vtable_origin<'tcx> {
|
|||
The first argument is the param index (identifying T in the example),
|
||||
and the second is the bound number (identifying baz)
|
||||
*/
|
||||
vtable_param(param_index, uint),
|
||||
vtable_param(param_index, usize),
|
||||
|
||||
/*
|
||||
Vtable automatically generated for a closure. The def ID is the
|
||||
|
|
@ -639,12 +639,12 @@ impl<'tcx> CtxtArenas<'tcx> {
|
|||
pub struct CommonTypes<'tcx> {
|
||||
pub bool: Ty<'tcx>,
|
||||
pub char: Ty<'tcx>,
|
||||
pub int: Ty<'tcx>,
|
||||
pub isize: Ty<'tcx>,
|
||||
pub i8: Ty<'tcx>,
|
||||
pub i16: Ty<'tcx>,
|
||||
pub i32: Ty<'tcx>,
|
||||
pub i64: Ty<'tcx>,
|
||||
pub uint: Ty<'tcx>,
|
||||
pub usize: Ty<'tcx>,
|
||||
pub u8: Ty<'tcx>,
|
||||
pub u16: Ty<'tcx>,
|
||||
pub u32: Ty<'tcx>,
|
||||
|
|
@ -877,10 +877,10 @@ macro_rules! sty_debug_print {
|
|||
use middle::ty;
|
||||
#[derive(Copy)]
|
||||
struct DebugStat {
|
||||
total: uint,
|
||||
region_infer: uint,
|
||||
ty_infer: uint,
|
||||
both_infer: uint,
|
||||
total: usize,
|
||||
region_infer: usize,
|
||||
ty_infer: usize,
|
||||
both_infer: usize,
|
||||
}
|
||||
|
||||
pub fn go(tcx: &ty::ctxt) {
|
||||
|
|
@ -1024,7 +1024,7 @@ pub fn type_has_late_bound_regions(ty: Ty) -> bool {
|
|||
///
|
||||
/// So, for example, consider a type like the following, which has two binders:
|
||||
///
|
||||
/// for<'a> fn(x: for<'b> fn(&'a int, &'b int))
|
||||
/// for<'a> fn(x: for<'b> fn(&'a isize, &'b isize))
|
||||
/// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ outer scope
|
||||
/// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ inner scope
|
||||
///
|
||||
|
|
@ -1110,7 +1110,7 @@ impl<'tcx> PolyFnSig<'tcx> {
|
|||
pub fn inputs(&self) -> ty::Binder<Vec<Ty<'tcx>>> {
|
||||
ty::Binder(self.0.inputs.clone())
|
||||
}
|
||||
pub fn input(&self, index: uint) -> ty::Binder<Ty<'tcx>> {
|
||||
pub fn input(&self, index: usize) -> ty::Binder<Ty<'tcx>> {
|
||||
ty::Binder(self.0.inputs[index])
|
||||
}
|
||||
pub fn output(&self) -> ty::Binder<FnOutput<'tcx>> {
|
||||
|
|
@ -1132,7 +1132,7 @@ pub struct ParamTy {
|
|||
/// regions (and perhaps later types) in a higher-ranked setting. In
|
||||
/// particular, imagine a type like this:
|
||||
///
|
||||
/// for<'a> fn(for<'b> fn(&'b int, &'a int), &'a char)
|
||||
/// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char)
|
||||
/// ^ ^ | | |
|
||||
/// | | | | |
|
||||
/// | +------------+ 1 | |
|
||||
|
|
@ -1149,11 +1149,11 @@ pub struct ParamTy {
|
|||
/// count the number of binders, inside out. Some examples should help
|
||||
/// clarify what I mean.
|
||||
///
|
||||
/// Let's start with the reference type `&'b int` that is the first
|
||||
/// Let's start with the reference type `&'b isize` that is the first
|
||||
/// argument to the inner function. This region `'b` is assigned a De
|
||||
/// Bruijn index of 1, meaning "the innermost binder" (in this case, a
|
||||
/// fn). The region `'a` that appears in the second argument type (`&'a
|
||||
/// int`) would then be assigned a De Bruijn index of 2, meaning "the
|
||||
/// isize`) would then be assigned a De Bruijn index of 2, meaning "the
|
||||
/// second-innermost binder". (These indices are written on the arrays
|
||||
/// in the diagram).
|
||||
///
|
||||
|
|
@ -1234,14 +1234,14 @@ pub enum BorrowKind {
|
|||
/// implicit closure bindings. It is needed when you the closure
|
||||
/// is borrowing or mutating a mutable referent, e.g.:
|
||||
///
|
||||
/// let x: &mut int = ...;
|
||||
/// let x: &mut isize = ...;
|
||||
/// let y = || *x += 5;
|
||||
///
|
||||
/// If we were to try to translate this closure into a more explicit
|
||||
/// form, we'd encounter an error with the code as written:
|
||||
///
|
||||
/// struct Env { x: & &mut int }
|
||||
/// let x: &mut int = ...;
|
||||
/// struct Env { x: & &mut isize }
|
||||
/// let x: &mut isize = ...;
|
||||
/// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
|
||||
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
|
||||
///
|
||||
|
|
@ -1249,8 +1249,8 @@ pub enum BorrowKind {
|
|||
/// in an aliasable location. To solve, you'd have to translate with
|
||||
/// an `&mut` borrow:
|
||||
///
|
||||
/// struct Env { x: & &mut int }
|
||||
/// let x: &mut int = ...;
|
||||
/// struct Env { x: & &mut isize }
|
||||
/// let x: &mut isize = ...;
|
||||
/// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
|
||||
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
|
||||
///
|
||||
|
|
@ -1361,7 +1361,7 @@ pub enum sty<'tcx> {
|
|||
ty_enum(DefId, &'tcx Substs<'tcx>),
|
||||
ty_uniq(Ty<'tcx>),
|
||||
ty_str,
|
||||
ty_vec(Ty<'tcx>, Option<uint>), // Second field is length.
|
||||
ty_vec(Ty<'tcx>, Option<usize>), // Second field is length.
|
||||
ty_ptr(mt<'tcx>),
|
||||
ty_rptr(&'tcx Region, mt<'tcx>),
|
||||
|
||||
|
|
@ -1491,7 +1491,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
|||
}
|
||||
|
||||
/// Binder is a binder for higher-ranked lifetimes. It is part of the
|
||||
/// compiler's representation for things like `for<'a> Fn(&'a int)`
|
||||
/// compiler's representation for things like `for<'a> Fn(&'a isize)`
|
||||
/// (which would be represented by the type `PolyTraitRef ==
|
||||
/// Binder<TraitRef>`). Note that when we skolemize, instantiate,
|
||||
/// erase, or otherwise "discharge" these bound regions, we change the
|
||||
|
|
@ -1552,9 +1552,9 @@ pub enum type_err<'tcx> {
|
|||
terr_ptr_mutability,
|
||||
terr_ref_mutability,
|
||||
terr_vec_mutability,
|
||||
terr_tuple_size(expected_found<uint>),
|
||||
terr_fixed_array_size(expected_found<uint>),
|
||||
terr_ty_param_size(expected_found<uint>),
|
||||
terr_tuple_size(expected_found<usize>),
|
||||
terr_fixed_array_size(expected_found<usize>),
|
||||
terr_ty_param_size(expected_found<usize>),
|
||||
terr_arg_count,
|
||||
terr_regions_does_not_outlive(Region, Region),
|
||||
terr_regions_not_same(Region, Region),
|
||||
|
|
@ -1571,7 +1571,7 @@ pub enum type_err<'tcx> {
|
|||
terr_cyclic_ty,
|
||||
terr_convergence_mismatch(expected_found<bool>),
|
||||
terr_projection_name_mismatched(expected_found<ast::Name>),
|
||||
terr_projection_bounds_length(expected_found<uint>),
|
||||
terr_projection_bounds_length(expected_found<usize>),
|
||||
}
|
||||
|
||||
/// Bounds suitable for a named type parameter like `A` in `fn foo<A>`
|
||||
|
|
@ -1600,7 +1600,7 @@ pub type BuiltinBounds = EnumSet<BuiltinBound>;
|
|||
|
||||
#[derive(Clone, RustcEncodable, PartialEq, Eq, RustcDecodable, Hash,
|
||||
Debug, Copy)]
|
||||
#[repr(uint)]
|
||||
#[repr(usize)]
|
||||
pub enum BuiltinBound {
|
||||
BoundSend,
|
||||
BoundSized,
|
||||
|
|
@ -1628,10 +1628,10 @@ pub fn region_existential_bound<'tcx>(r: ty::Region) -> ExistentialBounds<'tcx>
|
|||
}
|
||||
|
||||
impl CLike for BuiltinBound {
|
||||
fn to_usize(&self) -> uint {
|
||||
*self as uint
|
||||
fn to_usize(&self) -> usize {
|
||||
*self as usize
|
||||
}
|
||||
fn from_usize(v: uint) -> BuiltinBound {
|
||||
fn from_usize(v: usize) -> BuiltinBound {
|
||||
unsafe { mem::transmute(v) }
|
||||
}
|
||||
}
|
||||
|
|
@ -2202,8 +2202,8 @@ impl<'tcx> Predicate<'tcx> {
|
|||
///
|
||||
/// Here, the `GenericPredicates` for `Foo` would contain a list of bounds like
|
||||
/// `[[], [U:Bar<T>]]`. Now if there were some particular reference
|
||||
/// like `Foo<int,uint>`, then the `InstantiatedPredicates` would be `[[],
|
||||
/// [uint:Bar<int>]]`.
|
||||
/// like `Foo<isize,usize>`, then the `InstantiatedPredicates` would be `[[],
|
||||
/// [usize:Bar<isize>]]`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct InstantiatedPredicates<'tcx> {
|
||||
pub predicates: VecPerParamSpace<Predicate<'tcx>>,
|
||||
|
|
@ -2545,12 +2545,12 @@ impl<'tcx> CommonTypes<'tcx> {
|
|||
bool: intern_ty(arena, interner, ty_bool),
|
||||
char: intern_ty(arena, interner, ty_char),
|
||||
err: intern_ty(arena, interner, ty_err),
|
||||
int: intern_ty(arena, interner, ty_int(ast::TyIs)),
|
||||
isize: intern_ty(arena, interner, ty_int(ast::TyIs)),
|
||||
i8: intern_ty(arena, interner, ty_int(ast::TyI8)),
|
||||
i16: intern_ty(arena, interner, ty_int(ast::TyI16)),
|
||||
i32: intern_ty(arena, interner, ty_int(ast::TyI32)),
|
||||
i64: intern_ty(arena, interner, ty_int(ast::TyI64)),
|
||||
uint: intern_ty(arena, interner, ty_uint(ast::TyUs)),
|
||||
usize: intern_ty(arena, interner, ty_uint(ast::TyUs)),
|
||||
u8: intern_ty(arena, interner, ty_uint(ast::TyU8)),
|
||||
u16: intern_ty(arena, interner, ty_uint(ast::TyU16)),
|
||||
u32: intern_ty(arena, interner, ty_uint(ast::TyU32)),
|
||||
|
|
@ -2935,7 +2935,7 @@ impl FlagComputation {
|
|||
|
||||
pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> {
|
||||
match tm {
|
||||
ast::TyIs => tcx.types.int,
|
||||
ast::TyIs => tcx.types.isize,
|
||||
ast::TyI8 => tcx.types.i8,
|
||||
ast::TyI16 => tcx.types.i16,
|
||||
ast::TyI32 => tcx.types.i32,
|
||||
|
|
@ -2945,7 +2945,7 @@ pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> {
|
|||
|
||||
pub fn mk_mach_uint<'tcx>(tcx: &ctxt<'tcx>, tm: ast::UintTy) -> Ty<'tcx> {
|
||||
match tm {
|
||||
ast::TyUs => tcx.types.uint,
|
||||
ast::TyUs => tcx.types.usize,
|
||||
ast::TyU8 => tcx.types.u8,
|
||||
ast::TyU16 => tcx.types.u16,
|
||||
ast::TyU32 => tcx.types.u32,
|
||||
|
|
@ -3004,7 +3004,7 @@ pub fn mk_nil_ptr<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
|
|||
mk_ptr(cx, mt {ty: mk_nil(cx), mutbl: ast::MutImmutable})
|
||||
}
|
||||
|
||||
pub fn mk_vec<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, sz: Option<uint>) -> Ty<'tcx> {
|
||||
pub fn mk_vec<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, sz: Option<usize>) -> Ty<'tcx> {
|
||||
mk_t(cx, ty_vec(ty, sz))
|
||||
}
|
||||
|
||||
|
|
@ -3130,9 +3130,9 @@ impl<'tcx> TyS<'tcx> {
|
|||
/// structs or variants. For example:
|
||||
///
|
||||
/// ```notrust
|
||||
/// int => { int }
|
||||
/// Foo<Bar<int>> => { Foo<Bar<int>>, Bar<int>, int }
|
||||
/// [int] => { [int], int }
|
||||
/// isize => { isize }
|
||||
/// Foo<Bar<isize>> => { Foo<Bar<isize>>, Bar<isize>, isize }
|
||||
/// [isize] => { [isize], isize }
|
||||
/// ```
|
||||
pub fn walk(&'tcx self) -> TypeWalker<'tcx> {
|
||||
TypeWalker::new(self)
|
||||
|
|
@ -3143,9 +3143,9 @@ impl<'tcx> TyS<'tcx> {
|
|||
/// example:
|
||||
///
|
||||
/// ```notrust
|
||||
/// int => { }
|
||||
/// Foo<Bar<int>> => { Bar<int>, int }
|
||||
/// [int] => { int }
|
||||
/// isize => { }
|
||||
/// Foo<Bar<isize>> => { Bar<isize>, isize }
|
||||
/// [isize] => { isize }
|
||||
/// ```
|
||||
pub fn walk_children(&'tcx self) -> TypeWalker<'tcx> {
|
||||
// Walks type reachable from `self` but not `self
|
||||
|
|
@ -3343,7 +3343,7 @@ pub fn simd_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn simd_size(cx: &ctxt, ty: Ty) -> uint {
|
||||
pub fn simd_size(cx: &ctxt, ty: Ty) -> usize {
|
||||
match ty.sty {
|
||||
ty_struct(did, _) => {
|
||||
let fields = lookup_struct_fields(cx, did);
|
||||
|
|
@ -3611,7 +3611,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
|
|||
cache.insert(ty, TC::None);
|
||||
|
||||
let result = match ty.sty {
|
||||
// uint and int are ffi-unsafe
|
||||
// usize and isize are ffi-unsafe
|
||||
ty_uint(ast::TyUs) | ty_int(ast::TyIs) => {
|
||||
TC::ReachesFfiUnsafe
|
||||
}
|
||||
|
|
@ -4292,7 +4292,7 @@ pub fn array_element_ty<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>
|
|||
/// For an enum `t`, `variant` is None only if `t` is a univariant enum.
|
||||
pub fn positional_element_ty<'tcx>(cx: &ctxt<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
i: uint,
|
||||
i: usize,
|
||||
variant: Option<ast::DefId>) -> Option<Ty<'tcx>> {
|
||||
|
||||
match (&ty.sty, variant) {
|
||||
|
|
@ -4468,8 +4468,8 @@ pub fn pat_ty_opt<'tcx>(cx: &ctxt<'tcx>, pat: &ast::Pat) -> Option<Ty<'tcx>> {
|
|||
// adjustments. See `expr_ty_adjusted()` instead.
|
||||
//
|
||||
// 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(ty) -> T with T = int".
|
||||
// ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize"
|
||||
// instead of "fn(ty) -> T with T = isize".
|
||||
pub fn expr_ty<'tcx>(cx: &ctxt<'tcx>, expr: &ast::Expr) -> Ty<'tcx> {
|
||||
return node_id_to_type(cx, expr.id);
|
||||
}
|
||||
|
|
@ -4879,7 +4879,7 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
|
|||
}
|
||||
|
||||
pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
|
||||
-> uint {
|
||||
-> usize {
|
||||
let mut i = 0;
|
||||
for f in fields { if f.name == name { return i; } i += 1; }
|
||||
tcx.sess.bug(&format!(
|
||||
|
|
@ -4891,7 +4891,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
|
|||
}
|
||||
|
||||
pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
|
||||
-> Option<uint> {
|
||||
-> Option<usize> {
|
||||
trait_items.iter().position(|m| m.name() == id)
|
||||
}
|
||||
|
||||
|
|
@ -5163,7 +5163,7 @@ fn lookup_locally_or_in_crate_store<V, F>(descr: &str,
|
|||
v
|
||||
}
|
||||
|
||||
pub fn trait_item<'tcx>(cx: &ctxt<'tcx>, trait_did: ast::DefId, idx: uint)
|
||||
pub fn trait_item<'tcx>(cx: &ctxt<'tcx>, trait_did: ast::DefId, idx: usize)
|
||||
-> ImplOrTraitItem<'tcx> {
|
||||
let method_def_id = (*ty::trait_item_def_ids(cx, trait_did))[idx].def_id();
|
||||
impl_or_trait_item(cx, method_def_id)
|
||||
|
|
@ -5238,10 +5238,10 @@ pub fn is_associated_type(cx: &ctxt, id: ast::DefId) -> bool {
|
|||
pub fn associated_type_parameter_index(cx: &ctxt,
|
||||
trait_def: &TraitDef,
|
||||
associated_type_id: ast::DefId)
|
||||
-> uint {
|
||||
-> usize {
|
||||
for type_parameter_def in trait_def.generics.types.iter() {
|
||||
if type_parameter_def.def_id == associated_type_id {
|
||||
return type_parameter_def.index as uint
|
||||
return type_parameter_def.index as usize
|
||||
}
|
||||
}
|
||||
cx.sess.bug("couldn't find associated type parameter index")
|
||||
|
|
@ -5794,24 +5794,24 @@ pub fn closure_upvars<'tcx>(typer: &mc::Typer<'tcx>,
|
|||
|
||||
pub fn is_binopable<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, op: ast::BinOp) -> bool {
|
||||
#![allow(non_upper_case_globals)]
|
||||
const tycat_other: int = 0;
|
||||
const tycat_bool: int = 1;
|
||||
const tycat_char: int = 2;
|
||||
const tycat_int: int = 3;
|
||||
const tycat_float: int = 4;
|
||||
const tycat_raw_ptr: int = 6;
|
||||
const tycat_other: isize = 0;
|
||||
const tycat_bool: isize = 1;
|
||||
const tycat_char: isize = 2;
|
||||
const tycat_int: isize = 3;
|
||||
const tycat_float: isize = 4;
|
||||
const tycat_raw_ptr: isize = 6;
|
||||
|
||||
const opcat_add: int = 0;
|
||||
const opcat_sub: int = 1;
|
||||
const opcat_mult: int = 2;
|
||||
const opcat_shift: int = 3;
|
||||
const opcat_rel: int = 4;
|
||||
const opcat_eq: int = 5;
|
||||
const opcat_bit: int = 6;
|
||||
const opcat_logic: int = 7;
|
||||
const opcat_mod: int = 8;
|
||||
const opcat_add: isize = 0;
|
||||
const opcat_sub: isize = 1;
|
||||
const opcat_mult: isize = 2;
|
||||
const opcat_shift: isize = 3;
|
||||
const opcat_rel: isize = 4;
|
||||
const opcat_eq: isize = 5;
|
||||
const opcat_bit: isize = 6;
|
||||
const opcat_logic: isize = 7;
|
||||
const opcat_mod: isize = 8;
|
||||
|
||||
fn opcat(op: ast::BinOp) -> int {
|
||||
fn opcat(op: ast::BinOp) -> isize {
|
||||
match op.node {
|
||||
ast::BiAdd => opcat_add,
|
||||
ast::BiSub => opcat_sub,
|
||||
|
|
@ -5834,7 +5834,7 @@ pub fn is_binopable<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, op: ast::BinOp) -> bool
|
|||
}
|
||||
}
|
||||
|
||||
fn tycat<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> int {
|
||||
fn tycat<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> isize {
|
||||
if type_is_simd(cx, ty) {
|
||||
return tycat(cx, simd_type(cx, ty))
|
||||
}
|
||||
|
|
@ -5856,21 +5856,21 @@ pub fn is_binopable<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, op: ast::BinOp) -> bool
|
|||
/*other*/ [f, f, f, f, f, f, f, f, f],
|
||||
/*bool*/ [f, f, f, f, t, t, t, t, f],
|
||||
/*char*/ [f, f, f, f, t, t, f, f, f],
|
||||
/*int*/ [t, t, t, t, t, t, t, f, t],
|
||||
/*isize*/ [t, t, t, t, t, t, t, f, t],
|
||||
/*float*/ [t, t, t, f, t, t, f, f, f],
|
||||
/*bot*/ [t, t, t, t, t, t, t, t, t],
|
||||
/*raw ptr*/ [f, f, f, f, t, t, f, f, f]];
|
||||
|
||||
return tbl[tycat(cx, ty) as uint ][opcat(op) as uint];
|
||||
return tbl[tycat(cx, ty) as usize ][opcat(op) as usize];
|
||||
}
|
||||
|
||||
// Returns the repeat count for a repeating vector expression.
|
||||
pub fn eval_repeat_count(tcx: &ctxt, count_expr: &ast::Expr) -> uint {
|
||||
match const_eval::eval_const_expr_partial(tcx, count_expr, Some(tcx.types.uint)) {
|
||||
pub fn eval_repeat_count(tcx: &ctxt, count_expr: &ast::Expr) -> usize {
|
||||
match const_eval::eval_const_expr_partial(tcx, count_expr, Some(tcx.types.usize)) {
|
||||
Ok(val) => {
|
||||
let found = match val {
|
||||
const_eval::const_uint(count) => return count as uint,
|
||||
const_eval::const_int(count) if count >= 0 => return count as uint,
|
||||
const_eval::const_uint(count) => return count as usize,
|
||||
const_eval::const_int(count) if count >= 0 => return count as usize,
|
||||
const_eval::const_int(_) => "negative integer",
|
||||
const_eval::const_float(_) => "float",
|
||||
const_eval::const_str(_) => "string",
|
||||
|
|
@ -6739,7 +6739,7 @@ pub fn liberate_late_bound_regions<'tcx, T>(
|
|||
pub fn count_late_bound_regions<'tcx, T>(
|
||||
tcx: &ty::ctxt<'tcx>,
|
||||
value: &Binder<T>)
|
||||
-> uint
|
||||
-> usize
|
||||
where T : TypeFoldable<'tcx> + Repr<'tcx>
|
||||
{
|
||||
let (_, skol_map) = replace_late_bound_regions(tcx, value, |_| ty::ReStatic);
|
||||
|
|
@ -6785,8 +6785,8 @@ pub fn erase_late_bound_regions<'tcx, T>(
|
|||
///
|
||||
/// The chief purpose of this function is to canonicalize regions so that two
|
||||
/// `FnSig`s or `TraitRef`s which are equivalent up to region naming will become
|
||||
/// structurally identical. For example, `for<'a, 'b> fn(&'a int, &'b int)` and
|
||||
/// `for<'a, 'b> fn(&'b int, &'a int)` will become identical after anonymization.
|
||||
/// structurally identical. For example, `for<'a, 'b> fn(&'a isize, &'b isize)` and
|
||||
/// `for<'a, 'b> fn(&'b isize, &'a isize)` will become identical after anonymization.
|
||||
pub fn anonymize_late_bound_regions<'tcx, T>(
|
||||
tcx: &ctxt<'tcx>,
|
||||
sig: &Binder<T>)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use std::iter::Iterator;
|
|||
|
||||
pub struct TypeWalker<'tcx> {
|
||||
stack: Vec<Ty<'tcx>>,
|
||||
last_subtree: uint,
|
||||
last_subtree: usize,
|
||||
}
|
||||
|
||||
impl<'tcx> TypeWalker<'tcx> {
|
||||
|
|
@ -80,14 +80,14 @@ impl<'tcx> TypeWalker<'tcx> {
|
|||
/// Skips the subtree of types corresponding to the last type
|
||||
/// returned by `next()`.
|
||||
///
|
||||
/// Example: Imagine you are walking `Foo<Bar<int>, uint>`.
|
||||
/// Example: Imagine you are walking `Foo<Bar<int>, usize>`.
|
||||
///
|
||||
/// ```
|
||||
/// let mut iter: TypeWalker = ...;
|
||||
/// iter.next(); // yields Foo
|
||||
/// iter.next(); // yields Bar<int>
|
||||
/// iter.skip_current_subtree(); // skips int
|
||||
/// iter.next(); // yields uint
|
||||
/// iter.next(); // yields usize
|
||||
/// ```
|
||||
pub fn skip_current_subtree(&mut self) {
|
||||
self.stack.truncate(self.last_subtree);
|
||||
|
|
|
|||
|
|
@ -440,14 +440,14 @@ macro_rules! options {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_uint(slot: &mut uint, v: Option<&str>) -> bool {
|
||||
fn parse_uint(slot: &mut usize, v: Option<&str>) -> bool {
|
||||
match v.and_then(|s| s.parse().ok()) {
|
||||
Some(i) => { *slot = i; true },
|
||||
None => false
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_opt_uint(slot: &mut Option<uint>, v: Option<&str>) -> bool {
|
||||
fn parse_opt_uint(slot: &mut Option<usize>, v: Option<&str>) -> bool {
|
||||
match v {
|
||||
Some(s) => { *slot = s.parse().ok(); slot.is_some() }
|
||||
None => { *slot = None; true }
|
||||
|
|
@ -519,16 +519,16 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
|||
"metadata to mangle symbol names with"),
|
||||
extra_filename: String = ("".to_string(), parse_string,
|
||||
"extra data to put in each output filename"),
|
||||
codegen_units: uint = (1, parse_uint,
|
||||
codegen_units: usize = (1, parse_uint,
|
||||
"divide crate into N units to optimize in parallel"),
|
||||
remark: Passes = (SomePasses(Vec::new()), parse_passes,
|
||||
"print remarks for these optimization passes (space separated, or \"all\")"),
|
||||
no_stack_check: bool = (false, parse_bool,
|
||||
"disable checks for stack exhaustion (a memory-safety hazard!)"),
|
||||
debuginfo: Option<uint> = (None, parse_opt_uint,
|
||||
debuginfo: Option<usize> = (None, parse_opt_uint,
|
||||
"debug info emission level, 0 = no debug info, 1 = line tables only, \
|
||||
2 = full debug info with variable and type information"),
|
||||
opt_level: Option<uint> = (None, parse_opt_uint,
|
||||
opt_level: Option<usize> = (None, parse_opt_uint,
|
||||
"Optimize with possible levels 0-3"),
|
||||
debug_assertions: Option<bool> = (None, parse_opt_bool,
|
||||
"explicitly enable the cfg(debug_assertions) directive"),
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ pub struct Session {
|
|||
|
||||
/// The maximum recursion limit for potentially infinitely recursive
|
||||
/// operations such as auto-dereference and monomorphization.
|
||||
pub recursion_limit: Cell<uint>,
|
||||
pub recursion_limit: Cell<usize>,
|
||||
|
||||
pub can_print_warnings: bool
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ impl Session {
|
|||
}
|
||||
self.diagnostic().handler().err(msg)
|
||||
}
|
||||
pub fn err_count(&self) -> uint {
|
||||
pub fn err_count(&self) -> usize {
|
||||
self.diagnostic().handler().err_count()
|
||||
}
|
||||
pub fn has_errors(&self) -> bool {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub struct ErrorReported;
|
|||
pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
|
||||
F: FnOnce(U) -> T,
|
||||
{
|
||||
thread_local!(static DEPTH: Cell<uint> = Cell::new(0));
|
||||
thread_local!(static DEPTH: Cell<usize> = Cell::new(0));
|
||||
if !do_it { return f(u); }
|
||||
|
||||
let old = DEPTH.with(|slot| {
|
||||
|
|
@ -196,10 +196,10 @@ pub fn can_reach<T, S>(edges_map: &HashMap<T, Vec<T>, S>, source: T,
|
|||
/// # Examples
|
||||
/// ```
|
||||
/// struct Context {
|
||||
/// cache: RefCell<HashMap<uint, uint>>
|
||||
/// cache: RefCell<HashMap<usize, usize>>
|
||||
/// }
|
||||
///
|
||||
/// fn factorial(ctxt: &Context, n: uint) -> uint {
|
||||
/// fn factorial(ctxt: &Context, n: usize) -> usize {
|
||||
/// memoized(&ctxt.cache, n, |n| match n {
|
||||
/// 0 | 1 => n,
|
||||
/// _ => factorial(ctxt, n - 2) + factorial(ctxt, n - 1)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use std::cmp;
|
||||
|
||||
pub fn lev_distance(me: &str, t: &str) -> uint {
|
||||
pub fn lev_distance(me: &str, t: &str) -> usize {
|
||||
if me.is_empty() { return t.chars().count(); }
|
||||
if t.is_empty() { return me.chars().count(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ pub enum UndoLog<D:SnapshotVecDelegate> {
|
|||
CommittedSnapshot,
|
||||
|
||||
/// New variable with given index was created.
|
||||
NewElem(uint),
|
||||
NewElem(usize),
|
||||
|
||||
/// Variable with given index was changed *from* the given value.
|
||||
SetElem(uint, D::Value),
|
||||
SetElem(usize, D::Value),
|
||||
|
||||
/// Extensible set of actions
|
||||
Other(D::Undo)
|
||||
|
|
@ -48,7 +48,7 @@ pub struct SnapshotVec<D:SnapshotVecDelegate> {
|
|||
// Snapshots are tokens that should be created/consumed linearly.
|
||||
pub struct Snapshot {
|
||||
// Length of the undo log at the time the snapshot was taken.
|
||||
length: uint,
|
||||
length: usize,
|
||||
}
|
||||
|
||||
pub trait SnapshotVecDelegate {
|
||||
|
|
@ -77,7 +77,7 @@ impl<D:SnapshotVecDelegate> SnapshotVec<D> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn push(&mut self, elem: D::Value) -> uint {
|
||||
pub fn push(&mut self, elem: D::Value) -> usize {
|
||||
let len = self.values.len();
|
||||
self.values.push(elem);
|
||||
|
||||
|
|
@ -88,20 +88,20 @@ impl<D:SnapshotVecDelegate> SnapshotVec<D> {
|
|||
len
|
||||
}
|
||||
|
||||
pub fn get<'a>(&'a self, index: uint) -> &'a D::Value {
|
||||
pub fn get<'a>(&'a self, index: usize) -> &'a D::Value {
|
||||
&self.values[index]
|
||||
}
|
||||
|
||||
/// Returns a mutable pointer into the vec; whatever changes you make here cannot be undone
|
||||
/// automatically, so you should be sure call `record()` with some sort of suitable undo
|
||||
/// action.
|
||||
pub fn get_mut<'a>(&'a mut self, index: uint) -> &'a mut D::Value {
|
||||
pub fn get_mut<'a>(&'a mut self, index: usize) -> &'a mut D::Value {
|
||||
&mut self.values[index]
|
||||
}
|
||||
|
||||
/// Updates the element at the given index. The old value will saved (and perhaps restored) if
|
||||
/// a snapshot is active.
|
||||
pub fn set(&mut self, index: uint, new_elem: D::Value) {
|
||||
pub fn set(&mut self, index: usize, new_elem: D::Value) {
|
||||
let old_elem = mem::replace(&mut self.values[index], new_elem);
|
||||
if self.in_snapshot() {
|
||||
self.undo_log.push(SetElem(index, old_elem));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue