Skip to content

Commit e0c7e4c

Browse files
committed
---
yaml --- r: 60186 b: refs/heads/master c: f04eb37 h: refs/heads/master v: v3
1 parent 8491b7a commit e0c7e4c

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3e106cf2c2556be6bbcd9a93e5ef2a73b98f0e7a
2+
refs/heads/master: f04eb37c7ea19bbd2cff12d15816873e0a46fc86
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/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
}

trunk/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)