Skip to content

Commit 6422cef

Browse files
author
Jakub Wieczorek
committed
---
yaml --- r: 152178 b: refs/heads/try2 c: 80e84e0 h: refs/heads/master v: v3
1 parent 65dddac commit 6422cef

File tree

9 files changed

+602
-24
lines changed

9 files changed

+602
-24
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b38712071efd09fd602cef6a11621db09672f990
8+
refs/heads/try2: 80e84e00010ee8a1c924619e6834d4a51eaf0f34
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
5353
uuid serialize sync getopts collections num test time rand \
54-
url log regex graphviz core rlibc alloc debug
54+
workcache url log regex graphviz core rlibc alloc debug
5555
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
5656
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5757
TOOLS := compiletest rustdoc rustc
@@ -88,6 +88,7 @@ DEPS_test := std collections getopts serialize term time regex
8888
DEPS_time := std serialize sync
8989
DEPS_rand := core
9090
DEPS_url := std collections
91+
DEPS_workcache := std serialize collections log
9192
DEPS_log := std sync
9293
DEPS_regex := std collections
9394
DEPS_regex_macros = syntax std regex

branches/try2/src/doc/guide-ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# Introduction
44

5-
This guide will use the [snappy](https://github.com/google/snappy)
5+
This guide will use the [snappy](https://code.google.com/p/snappy/)
66
compression/decompression library as an introduction to writing bindings for
77
foreign code. Rust is currently unable to call directly into a C++ library, but
88
snappy includes a C interface (documented in
9-
[`snappy-c.h`](https://github.com/google/snappy/blob/master/snappy-c.h)).
9+
[`snappy-c.h`](https://code.google.com/p/snappy/source/browse/trunk/snappy-c.h)).
1010

1111
The following is a minimal example of calling a foreign function which will
1212
compile if snappy is installed:

branches/try2/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ impl<'a> CheckLoanCtxt<'a> {
638638
loan_path = match *loan_path {
639639
// Peel back one layer if, for `loan_path` to be
640640
// mutable, `lp_base` must be mutable. This occurs
641-
// with inherited mutability, owned pointers and
642-
// `&mut` pointers.
641+
// with inherited mutability and with `&mut`
642+
// pointers.
643643
LpExtend(ref lp_base, mc::McInherited, _) |
644644
LpExtend(ref lp_base, _, LpDeref(mc::OwnedPtr)) |
645645
LpExtend(ref lp_base, _, LpDeref(mc::GcPtr)) |

branches/try2/src/librustc/middle/typeck/check/_match.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,8 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
298298
/// `etc` is true if the pattern said '...' and false otherwise.
299299
pub fn check_struct_pat_fields(pcx: &pat_ctxt,
300300
span: Span,
301-
path: &ast::Path,
302301
fields: &[ast::FieldPat],
303-
class_fields: Vec<ty::field_ty> ,
302+
class_fields: Vec<ty::field_ty>,
304303
class_id: ast::DefId,
305304
substitutions: &ty::substs,
306305
etc: bool) {
@@ -333,13 +332,12 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
333332
found_fields.insert(index);
334333
}
335334
None => {
336-
let name = pprust::path_to_str(path);
337335
// Check the pattern anyway, so that attempts to look
338336
// up its type won't fail
339337
check_pat(pcx, field.pat, ty::mk_err());
340338
tcx.sess.span_err(span,
341339
format!("struct `{}` does not have a field named `{}`",
342-
name,
340+
ty::item_path_str(tcx, class_id),
343341
token::get_ident(field.ident)).as_slice());
344342
}
345343
}
@@ -390,7 +388,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: Span,
390388
}
391389
}
392390

393-
check_struct_pat_fields(pcx, span, path, fields, class_fields, struct_id,
391+
check_struct_pat_fields(pcx, span, fields, class_fields, struct_id,
394392
substitutions, etc);
395393
}
396394

@@ -413,7 +411,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
413411
// Get the struct fields from this struct-like enum variant.
414412
let class_fields = ty::lookup_struct_fields(tcx, variant_id);
415413

416-
check_struct_pat_fields(pcx, span, path, fields, class_fields,
414+
check_struct_pat_fields(pcx, span, fields, class_fields,
417415
variant_id, substitutions, etc);
418416
}
419417
Some(&ast::DefStruct(..)) | Some(&ast::DefVariant(..)) => {

branches/try2/src/librustc/middle/typeck/check/method.rs

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,13 @@ impl<'a> LookupContext<'a> {
10261026
fn consider_candidates(&self, rcvr_ty: ty::t,
10271027
candidates: &[Candidate])
10281028
-> Option<MethodCallee> {
1029-
let relevant_candidates = self.filter_candidates(rcvr_ty, candidates);
1029+
// FIXME(pcwalton): Do we need to clone here?
1030+
let relevant_candidates: Vec<Candidate> =
1031+
candidates.iter().map(|c| (*c).clone()).
1032+
filter(|c| self.is_relevant(rcvr_ty, c)).collect();
1033+
1034+
let relevant_candidates =
1035+
self.merge_candidates(relevant_candidates.as_slice());
10301036

10311037
if relevant_candidates.len() == 0 {
10321038
return None;
@@ -1063,16 +1069,22 @@ impl<'a> LookupContext<'a> {
10631069
Some(self.confirm_candidate(rcvr_ty, relevant_candidates.get(0)))
10641070
}
10651071

1066-
fn filter_candidates(&self, rcvr_ty: ty::t, candidates: &[Candidate]) -> Vec<Candidate> {
1067-
let mut relevant_candidates: Vec<Candidate> = Vec::new();
1072+
fn merge_candidates(&self, candidates: &[Candidate]) -> Vec<Candidate> {
1073+
let mut merged = Vec::new();
1074+
let mut i = 0;
1075+
while i < candidates.len() {
1076+
let candidate_a = &candidates[i];
1077+
1078+
let mut skip = false;
10681079

1069-
for candidate_a in candidates.iter().filter(|&c| self.is_relevant(rcvr_ty, c)) {
1070-
// Skip this one if we already have one like it
1071-
if !relevant_candidates.iter().any(|candidate_b| {
1080+
let mut j = i + 1;
1081+
while j < candidates.len() {
1082+
let candidate_b = &candidates[j];
10721083
debug!("attempting to merge {} and {}",
10731084
candidate_a.repr(self.tcx()),
10741085
candidate_b.repr(self.tcx()));
1075-
match (&candidate_a.origin, &candidate_b.origin) {
1086+
let candidates_same = match (&candidate_a.origin,
1087+
&candidate_b.origin) {
10761088
(&MethodParam(ref p1), &MethodParam(ref p2)) => {
10771089
let same_trait = p1.trait_id == p2.trait_id;
10781090
let same_method = p1.method_num == p2.method_num;
@@ -1083,13 +1095,25 @@ impl<'a> LookupContext<'a> {
10831095
same_trait && same_method && same_param
10841096
}
10851097
_ => false
1098+
};
1099+
if candidates_same {
1100+
skip = true;
1101+
break;
10861102
}
1087-
}) {
1088-
relevant_candidates.push(candidate_a.clone());
1103+
j += 1;
1104+
}
1105+
1106+
i += 1;
1107+
1108+
if skip {
1109+
// There are more than one of these and we need only one
1110+
continue;
1111+
} else {
1112+
merged.push(candidate_a.clone());
10891113
}
10901114
}
10911115

1092-
relevant_candidates
1116+
return merged;
10931117
}
10941118

10951119
fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)

branches/try2/src/liburl/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ fn query_from_str(rawquery: &str) -> Query {
452452
*
453453
* ```rust
454454
* let query = vec!(("title".to_string(), "The Village".to_string()),
455-
* ("north".to_string(), "52.91".to_string()),
456-
* ("west".to_string(), "4.10".to_string()));
455+
("north".to_string(), "52.91".to_string()),
456+
("west".to_string(), "4.10".to_string()));
457457
* println!("{}", url::query_to_str(&query)); // title=The%20Village&north=52.91&west=4.10
458458
* ```
459459
*/

0 commit comments

Comments
 (0)