Skip to content

Commit 15f8a8e

Browse files
committed
---
yaml --- r: 51077 b: refs/heads/try c: d7ba0ac h: refs/heads/master i: 51075: b25a428 v: v3
1 parent befcf45 commit 15f8a8e

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: 84ddff3909b5920228642649b7f5cc011c0b900a
5+
refs/heads/try: d7ba0acbf5aef70cb4afd162e0c0a1fa07813db7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/resolve.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,7 +4666,7 @@ pub impl Resolver {
46664666
}
46674667
}
46684668
4669-
fn find_best_match_for_name(@mut self, name: &str) -> Option<~str> {
4669+
fn find_best_match_for_name(@mut self, name: &str, max_distance: uint) -> Option<~str> {
46704670
let this = &mut *self;
46714671
46724672
let mut maybes: ~[~str] = ~[];
@@ -4694,6 +4694,7 @@ pub impl Resolver {
46944694
if vec::len(values) > 0 &&
46954695
values[smallest] != uint::max_value &&
46964696
values[smallest] < str::len(name) + 2 &&
4697+
values[smallest] <= max_distance &&
46974698
maybes[smallest] != name.to_owned() {
46984699
46994700
Some(vec::swap_remove(&mut maybes, smallest))
@@ -4770,8 +4771,9 @@ pub impl Resolver {
47704771
wrong_name));
47714772
}
47724773
else {
4773-
match self.find_best_match_for_name(wrong_name) {
4774-
4774+
// limit search to 5 to reduce the number
4775+
// of stupid suggestions
4776+
match self.find_best_match_for_name(wrong_name, 5) {
47754777
Some(m) => {
47764778
self.session.span_err(expr.span,
47774779
fmt!("unresolved name: `%s`. \
@@ -5292,4 +5294,3 @@ pub fn resolve_crate(session: Session,
52925294
trait_map: trait_map
52935295
}
52945296
}
5295-
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); }

0 commit comments

Comments
 (0)