Skip to content

Commit 3fcf300

Browse files
committed
---
yaml --- r: 159694 b: refs/heads/auto c: 7213de1 h: refs/heads/master v: v3
1 parent c367810 commit 3fcf300

File tree

22 files changed

+57
-50
lines changed

22 files changed

+57
-50
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 80a2867ea736007397aa2fbaa0e4c539c80e162c
13+
refs/heads/auto: 7213de1c49e448c7c6ad2d30dc3e6b3a13e090df
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/grammar/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn parse_antlr_token(s: &str, tokens: &HashMap<String, Token>) -> TokenAndSpan {
178178
let toknum = m.name("toknum");
179179
let content = m.name("content");
180180

181-
let proto_tok = tokens.find_equiv(&toknum).expect(format!("didn't find token {} in the map",
181+
let proto_tok = tokens.get(&toknum).expect(format!("didn't find token {} in the map",
182182
toknum).as_slice());
183183

184184
let nm = parse::token::intern(content);

branches/auto/src/libcollections/tree/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
//! ```
3434
3535
pub mod map;
36-
pub mod set;
36+
pub mod set;

branches/auto/src/libcollections/trie/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
//! `TrieMap` is ordered.
1818
1919
pub mod map;
20-
pub mod set;
20+
pub mod set;

branches/auto/src/libregex/re.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ impl<'t> Captures<'t> {
726726
match self.named {
727727
None => "",
728728
Some(ref h) => {
729-
match h.find_equiv(name) {
729+
match h.get(name) {
730730
None => "",
731731
Some(i) => self.at(*i),
732732
}

branches/auto/src/librustc/lint/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl LintStore {
165165
}
166166

167167
fn register_renamed(&mut self, old_name: &str, new_name: &str) {
168-
let target = match self.by_name.find_equiv(new_name) {
168+
let target = match self.by_name.get(new_name) {
169169
Some(&Id(lint_id)) => lint_id.clone(),
170170
_ => panic!("invalid lint renaming of {} to {}", old_name, new_name)
171171
};
@@ -259,7 +259,7 @@ impl LintStore {
259259
fn find_lint(&self, lint_name: &str, sess: &Session, span: Option<Span>)
260260
-> Option<LintId>
261261
{
262-
match self.by_name.find_equiv(lint_name) {
262+
match self.by_name.get(lint_name) {
263263
Some(&Id(lint_id)) => Some(lint_id),
264264
Some(&Renamed(ref new_name, lint_id)) => {
265265
let warning = format!("lint {} has been renamed to {}",
@@ -282,7 +282,7 @@ impl LintStore {
282282
match self.lint_groups.iter().map(|(&x, pair)| (x, pair.ref0().clone()))
283283
.collect::<FnvHashMap<&'static str,
284284
Vec<LintId>>>()
285-
.find_equiv(lint_name.as_slice()) {
285+
.get(lint_name.as_slice()) {
286286
Some(v) => {
287287
v.iter()
288288
.map(|lint_id: &LintId|
@@ -489,7 +489,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
489489
match self.lints.find_lint(lint_name.get(), &self.tcx.sess, Some(span)) {
490490
Some(lint_id) => vec![(lint_id, level, span)],
491491
None => {
492-
match self.lints.lint_groups.find_equiv(lint_name.get()) {
492+
match self.lints.lint_groups.get(lint_name.get()) {
493493
Some(&(ref v, _)) => v.iter()
494494
.map(|lint_id: &LintId|
495495
(*lint_id, level, span))

branches/auto/src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn existing_match(e: &Env, name: &str,
321321
// `source` stores paths which are normalized which may be different
322322
// from the strings on the command line.
323323
let source = e.sess.cstore.get_used_crate_source(cnum).unwrap();
324-
match e.sess.opts.externs.find_equiv(name) {
324+
match e.sess.opts.externs.get(name) {
325325
Some(locs) => {
326326
let found = locs.iter().any(|l| {
327327
let l = fs::realpath(&Path::new(l.as_slice())).ok();

branches/auto/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ fn item_path(item_doc: rbml::Doc) -> Vec<ast_map::PathElem> {
298298
fn item_name(intr: &IdentInterner, item: rbml::Doc) -> ast::Name {
299299
let name = reader::get_doc(item, tag_paths_data_name);
300300
let string = name.as_str_slice();
301-
match intr.find_equiv(string) {
301+
match intr.find(string) {
302302
None => token::intern(string),
303303
Some(val) => val,
304304
}
@@ -1449,4 +1449,3 @@ pub fn is_associated_type(cdata: Cmd, id: ast::NodeId) -> bool {
14491449
Some(item) => item_sort(item) == 't',
14501450
}
14511451
}
1452-

branches/auto/src/librustc/metadata/filesearch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'a> FileSearch<'a> {
5454
debug!("filesearch: searching lib path");
5555
let tlib_path = make_target_lib_path(self.sysroot,
5656
self.triple);
57-
if !visited_dirs.contains_equiv(tlib_path.as_vec()) {
57+
if !visited_dirs.contains(tlib_path.as_vec()) {
5858
match f(&tlib_path) {
5959
FileMatches => found = true,
6060
FileDoesntMatch => ()
@@ -69,9 +69,9 @@ impl<'a> FileSearch<'a> {
6969
let tlib_path = make_rustpkg_lib_path(
7070
self.sysroot, path, self.triple);
7171
debug!("is {} in visited_dirs? {}", tlib_path.display(),
72-
visited_dirs.contains_equiv(&tlib_path.as_vec().to_vec()));
72+
visited_dirs.contains(&tlib_path.as_vec().to_vec()));
7373

74-
if !visited_dirs.contains_equiv(tlib_path.as_vec()) {
74+
if !visited_dirs.contains(tlib_path.as_vec()) {
7575
visited_dirs.insert(tlib_path.as_vec().to_vec());
7676
// Don't keep searching the RUST_PATH if one match turns up --
7777
// if we did, we'd get a "multiple matching crates" error

branches/auto/src/librustc/metadata/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ impl<'a> Context<'a> {
596596
}
597597

598598
fn find_commandline_library(&mut self) -> Option<Library> {
599-
let locs = match self.sess.opts.externs.find_equiv(self.crate_name) {
599+
let locs = match self.sess.opts.externs.get(self.crate_name) {
600600
Some(s) => s,
601601
None => return None,
602602
};

branches/auto/src/librustc/middle/lang_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a, 'v> Visitor<'v> for LanguageItemCollector<'a> {
132132
fn visit_item(&mut self, item: &ast::Item) {
133133
match extract(item.attrs.as_slice()) {
134134
Some(value) => {
135-
let item_index = self.item_refs.find_equiv(&value).map(|x| *x);
135+
let item_index = self.item_refs.get(value.get()).map(|x| *x);
136136

137137
match item_index {
138138
Some(item_index) => {

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub fn get_extern_fn(ccx: &CrateContext,
216216
ty: Type,
217217
output: ty::t)
218218
-> ValueRef {
219-
match externs.find_equiv(name) {
219+
match externs.get(name) {
220220
Some(n) => return *n,
221221
None => {}
222222
}
@@ -226,7 +226,7 @@ pub fn get_extern_fn(ccx: &CrateContext,
226226
}
227227

228228
fn get_extern_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str, did: ast::DefId) -> ValueRef {
229-
match ccx.externs().borrow().find_equiv(name) {
229+
match ccx.externs().borrow().get(name) {
230230
Some(n) => return *n,
231231
None => ()
232232
}
@@ -2983,7 +2983,7 @@ fn internalize_symbols(cx: &SharedCrateContext, reachable: &HashSet<String>) {
29832983

29842984
let name = CString::new(llvm::LLVMGetValueName(val), false);
29852985
if !declared.contains(&name) &&
2986-
!reachable.contains_equiv(name.as_str().unwrap()) {
2986+
!reachable.contains(name.as_str().unwrap()) {
29872987
llvm::SetLinkage(val, llvm::InternalLinkage);
29882988
}
29892989
}

branches/auto/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ fn declare_local(bcx: Block,
16771677
}
16781678

16791679
fn file_metadata(cx: &CrateContext, full_path: &str) -> DIFile {
1680-
match debug_context(cx).created_files.borrow().find_equiv(full_path) {
1680+
match debug_context(cx).created_files.borrow().get(full_path) {
16811681
Some(file_metadata) => return *file_metadata,
16821682
None => ()
16831683
}

branches/auto/src/librustc/middle/trans/type_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl TypeNames {
336336
}
337337

338338
pub fn find_type(&self, s: &str) -> Option<Type> {
339-
self.named_types.borrow().find_equiv(s).map(|x| Type::from_ref(*x))
339+
self.named_types.borrow().get(s).map(|x| Type::from_ref(*x))
340340
}
341341

342342
pub fn type_to_string(&self, ty: Type) -> String {

branches/auto/src/librustdoc/html/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
21222122

21232123
fn block(w: &mut fmt::Formatter, short: &str, longty: &str,
21242124
cur: &clean::Item, cx: &Context) -> fmt::Result {
2125-
let items = match cx.sidebar.find_equiv(short) {
2125+
let items = match cx.sidebar.get(short) {
21262126
Some(items) => items.as_slice(),
21272127
None => return Ok(())
21282128
};

branches/auto/src/libserialize/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ impl Json {
901901
/// Otherwise, returns None.
902902
pub fn find<'a>(&'a self, key: &str) -> Option<&'a Json>{
903903
match self {
904-
&Object(ref map) => map.find_with(|s| key.cmp(s.as_slice())),
904+
&Object(ref map) => map.get(key),
905905
_ => None
906906
}
907907
}
@@ -926,7 +926,7 @@ impl Json {
926926
pub fn search<'a>(&'a self, key: &str) -> Option<&'a Json> {
927927
match self {
928928
&Object(ref map) => {
929-
match map.find_with(|s| key.cmp(s.as_slice())) {
929+
match map.get(key) {
930930
Some(json_value) => Some(json_value),
931931
None => {
932932
for (_, v) in map.iter() {

branches/auto/src/libstd/collections/hash/map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,11 +1944,11 @@ mod test_map {
19441944
m.insert("baz".to_string(), baz);
19451945

19461946

1947-
assert_eq!(m.find_equiv("foo"), Some(&foo));
1948-
assert_eq!(m.find_equiv("bar"), Some(&bar));
1949-
assert_eq!(m.find_equiv("baz"), Some(&baz));
1947+
assert_eq!(m.get("foo"), Some(&foo));
1948+
assert_eq!(m.get("bar"), Some(&bar));
1949+
assert_eq!(m.get("baz"), Some(&baz));
19501950

1951-
assert_eq!(m.find_equiv("qux"), None);
1951+
assert_eq!(m.get("qux"), None);
19521952
}
19531953

19541954
#[test]

branches/auto/src/libsyntax/diagnostics/registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ impl Registry {
2020
}
2121

2222
pub fn find_description(&self, code: &str) -> Option<&'static str> {
23-
self.descriptions.find_equiv(code).map(|desc| *desc)
23+
self.descriptions.get(code).map(|desc| *desc)
2424
}
2525
}

branches/auto/src/libsyntax/ext/format.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool,
144144
let name = interned_name.get();
145145
p.expect(&token::Eq);
146146
let e = p.parse_expr();
147-
match names.find_equiv(name) {
147+
match names.get(name) {
148148
None => {}
149149
Some(prev) => {
150150
ecx.span_err(e.span,
@@ -366,7 +366,7 @@ impl<'a, 'b> Context<'a, 'b> {
366366
self.ecx.expr_path(path)
367367
}
368368
parse::CountIsName(n) => {
369-
let i = match self.name_positions.find_equiv(n) {
369+
let i = match self.name_positions.get(n) {
370370
Some(&i) => i,
371371
None => 0, // error already emitted elsewhere
372372
};
@@ -410,7 +410,7 @@ impl<'a, 'b> Context<'a, 'b> {
410410
// Named arguments are converted to positional arguments at
411411
// the end of the list of arguments
412412
parse::ArgumentNamed(n) => {
413-
let i = match self.name_positions.find_equiv(n) {
413+
let i = match self.name_positions.get(n) {
414414
Some(&i) => i,
415415
None => 0, // error already emitted elsewhere
416416
};

branches/auto/src/libsyntax/util/interner.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
1515
use ast::Name;
1616

17+
use std::borrow::BorrowFrom;
1718
use std::collections::HashMap;
1819
use std::cell::RefCell;
19-
use std::cmp::Equiv;
2020
use std::fmt;
2121
use std::hash::Hash;
2222
use std::rc::Rc;
@@ -75,9 +75,10 @@ impl<T: Eq + Hash + Clone + 'static> Interner<T> {
7575
(*vect).len()
7676
}
7777

78-
pub fn find_equiv<Sized? Q: Hash + Equiv<T>>(&self, val: &Q) -> Option<Name> {
78+
pub fn find<Sized? Q>(&self, val: &Q) -> Option<Name>
79+
where Q: BorrowFrom<T> + Eq + Hash {
7980
let map = self.map.borrow();
80-
match (*map).find_equiv(val) {
81+
match (*map).get(val) {
8182
Some(v) => Some(*v),
8283
None => None,
8384
}
@@ -117,6 +118,12 @@ impl fmt::Show for RcStr {
117118
}
118119
}
119120

121+
impl BorrowFrom<RcStr> for str {
122+
fn borrow_from(owned: &RcStr) -> &str {
123+
owned.string.as_slice()
124+
}
125+
}
126+
120127
impl RcStr {
121128
pub fn new(string: &str) -> RcStr {
122129
RcStr {
@@ -149,7 +156,7 @@ impl StrInterner {
149156

150157
pub fn intern(&self, val: &str) -> Name {
151158
let mut map = self.map.borrow_mut();
152-
match map.find_equiv(val) {
159+
match map.get(val) {
153160
Some(&idx) => return idx,
154161
None => (),
155162
}
@@ -195,8 +202,9 @@ impl StrInterner {
195202
self.vect.borrow().len()
196203
}
197204

198-
pub fn find_equiv<Sized? Q:Hash + Equiv<RcStr>>(&self, val: &Q) -> Option<Name> {
199-
match (*self.map.borrow()).find_equiv(val) {
205+
pub fn find<Sized? Q>(&self, val: &Q) -> Option<Name>
206+
where Q: BorrowFrom<RcStr> + Eq + Hash {
207+
match (*self.map.borrow()).get(val) {
200208
Some(v) => Some(*v),
201209
None => None,
202210
}

branches/auto/src/libterm/terminfo/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<T: Writer+Send> Terminal<T> for TerminfoTerminal<T> {
7878
if self.num_colors > color {
7979
let s = expand(self.ti
8080
.strings
81-
.find_equiv("setaf")
81+
.get("setaf")
8282
.unwrap()
8383
.as_slice(),
8484
&[Number(color as int)], &mut Variables::new());
@@ -95,7 +95,7 @@ impl<T: Writer+Send> Terminal<T> for TerminfoTerminal<T> {
9595
if self.num_colors > color {
9696
let s = expand(self.ti
9797
.strings
98-
.find_equiv("setab")
98+
.get("setab")
9999
.unwrap()
100100
.as_slice(),
101101
&[Number(color as int)], &mut Variables::new());
@@ -113,7 +113,7 @@ impl<T: Writer+Send> Terminal<T> for TerminfoTerminal<T> {
113113
attr::BackgroundColor(c) => self.bg(c),
114114
_ => {
115115
let cap = cap_for_attr(attr);
116-
let parm = self.ti.strings.find_equiv(cap);
116+
let parm = self.ti.strings.get(cap);
117117
if parm.is_some() {
118118
let s = expand(parm.unwrap().as_slice(),
119119
&[],
@@ -135,19 +135,19 @@ impl<T: Writer+Send> Terminal<T> for TerminfoTerminal<T> {
135135
}
136136
_ => {
137137
let cap = cap_for_attr(attr);
138-
self.ti.strings.find_equiv(cap).is_some()
138+
self.ti.strings.get(cap).is_some()
139139
}
140140
}
141141
}
142142

143143
fn reset(&mut self) -> IoResult<()> {
144-
let mut cap = self.ti.strings.find_equiv("sgr0");
144+
let mut cap = self.ti.strings.get("sgr0");
145145
if cap.is_none() {
146146
// are there any terminals that have color/attrs and not sgr0?
147147
// Try falling back to sgr, then op
148-
cap = self.ti.strings.find_equiv("sgr");
148+
cap = self.ti.strings.get("sgr");
149149
if cap.is_none() {
150-
cap = self.ti.strings.find_equiv("op");
150+
cap = self.ti.strings.get("op");
151151
}
152152
}
153153
let s = cap.map_or(Err("can't find terminfo capability `sgr0`".to_string()), |op| {
@@ -202,9 +202,9 @@ impl<T: Writer+Send> TerminfoTerminal<T> {
202202
}
203203

204204
let inf = ti.unwrap();
205-
let nc = if inf.strings.find_equiv("setaf").is_some()
206-
&& inf.strings.find_equiv("setab").is_some() {
207-
inf.numbers.find_equiv("colors").map_or(0, |&n| n)
205+
let nc = if inf.strings.get("setaf").is_some()
206+
&& inf.strings.get("setab").is_some() {
207+
inf.numbers.get("colors").map_or(0, |&n| n)
208208
} else { 0 };
209209

210210
return Some(box TerminfoTerminal {out: out,

branches/auto/src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> String {
7676
// given a map, search for the frequency of a pattern
7777
fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint {
7878
let key = key.into_ascii().as_slice().to_lowercase().into_string();
79-
match mm.find_equiv(key.as_bytes()) {
79+
match mm.get(key.as_bytes()) {
8080
option::None => { return 0u; }
8181
option::Some(&num) => { return num; }
8282
}

0 commit comments

Comments
 (0)