diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-08-02 15:42:56 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-08-02 15:53:28 -0700 |
| commit | 97452c0ca16238a2de5503aca07db26ff9e8ba63 (patch) | |
| tree | 47ef430d1671ab297bc192009aa74a23723a42fc /src/rustc/metadata | |
| parent | 476ce459bd3b687658e566c75d0fb73281450d67 (diff) | |
| download | rust-97452c0ca16238a2de5503aca07db26ff9e8ba63.tar.gz rust-97452c0ca16238a2de5503aca07db26ff9e8ba63.zip | |
Remove modes from map API and replace with regions.
API is (for now) mostly by value, there are options to use it by reference if you like. Hash and equality functions must be pure and by reference (forward looking to the day when something like send_map becomes the standard map).
Diffstat (limited to 'src/rustc/metadata')
| -rw-r--r-- | src/rustc/metadata/cstore.rs | 4 | ||||
| -rw-r--r-- | src/rustc/metadata/decoder.rs | 2 | ||||
| -rw-r--r-- | src/rustc/metadata/encoder.rs | 4 | ||||
| -rw-r--r-- | src/rustc/metadata/loader.rs | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index dce5a108a03..6c329b81539 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -163,8 +163,8 @@ fn get_dep_hashes(cstore: cstore) -> ~[@~str] { debug!{"Add hash[%s]: %s", cdata.name, *hash}; vec::push(result, {name: @cdata.name, hash: hash}); }; - fn lteq(a: crate_hash, b: crate_hash) -> bool { - return *a.name <= *b.name; + pure fn lteq(a: &crate_hash, b: &crate_hash) -> bool { + *a.name <= *b.name } let sorted = std::sort::merge_sort(lteq, result); debug!{"sorted:"}; diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index f8252a04ed0..4e22c28c943 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -603,7 +603,7 @@ fn get_self_ty(item: ebml::doc) -> ast::self_ty_ { ebml::get_doc(self_type_doc, tag_item_trait_method_self_ty_region); let region_string = str::from_bytes(ebml::doc_data(region_doc)); - if str::eq(region_string, ~"") { + if region_string == ~"" { region = ast::re_anon; } else { region = ast::re_named(@region_string); diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 6dd4e0142de..3ee7b4f919f 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -1089,7 +1089,9 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) { }; // Sort by cnum - fn lteq(kv1: numdep, kv2: numdep) -> bool { kv1.cnum <= kv2.cnum } + pure fn lteq(kv1: &numdep, kv2: &numdep) -> bool { + kv1.cnum <= kv2.cnum + } std::sort::quick_sort(lteq, deps); // Sanity-check the crate numbers diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index c3949acb0af..125c2ff3aba 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -183,7 +183,7 @@ fn get_metadata_section(os: os, while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False { let name_buf = llvm::LLVMGetSectionName(si.llsi); let name = unsafe { str::unsafe::from_c_str(name_buf) }; - if str::eq(name, meta_section_name(os)) { + if name == meta_section_name(os) { let cbuf = llvm::LLVMGetSectionContents(si.llsi); let csz = llvm::LLVMGetSectionSize(si.llsi) as uint; unsafe { |
