Skip to content

Commit

Permalink
Add a couple more tests
Browse files Browse the repository at this point in the history
Add error annotations to one test
  • Loading branch information
petrochenkov committed Nov 14, 2018
1 parent bb5ffdc commit 2302ae6
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/test/ui/imports/auxiliary/glob-conflict.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mod m1 {
pub fn f() {}
}
mod m2 {
pub fn f(_: u8) {}
}

pub use m1::*;
pub use m2::*;
7 changes: 7 additions & 0 deletions src/test/ui/imports/glob-conflict-cross-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// aux-build:glob-conflict.rs

extern crate glob_conflict;

fn main() {
glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict`
}
9 changes: 9 additions & 0 deletions src/test/ui/imports/glob-conflict-cross-crate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0425]: cannot find function `f` in module `glob_conflict`
--> $DIR/glob-conflict-cross-crate.rs:6:20
|
LL | glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict`
| ^ not found in `glob_conflict`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
4 changes: 2 additions & 2 deletions src/test/ui/rust-2018/local-path-suggestions-2018.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod foo {
}

mod bazz {
use foo::Bar;
use foo::Bar; //~ ERROR unresolved import `foo`

fn baz() {
let x: Bar = 22;
Expand All @@ -28,6 +28,6 @@ mod bazz {

use foo::Bar;

use foobar::Baz;
use foobar::Baz; //~ ERROR unresolved import `foobar`

fn main() { }
4 changes: 2 additions & 2 deletions src/test/ui/rust-2018/local-path-suggestions-2018.stderr
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
error[E0432]: unresolved import `foo`
--> $DIR/local-path-suggestions-2018.rs:22:9
|
LL | use foo::Bar;
LL | use foo::Bar; //~ ERROR unresolved import `foo`
| ^^^ did you mean `crate::foo`?
|
= note: `use` statements changed in Rust 2018; read more at <https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html>

error[E0432]: unresolved import `foobar`
--> $DIR/local-path-suggestions-2018.rs:31:5
|
LL | use foobar::Baz;
LL | use foobar::Baz; //~ ERROR unresolved import `foobar`
| ^^^^^^ did you mean `baz::foobar`?

error: aborting due to 2 previous errors
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/deadlock.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// edition:2018
// compile-flags:--extern foo --extern bar

use foo::bar; //~ ERROR unresolved import
use bar::foo;

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/deadlock.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0432]: unresolved import
--> $DIR/deadlock.rs:4:5
|
LL | use foo::bar; //~ ERROR unresolved import
| ^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
11 changes: 11 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/issue-54390.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// edition:2018

#![deny(unused)]

use std::fmt;

// No "unresolved import" + "unused import" combination here.
use fmt::Write; //~ ERROR imports can only refer to extern crate names
//~| ERROR unused import: `fmt::Write`

fn main() {}
32 changes: 32 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/issue-54390.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> $DIR/issue-54390.rs:8:5
|
LL | use std::fmt;
| -------- not an extern crate passed with `--extern`
...
LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names
| ^^^
|
= help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the module imported here
--> $DIR/issue-54390.rs:5:5
|
LL | use std::fmt;
| ^^^^^^^^

error: unused import: `fmt::Write`
--> $DIR/issue-54390.rs:8:5
|
LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/issue-54390.rs:3:9
|
LL | #![deny(unused)]
| ^^^^^^
= note: #[deny(unused_imports)] implied by #[deny(unused)]

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.

0 comments on commit 2302ae6

Please sign in to comment.