diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-12-07 02:01:35 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-12-07 02:25:09 +0300 |
| commit | 4eb9da3b17a1e6cdb8517e9f9ee7000f8effaef4 (patch) | |
| tree | a0031460e4fc31923d9dc1374f8aaf84e2d61dd1 /src/test/ui/modules | |
| parent | 0f6f2d681b39c5f95459cd09cb936b6ceb27cd82 (diff) | |
| download | rust-4eb9da3b17a1e6cdb8517e9f9ee7000f8effaef4.tar.gz rust-4eb9da3b17a1e6cdb8517e9f9ee7000f8effaef4.zip | |
Move some tests to subdirectories
Diffstat (limited to 'src/test/ui/modules')
| -rw-r--r-- | src/test/ui/modules/issue-56411-aux.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/modules/issue-56411.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/modules/issue-56411.stderr | 33 |
3 files changed, 56 insertions, 0 deletions
diff --git a/src/test/ui/modules/issue-56411-aux.rs b/src/test/ui/modules/issue-56411-aux.rs new file mode 100644 index 00000000000..c8e5a059810 --- /dev/null +++ b/src/test/ui/modules/issue-56411-aux.rs @@ -0,0 +1,5 @@ +// check-pass + +struct T {} + +fn main() {} diff --git a/src/test/ui/modules/issue-56411.rs b/src/test/ui/modules/issue-56411.rs new file mode 100644 index 00000000000..163651a7ef6 --- /dev/null +++ b/src/test/ui/modules/issue-56411.rs @@ -0,0 +1,18 @@ +macro_rules! import { + ( $(($path:expr, $name:ident)),* ) => { + $( + #[path = $path] + mod $name; + pub use self::$name; + //~^ ERROR the name `issue_56411_aux` is defined multiple times + //~| ERROR `issue_56411_aux` is private, and cannot be re-exported + + )* + } +} + +import!(("issue-56411-aux.rs", issue_56411_aux)); + +fn main() { + println!("Hello, world!"); +} diff --git a/src/test/ui/modules/issue-56411.stderr b/src/test/ui/modules/issue-56411.stderr new file mode 100644 index 00000000000..3ac8dc548ae --- /dev/null +++ b/src/test/ui/modules/issue-56411.stderr @@ -0,0 +1,33 @@ +error[E0255]: the name `issue_56411_aux` is defined multiple times + --> $DIR/issue-56411.rs:6:21 + | +LL | mod $name; + | ---------- previous definition of the module `issue_56411_aux` here +LL | pub use self::$name; + | ^^^^^^^^^^^ + | | + | `issue_56411_aux` reimported here + | you can use `as` to change the binding name of the import +... +LL | import!(("issue-56411-aux.rs", issue_56411_aux)); + | ------------------------------------------------- in this macro invocation + | + = note: `issue_56411_aux` must be defined only once in the type namespace of this module + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0365]: `issue_56411_aux` is private, and cannot be re-exported + --> $DIR/issue-56411.rs:6:21 + | +LL | pub use self::$name; + | ^^^^^^^^^^^ re-export of private `issue_56411_aux` +... +LL | import!(("issue-56411-aux.rs", issue_56411_aux)); + | ------------------------------------------------- in this macro invocation + | + = note: consider declaring type or module `issue_56411_aux` with `pub` + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0255, E0365. +For more information about an error, try `rustc --explain E0255`. |
