Skip to content

Commit 1525e97

Browse files
committed
Update tests to demonstrate 2015 behaviour.
Adds a test to demonstrate behaviour of suggestions in the 2015 edition.
1 parent c50006d commit 1525e97

4 files changed

+49
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2018 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+
// aux-build:baz.rs
12+
// compile-flags:--extern baz
13+
// edition:2015
14+
15+
// This test exists to demonstrate the behaviour of the import suggestions
16+
// from the `local-path-suggestions-2018.rs` test when not using the 2018 edition.
17+
18+
extern crate baz as aux_baz;
19+
20+
mod foo {
21+
pub type Bar = u32;
22+
}
23+
24+
mod baz {
25+
use foo::Bar;
26+
27+
fn baz() {
28+
let x: Bar = 22;
29+
}
30+
}
31+
32+
use foo::Bar;
33+
34+
use foobar::Baz;
35+
36+
fn main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0432]: unresolved import `foobar`
2+
--> $DIR/local-path-suggestions-2015.rs:34:5
3+
|
4+
LL | use foobar::Baz;
5+
| ^^^^^^ Did you mean `aux_baz::foobar`?
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0432`.

src/test/ui/rust-2018/local-path-suggestions.rs renamed to src/test/ui/rust-2018/local-path-suggestions-2018.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// edition:2018
1414

1515
mod foo {
16-
type Bar = u32;
16+
pub type Bar = u32;
1717
}
1818

1919
mod baz {

src/test/ui/rust-2018/local-path-suggestions.stderr renamed to src/test/ui/rust-2018/local-path-suggestions-2018.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0432]: unresolved import `foo`
2-
--> $DIR/local-path-suggestions.rs:20:9
2+
--> $DIR/local-path-suggestions-2018.rs:20:9
33
|
44
LL | use foo::Bar;
55
| ^^^ Did you mean `crate::foo`?
66

77
error[E0432]: unresolved import `foo`
8-
--> $DIR/local-path-suggestions.rs:27:5
8+
--> $DIR/local-path-suggestions-2018.rs:27:5
99
|
1010
LL | use foo::Bar;
1111
| ^^^ Did you mean `self::foo`?
1212

1313
error[E0432]: unresolved import `foobar`
14-
--> $DIR/local-path-suggestions.rs:29:5
14+
--> $DIR/local-path-suggestions-2018.rs:29:5
1515
|
1616
LL | use foobar::Baz;
1717
| ^^^^^^ Did you mean `baz::foobar`?

0 commit comments

Comments
 (0)