Skip to content

Commit 58e2983

Browse files
committed
---
yaml --- r: 54221 b: refs/heads/dist-snap c: ab5346d h: refs/heads/master i: 54219: 5668210 v: v3
1 parent a7ce8a2 commit 58e2983

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: b93393e907eddab513fa2be541af4356b8203282
10+
refs/heads/dist-snap: ab5346d119b6ac3ba9e9d67df929fdf546865d0a
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/resolve.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4667,7 +4667,7 @@ pub impl Resolver {
46674667
}
46684668
}
46694669
4670-
fn find_best_match_for_name(@mut self, name: &str) -> Option<~str> {
4670+
fn find_best_match_for_name(@mut self, name: &str, max_distance: uint) -> Option<~str> {
46714671
let this = &mut *self;
46724672
46734673
let mut maybes: ~[~str] = ~[];
@@ -4695,6 +4695,7 @@ pub impl Resolver {
46954695
if vec::len(values) > 0 &&
46964696
values[smallest] != uint::max_value &&
46974697
values[smallest] < str::len(name) + 2 &&
4698+
values[smallest] <= max_distance &&
46984699
maybes[smallest] != name.to_owned() {
46994700
47004701
Some(vec::swap_remove(&mut maybes, smallest))
@@ -4771,8 +4772,9 @@ pub impl Resolver {
47714772
wrong_name));
47724773
}
47734774
else {
4774-
match self.find_best_match_for_name(wrong_name) {
4775-
4775+
// limit search to 5 to reduce the number
4776+
// of stupid suggestions
4777+
match self.find_best_match_for_name(wrong_name, 5) {
47764778
Some(m) => {
47774779
self.session.span_err(expr.span,
47784780
fmt!("unresolved name: `%s`. \
@@ -5293,4 +5295,3 @@ pub fn resolve_crate(session: Session,
52935295
trait_map: trait_map
52945296
}
52955297
}
5296-
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: unresolved name: `foobar`.
12+
13+
fn main(args: ~[str]) { debug!(foobar); }

branches/dist-snap/src/test/run-pass/regions-fn-subtyping.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// xfail-pretty
2-
31
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
42
// file at the top-level directory of this distribution and at
53
// http://rust-lang.org/COPYRIGHT.

0 commit comments

Comments
 (0)