Updated E0432 to new format
This commit is contained in:
parent
820c810107
commit
a4c6307a15
@ -418,10 +418,14 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
|
||||
}
|
||||
ResolutionError::UnresolvedImport(name) => {
|
||||
let msg = match name {
|
||||
Some((n, p)) => format!("unresolved import `{}`{}", n, p),
|
||||
Some((n, _)) => format!("unresolved import `{}`", n),
|
||||
None => "unresolved import".to_owned(),
|
||||
};
|
||||
struct_span_err!(resolver.session, span, E0432, "{}", msg)
|
||||
let mut err = struct_span_err!(resolver.session, span, E0432, "{}", msg);
|
||||
if let Some((_, p)) = name {
|
||||
err.span_label(span, &p);
|
||||
}
|
||||
err
|
||||
}
|
||||
ResolutionError::FailedToResolve(msg) => {
|
||||
let mut err = struct_span_err!(resolver.session, span, E0433,
|
||||
|
@ -423,7 +423,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||
if let Failed(err) = self.finalize_import(import) {
|
||||
errors = true;
|
||||
let (span, help) = match err {
|
||||
Some((span, msg)) => (span, format!(". {}", msg)),
|
||||
Some((span, msg)) => (span, msg),
|
||||
None => (import.span, String::new()),
|
||||
};
|
||||
|
||||
@ -596,9 +596,9 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||
};
|
||||
let module_str = module_to_string(module);
|
||||
let msg = if &module_str == "???" {
|
||||
format!("There is no `{}` in the crate root{}", name, lev_suggestion)
|
||||
format!("no `{}` in the root{}", name, lev_suggestion)
|
||||
} else {
|
||||
format!("There is no `{}` in `{}`{}", name, module_str, lev_suggestion)
|
||||
format!("no `{}` in `{}`{}", name, module_str, lev_suggestion)
|
||||
};
|
||||
Failed(Some((directive.span, msg)))
|
||||
} else {
|
||||
|
@ -8,8 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use spam::{ham, eggs};
|
||||
//~^ ERROR unresolved import `spam::eggs`. There is no `eggs` in `spam`
|
||||
use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432]
|
||||
//~^ no `eggs` in `spam`
|
||||
|
||||
mod spam {
|
||||
pub fn ham() { }
|
||||
|
@ -9,13 +9,14 @@
|
||||
// except according to those terms.
|
||||
|
||||
use zed::bar;
|
||||
use zed::baz;
|
||||
//~^ ERROR unresolved import `zed::baz`. There is no `baz` in `zed`
|
||||
use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432]
|
||||
//~^ no `baz` in `zed`. Did you mean to use `bar`?
|
||||
|
||||
|
||||
mod zed {
|
||||
pub fn bar() { println!("bar"); }
|
||||
use foo; //~ ERROR unresolved import
|
||||
use foo; //~ ERROR unresolved import `foo` [E0432]
|
||||
//~^ no `foo` in the root
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -8,8 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use baz::zed::bar;
|
||||
//~^ ERROR unresolved import `baz::zed::bar`. Could not find `zed` in `baz`
|
||||
use baz::zed::bar; //~ ERROR unresolved import `baz::zed::bar` [E0432]
|
||||
//~^ Could not find `zed` in `baz`
|
||||
|
||||
mod baz {}
|
||||
mod zed {
|
||||
|
@ -15,8 +15,8 @@ extern crate issue_12612_1 as foo;
|
||||
use foo::bar;
|
||||
|
||||
mod test {
|
||||
use bar::foo;
|
||||
//~^ ERROR unresolved import `bar::foo`. Maybe a missing `extern crate bar`?
|
||||
use bar::foo; //~ ERROR unresolved import `bar::foo` [E0432]
|
||||
//~^ Maybe a missing `extern crate bar`?
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -9,8 +9,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
use a::f;
|
||||
use b::f;
|
||||
//~^ ERROR: unresolved import `b::f`. There is no `f` in `b`
|
||||
use b::f; //~ ERROR: unresolved import `b::f` [E0432]
|
||||
//~^ no `f` in `b`
|
||||
|
||||
mod a { pub fn f() {} }
|
||||
mod b { }
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
// Testing that we don't fail abnormally after hitting the errors
|
||||
|
||||
use unresolved::*; //~ ERROR unresolved import `unresolved::*`. Maybe a missing `extern crate unres
|
||||
use unresolved::*; //~ ERROR unresolved import `unresolved::*` [E0432]
|
||||
//~^ Maybe a missing `extern crate unresolved`?
|
||||
|
||||
fn main() {}
|
||||
|
@ -8,7 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use m::f as x; //~ ERROR unresolved import `m::f`. There is no `f` in `m`
|
||||
use m::f as x; //~ ERROR unresolved import `m::f` [E0432]
|
||||
//~^ no `f` in `m`
|
||||
|
||||
mod m {}
|
||||
|
||||
|
@ -9,8 +9,12 @@
|
||||
// except according to those terms.
|
||||
|
||||
type Alias = ();
|
||||
use Alias::*; //~ ERROR Not a module
|
||||
use std::io::Result::*; //~ ERROR Not a module
|
||||
use Alias::*;
|
||||
//~^ ERROR unresolved import `Alias::*` [E0432]
|
||||
//~| Not a module `Alias`
|
||||
use std::io::Result::*;
|
||||
//~^ ERROR unresolved import `std::io::Result::*` [E0432]
|
||||
//~| Not a module `Result`
|
||||
|
||||
trait T {}
|
||||
use T::*; //~ ERROR items in traits are not importable
|
||||
|
@ -8,9 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use bar::Foo; //~ ERROR There is no `Foo` in `bar` [E0432]
|
||||
use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432]
|
||||
//~^ no `Foo` in `bar`
|
||||
mod bar {
|
||||
use Foo; //~ ERROR There is no `Foo` in the crate root [E0432]
|
||||
use Foo; //~ ERROR unresolved import `Foo` [E0432]
|
||||
//~^ no `Foo` in the root
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -14,7 +14,8 @@ impl K for isize {} //~ ERROR: `K` is not a trait
|
||||
//~| NOTE: not a trait
|
||||
//~| NOTE: aliases cannot be used for traits
|
||||
|
||||
use ImportError; //~ ERROR unresolved
|
||||
use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
|
||||
//~^ no `ImportError` in the root
|
||||
impl ImportError for () {} // check that this is not an additional error (c.f. #35142)
|
||||
|
||||
fn main() {}
|
||||
|
@ -8,14 +8,17 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use self::*; //~ ERROR: unresolved import `self::*`. Cannot glob-import a module into itself.
|
||||
use self::*; //~ ERROR: unresolved import `self::*` [E0432]
|
||||
//~^ Cannot glob-import a module into itself.
|
||||
|
||||
mod foo {
|
||||
use foo::*; //~ ERROR: unresolved import `foo::*`. Cannot glob-import a module into itself.
|
||||
use foo::*; //~ ERROR: unresolved import `foo::*` [E0432]
|
||||
//~^ Cannot glob-import a module into itself.
|
||||
|
||||
mod bar {
|
||||
use super::bar::*;
|
||||
//~^ ERROR: unresolved import `super::bar::*`. Cannot glob-import a module into itself.
|
||||
//~^ ERROR: unresolved import `super::bar::*` [E0432]
|
||||
//~| Cannot glob-import a module into itself.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,12 +25,14 @@ pub fn foo() {}
|
||||
|
||||
fn test1() {
|
||||
use bar::foo;
|
||||
//~^ ERROR unresolved import `bar::foo`. There is no `foo` in `bar`
|
||||
//~^ ERROR unresolved import `bar::foo` [E0432]
|
||||
//~| no `foo` in `bar`
|
||||
}
|
||||
|
||||
fn test2() {
|
||||
use bar::glob::foo;
|
||||
//~^ ERROR unresolved import `bar::glob::foo`. There is no `foo` in `bar::glob`
|
||||
//~^ ERROR unresolved import `bar::glob::foo` [E0432]
|
||||
//~| no `foo` in `bar::glob`
|
||||
}
|
||||
|
||||
#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }
|
||||
|
@ -26,7 +26,8 @@ pub fn foo() {}
|
||||
|
||||
fn test1() {
|
||||
use bar::gpriv;
|
||||
//~^ ERROR unresolved import `bar::gpriv`. There is no `gpriv` in `bar`
|
||||
//~^ ERROR unresolved import `bar::gpriv` [E0432]
|
||||
//~| no `gpriv` in `bar`
|
||||
|
||||
// This should pass because the compiler will insert a fake name binding
|
||||
// for `gpriv`
|
||||
|
@ -11,16 +11,20 @@
|
||||
mod a {
|
||||
extern crate collections;
|
||||
use collections::HashMap;
|
||||
//~^ ERROR unresolved import `collections::HashMap`. Did you mean `self::collections`?
|
||||
//~^ ERROR unresolved import `collections::HashMap` [E0432]
|
||||
//~| Did you mean `self::collections`?
|
||||
mod b {
|
||||
use collections::HashMap;
|
||||
//~^ ERROR unresolved import `collections::HashMap`. Did you mean `a::collections`?
|
||||
//~^ ERROR unresolved import `collections::HashMap` [E0432]
|
||||
//~| Did you mean `a::collections`?
|
||||
mod c {
|
||||
use collections::HashMap;
|
||||
//~^ ERROR unresolved import `collections::HashMap`. Did you mean `a::collections`?
|
||||
//~^ ERROR unresolved import `collections::HashMap` [E0432]
|
||||
//~| Did you mean `a::collections`?
|
||||
mod d {
|
||||
use collections::HashMap;
|
||||
//~^ ERROR unresolved import `collections::HashMap`. Did you mean `a::collections`?
|
||||
//~^ ERROR unresolved import `collections::HashMap` [E0432]
|
||||
//~| Did you mean `a::collections`?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use super::f; //~ ERROR unresolved import `super::f`. There are too many initial `super`s.
|
||||
use super::f; //~ ERROR unresolved import `super::f` [E0432]
|
||||
//~^ There are too many initial `super`s.
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
@ -10,13 +10,17 @@
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
use foo::bar; //~ ERROR unresolved import `foo::bar`. Maybe a missing `extern crate foo`?
|
||||
use foo::bar; //~ ERROR unresolved import `foo::bar` [E0432]
|
||||
//~^ Maybe a missing `extern crate foo`?
|
||||
|
||||
use bar::Baz as x; //~ ERROR unresolved import `bar::Baz`. There is no `Baz` in `bar`. Did you mean to use `Bar`?
|
||||
use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
|
||||
//~^ no `Baz` in `bar`. Did you mean to use `Bar`?
|
||||
|
||||
use food::baz; //~ ERROR unresolved import `food::baz`. There is no `baz` in `food`. Did you mean to use `bag`?
|
||||
use food::baz; //~ ERROR unresolved import `food::baz`
|
||||
//~^ no `baz` in `food`. Did you mean to use `bag`?
|
||||
|
||||
use food::{beens as Foo}; //~ ERROR unresolved import `food::beens`. There is no `beens` in `food`. Did you mean to use `beans`?
|
||||
use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432]
|
||||
//~^ no `beens` in `food`. Did you mean to use `beans`?
|
||||
|
||||
mod bar {
|
||||
pub struct Bar;
|
||||
|
@ -18,10 +18,12 @@ use Trait::C;
|
||||
//~^ ERROR `C` is not directly importable
|
||||
|
||||
use Foo::new;
|
||||
//~^ ERROR unresolved import `Foo::new`. Not a module `Foo`
|
||||
//~^ ERROR unresolved import `Foo::new` [E0432]
|
||||
//~| Not a module `Foo`
|
||||
|
||||
use Foo::C2;
|
||||
//~^ ERROR unresolved import `Foo::C2`. Not a module `Foo`
|
||||
//~^ ERROR unresolved import `Foo::C2` [E0432]
|
||||
//~| Not a module `Foo`
|
||||
|
||||
pub trait Trait {
|
||||
fn foo();
|
||||
|
@ -14,9 +14,14 @@
|
||||
mod a {
|
||||
mod b {
|
||||
use self as A; //~ ERROR `self` imports are only allowed within a { } list
|
||||
//~^ ERROR unresolved import `self`. There is no `self` in the crate root
|
||||
use super as B; //~ ERROR unresolved import `super`. There is no `super` in the crate root
|
||||
use super::{self as C}; //~ERROR unresolved import `super`. There is no `super` in the crate
|
||||
//~^ ERROR unresolved import `self` [E0432]
|
||||
//~| no `self` in the root
|
||||
use super as B;
|
||||
//~^ ERROR unresolved import `super` [E0432]
|
||||
//~| no `super` in the root
|
||||
use super::{self as C};
|
||||
//~^ ERROR unresolved import `super` [E0432]
|
||||
//~| no `super` in the root
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,12 @@
|
||||
|
||||
mod foo {
|
||||
use self::{self};
|
||||
//~^ ERROR unresolved import `self`. There is no `self` in the crate root
|
||||
//~^ ERROR unresolved import `self` [E0432]
|
||||
//~| no `self` in the root
|
||||
|
||||
use super::{self};
|
||||
//~^ ERROR unresolved import `super`. There is no `super` in the crate root
|
||||
//~^ ERROR unresolved import `super` [E0432]
|
||||
//~| no `super` in the root
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user