diff options
| author | Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> | 2017-04-26 22:11:06 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-26 22:11:06 +0000 |
| commit | ccc790f9e69d4aba4db339ea45c7d60f96451d99 (patch) | |
| tree | cd914f613a2147d566afc2b1ee27e1dbd0235bd1 /src/test | |
| parent | 84f6e017d64954d39c827123befaa8299a819ea4 (diff) | |
| parent | 3f97b2a65c31a1c53c29d233d6b37b0258e4a6b2 (diff) | |
| download | rust-ccc790f9e69d4aba4db339ea45c7d60f96451d99.tar.gz rust-ccc790f9e69d4aba4db339ea45c7d60f96451d99.zip | |
Rollup merge of #41501 - GuillaumeGomez:invalid_module_location, r=jseyfried
Invalid module location Fixes #38110. r? @jseyfried
Diffstat (limited to 'src/test')
4 files changed, 56 insertions, 0 deletions
diff --git a/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs b/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs new file mode 100644 index 00000000000..4b6b4f5ebf8 --- /dev/null +++ b/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs @@ -0,0 +1,11 @@ +// 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. + +pub mod baz; diff --git a/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs b/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs new file mode 100644 index 00000000000..6d77fb60a35 --- /dev/null +++ b/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs @@ -0,0 +1,11 @@ +// 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. + +pub mod bar; diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs new file mode 100644 index 00000000000..c15cfb8cc8e --- /dev/null +++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs @@ -0,0 +1,20 @@ +// Copyright 2016 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. + +// ignore-tidy-linelength + +// error-pattern: cannot declare a new module at this location +// error-pattern: maybe move this module + +mod auxiliary { + mod foo; +} + +fn main() {} diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr b/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr new file mode 100644 index 00000000000..3e9b21cdb74 --- /dev/null +++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr @@ -0,0 +1,14 @@ +error: cannot declare a new module at this location + --> $DIR/auxiliary/foo/bar.rs:11:9 + | +11 | pub mod baz; + | ^^^ + | +note: maybe move this module `$DIR/auxiliary/foo/bar.rs` to its own directory via `$DIR/auxiliary/foo/bar/mod.rs` + --> $DIR/auxiliary/foo/bar.rs:11:9 + | +11 | pub mod baz; + | ^^^ + +error: aborting due to previous error + |
