about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-07-23 15:15:45 -0700
committerEsteban Küber <esteban@kuber.com.ar>2017-07-25 21:25:43 -0700
commit552ff07758545173c94fa260e5266ec07cd0bbde (patch)
tree3225fb58a55ba166871654f9bc3d1aefbb037b8e /src/test/ui
parent6c949655de6bd2866d7d4bbac0238f35557563fc (diff)
downloadrust-552ff07758545173c94fa260e5266ec07cd0bbde.tar.gz
rust-552ff07758545173c94fa260e5266ec07cd0bbde.zip
Point at path segment on module not found
Point at the correct path segment on a import statement where a module
doesn't exist.

New output:

```rust
error[E0432]: unresolved import `std::bar`
 --> <anon>:1:10
  |
1 | use std::bar::{foo1, foo2};
  |          ^^^ Could not find `bar` in `std`
```

instead of:

```rust
error[E0432]: unresolved import `std::bar::foo1`
 --> <anon>:1:16
  |
1 | use std::bar::{foo1, foo2};
  |                ^^^^ Could not find `bar` in `std`

error[E0432]: unresolved import `std::bar::foo2`
 --> <anon>:1:22
  |
1 | use std::bar::{foo1, foo2};
  |                      ^^^^ Could not find `bar` in `std`
```
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/macros/macro_path_as_generic_bound.stderr2
-rw-r--r--src/test/ui/span/non-existing-module-import.rs13
-rw-r--r--src/test/ui/span/non-existing-module-import.stderr8
3 files changed, 22 insertions, 1 deletions
diff --git a/src/test/ui/macros/macro_path_as_generic_bound.stderr b/src/test/ui/macros/macro_path_as_generic_bound.stderr
index e4044f5aaf2..5c3bb66d83a 100644
--- a/src/test/ui/macros/macro_path_as_generic_bound.stderr
+++ b/src/test/ui/macros/macro_path_as_generic_bound.stderr
@@ -2,7 +2,7 @@ error[E0433]: failed to resolve. Use of undeclared type or module `m`
   --> $DIR/macro_path_as_generic_bound.rs:17:6
    |
 17 | foo!(m::m2::A);
-   |      ^^^^^^^^ Use of undeclared type or module `m`
+   |      ^ Use of undeclared type or module `m`
 
 error: cannot continue compilation due to previous error
 
diff --git a/src/test/ui/span/non-existing-module-import.rs b/src/test/ui/span/non-existing-module-import.rs
new file mode 100644
index 00000000000..3d45a94d531
--- /dev/null
+++ b/src/test/ui/span/non-existing-module-import.rs
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::bar::{foo1, foo2};
+
+fn main() {}
diff --git a/src/test/ui/span/non-existing-module-import.stderr b/src/test/ui/span/non-existing-module-import.stderr
new file mode 100644
index 00000000000..93339576f49
--- /dev/null
+++ b/src/test/ui/span/non-existing-module-import.stderr
@@ -0,0 +1,8 @@
+error[E0432]: unresolved import `std::bar`
+  --> $DIR/non-existing-module-import.rs:11:10
+   |
+11 | use std::bar::{foo1, foo2};
+   |          ^^^ Could not find `bar` in `std`
+
+error: aborting due to previous error
+