Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc_resolve: inject ambiguity "canaries" when #![feature(uniform_pa…
…ths)] is enabled.
- Loading branch information
Showing
10 changed files
with
343 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2018 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. | ||
|
||
// edition:2018 | ||
|
||
#![feature(uniform_paths)] | ||
|
||
// This test is similar to `ambiguity-macros.rs`, but nested in a module. | ||
|
||
mod foo { | ||
pub use std::io; | ||
//~^ ERROR import from `std` is ambiguous | ||
|
||
macro_rules! m { | ||
() => { | ||
mod std { | ||
pub struct io; | ||
} | ||
} | ||
} | ||
m!(); | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: import from `std` is ambiguous | ||
--> $DIR/ambiguity-macros-nested.rs:18:13 | ||
| | ||
LL | pub use std::io; | ||
| ^^^ could refer to external crate `::std` | ||
... | ||
LL | / mod std { | ||
LL | | pub struct io; | ||
LL | | } | ||
| |_____________- could also refer to `self::std` | ||
| | ||
= help: write `::std` or `self::std` explicitly instead | ||
= note: relative `use` paths enabled by `#![feature(uniform_paths)]` | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2018 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. | ||
|
||
// edition:2018 | ||
|
||
#![feature(uniform_paths)] | ||
|
||
// This test is similar to `ambiguity.rs`, but with macros defining local items. | ||
|
||
use std::io; | ||
//~^ ERROR import from `std` is ambiguous | ||
|
||
macro_rules! m { | ||
() => { | ||
mod std { | ||
pub struct io; | ||
} | ||
} | ||
} | ||
m!(); | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: import from `std` is ambiguous | ||
--> $DIR/ambiguity-macros.rs:17:5 | ||
| | ||
LL | use std::io; | ||
| ^^^ could refer to external crate `::std` | ||
... | ||
LL | / mod std { | ||
LL | | pub struct io; | ||
LL | | } | ||
| |_________- could also refer to `self::std` | ||
| | ||
= help: write `::std` or `self::std` explicitly instead | ||
= note: relative `use` paths enabled by `#![feature(uniform_paths)]` | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.