Skip to content

Commit b7ffe26

Browse files
committed
---
yaml --- r: 59041 b: refs/heads/incoming c: f04eb37 h: refs/heads/master i: 59039: 0539200 v: v3
1 parent 94afc94 commit b7ffe26

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 3e106cf2c2556be6bbcd9a93e5ef2a73b98f0e7a
9+
refs/heads/incoming: f04eb37c7ea19bbd2cff12d15816873e0a46fc86
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use syntax::attr::{attr_metas, contains_name, attrs_contains_name};
6464
use syntax::parse::token::ident_interner;
6565
use syntax::parse::token::special_idents;
6666
use syntax::print::pprust::path_to_str;
67-
use syntax::codemap::{span, dummy_sp};
67+
use syntax::codemap::{span, dummy_sp, BytePos};
6868
use syntax::visit::{default_visitor, mk_vt, Visitor, visit_block};
6969
use syntax::visit::{visit_crate, visit_expr, visit_expr_opt};
7070
use syntax::visit::{visit_foreign_item, visit_item};
@@ -2482,6 +2482,16 @@ pub impl Resolver {
24822482
TypeNS,
24832483
name_search_type) {
24842484
Failed => {
2485+
let segment_name = self.session.str_of(name);
2486+
let module_name = self.module_to_str(search_module);
2487+
if module_name == ~"???" {
2488+
self.session.span_err(span {lo: span.lo, hi: span.lo +
2489+
BytePos(str::len(*segment_name)), expn_info:
2490+
span.expn_info}, fmt!("unresolved import. maybe \
2491+
a missing 'extern mod %s'?",
2492+
*segment_name));
2493+
return Failed;
2494+
}
24852495
self.session.span_err(span, ~"unresolved name");
24862496
return Failed;
24872497
}

branches/incoming/src/test/compile-fail/issue-1697.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Testing that we don't fail abnormally after hitting the errors
1212

13-
use unresolved::*; //~ ERROR unresolved name
13+
use unresolved::*; //~ ERROR unresolved import. maybe a missing
1414
//~^ ERROR failed to resolve import
1515

1616
fn main() {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2013 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+
use foo::bar; //~ ERROR unresolved import. maybe a missing
12+
//~^ ERROR failed to resolve import

0 commit comments

Comments
 (0)