Skip to content

Commit f7397fa

Browse files
committed
---
yaml --- r: 58300 b: refs/heads/auto c: f04eb37 h: refs/heads/master v: v3
1 parent e2e9dc0 commit f7397fa

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
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 3e106cf2c2556be6bbcd9a93e5ef2a73b98f0e7a
17+
refs/heads/auto: f04eb37c7ea19bbd2cff12d15816873e0a46fc86
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/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/auto/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)