auto merge of #6485 : cmr/rust/local_rename_import_error, r=catamorphism

This commit is contained in:
bors 2013-05-15 05:43:58 -07:00
commit 62c7027a32
8 changed files with 36 additions and 13 deletions

View file

@ -2058,7 +2058,8 @@ pub impl Resolver {
self.resolve_single_import(module_,
containing_module,
target,
source);
source,
import_directive.span);
}
GlobImport => {
let span = import_directive.span;
@ -2121,7 +2122,8 @@ pub impl Resolver {
module_: @mut Module,
containing_module: @mut Module,
target: ident,
source: ident)
source: ident,
span: span)
-> ResolveResult<()> {
debug!("(resolving single import) resolving `%s` = `%s::%s` from \
`%s`",
@ -2325,14 +2327,14 @@ pub impl Resolver {
}
if resolve_fail {
self.session.err(fmt!("unresolved import: there is no `%s` in `%s`",
*self.session.str_of(source),
self.module_to_str(containing_module)));
self.session.span_err(span, fmt!("unresolved import: there is no `%s` in `%s`",
*self.session.str_of(source),
self.module_to_str(containing_module)));
return Failed;
} else if priv_fail {
self.session.err(fmt!("unresolved import: found `%s` in `%s` but it is private",
*self.session.str_of(source),
self.module_to_str(containing_module)));
self.session.span_err(span, fmt!("unresolved import: found `%s` in `%s` but it is \
private", *self.session.str_of(source),
self.module_to_str(containing_module)));
return Failed;
}
@ -2593,7 +2595,18 @@ pub impl Resolver {
let start_index;
match module_prefix_result {
Failed => {
self.session.span_err(span, ~"unresolved name");
let mpath = self.idents_to_str(module_path);
match str::rfind(self.idents_to_str(module_path), |c| { c == ':' }) {
Some(idx) => {
self.session.span_err(span, fmt!("unresolved import: could not find `%s` \
in `%s`", str::substr(mpath, idx,
mpath.len() - idx),
// idx - 1 to account for the extra
// colon
str::substr(mpath, 0, idx - 1)));
},
None => (),
};
return Failed;
}
Indeterminate => {

View file

@ -9,6 +9,7 @@
// except according to those terms.
use x = m::f; //~ ERROR failed to resolve import
//~^ unresolved import: there is no `f` in `m`
mod m {
}

View file

@ -9,6 +9,7 @@
// except according to those terms.
use x = m::f; //~ ERROR failed to resolve import
//~^ ERROR unresolved import: there is no `f` in `m`
mod m {
}

View file

@ -9,6 +9,7 @@
// except according to those terms.
use zoo::{duck, goose}; //~ ERROR failed to resolve import
//~^ ERROR unresolved import: found `goose` in `zoo` but it is private
mod zoo {
pub enum bird {

View file

@ -9,6 +9,7 @@
// except according to those terms.
use zoo::fly; //~ ERROR failed to resolve import
//~^ ERROR unresolved import: found `fly` in `zoo` but it is private
mod zoo {
priv type fly = ();

View file

@ -9,6 +9,7 @@
// except according to those terms.
use zoo::fly; //~ ERROR failed to resolve import
//~^ ERROR unresolved import: found `fly` in `zoo` but it is private
mod zoo {
priv fn fly() {}

View file

@ -1,5 +1,4 @@
use super::f; //~ ERROR unresolved name
//~^ ERROR failed to resolve import
use super::f; //~ ERROR failed to resolve import
fn main() {
}

View file

@ -8,5 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use foo::bar; //~ ERROR unresolved import. maybe a missing
//~^ ERROR failed to resolve import
use foo::bar; //~ ERROR unresolved import. maybe a missing `extern mod foo`?
//~^ ERROR failed to resolve import `foo::bar`
use x = bar::baz; //~ ERROR unresolved import: there is no `baz` in `bar`
//~^ ERROR failed to resolve import `bar::baz`
mod bar {
struct bar;
}