]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/unresolved-import.rs
Point at path segment on module not found
[rust.git] / src / test / compile-fail / unresolved-import.rs
1 // Copyright 2013-2015 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 // ignore-tidy-linelength
12
13 use foo::bar; //~ ERROR unresolved import `foo` [E0432]
14               //~^ Maybe a missing `extern crate foo;`?
15
16 use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
17                    //~^ no `Baz` in `bar`. Did you mean to use `Bar`?
18
19 use food::baz; //~ ERROR unresolved import `food::baz`
20                //~^ no `baz` in `food`. Did you mean to use `bag`?
21
22 use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432]
23                           //~^ no `beens` in `food`. Did you mean to use `beans`?
24
25 mod bar {
26     pub struct Bar;
27 }
28
29 mod food {
30     pub use self::zug::baz::{self as bag, foobar as beans};
31
32     mod zug {
33         pub mod baz {
34             pub struct foobar;
35         }
36     }
37 }
38
39 mod m {
40     enum MyEnum {
41         MyVariant
42     }
43
44     use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432]
45                    //~^ Did you mean `self::MyEnum`?
46 }
47
48 mod items {
49     enum Enum {
50         Variant
51     }
52
53     use Enum::*; //~ ERROR unresolved import `Enum` [E0432]
54                  //~^ Did you mean `self::Enum`?
55
56     fn item() {}
57 }