diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/modules_and_files_visibility | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
| download | rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip | |
Move /src/test to /tests
Diffstat (limited to 'tests/ui/modules_and_files_visibility')
7 files changed, 46 insertions, 0 deletions
diff --git a/tests/ui/modules_and_files_visibility/mod_file_aux.rs b/tests/ui/modules_and_files_visibility/mod_file_aux.rs new file mode 100644 index 00000000000..98f42c5cdb1 --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_aux.rs @@ -0,0 +1,3 @@ +// ignore-test Not a test. Used by other tests + +pub fn foo() -> isize { 10 } diff --git a/tests/ui/modules_and_files_visibility/mod_file_correct_spans.rs b/tests/ui/modules_and_files_visibility/mod_file_correct_spans.rs new file mode 100644 index 00000000000..c42d2eaa7bd --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_correct_spans.rs @@ -0,0 +1,8 @@ +// Testing that the source_map is maintained correctly when parsing mods from external files + +mod mod_file_aux; + +fn main() { + assert!(mod_file_aux::bar() == 10); + //~^ ERROR cannot find function `bar` in module `mod_file_aux` +} diff --git a/tests/ui/modules_and_files_visibility/mod_file_correct_spans.stderr b/tests/ui/modules_and_files_visibility/mod_file_correct_spans.stderr new file mode 100644 index 00000000000..73044752b07 --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_correct_spans.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find function `bar` in module `mod_file_aux` + --> $DIR/mod_file_correct_spans.rs:6:27 + | +LL | assert!(mod_file_aux::bar() == 10); + | ^^^ not found in `mod_file_aux` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/modules_and_files_visibility/mod_file_disambig.rs b/tests/ui/modules_and_files_visibility/mod_file_disambig.rs new file mode 100644 index 00000000000..e5958af173b --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_disambig.rs @@ -0,0 +1,6 @@ +mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both + +fn main() { + assert_eq!(mod_file_aux::bar(), 10); + //~^ ERROR failed to resolve: use of undeclared crate or module `mod_file_aux` +} diff --git a/tests/ui/modules_and_files_visibility/mod_file_disambig.stderr b/tests/ui/modules_and_files_visibility/mod_file_disambig.stderr new file mode 100644 index 00000000000..a2c99396987 --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_disambig.stderr @@ -0,0 +1,18 @@ +error[E0761]: file for module `mod_file_disambig_aux` found at both "$DIR/mod_file_disambig_aux.rs" and "$DIR/mod_file_disambig_aux/mod.rs" + --> $DIR/mod_file_disambig.rs:1:1 + | +LL | mod mod_file_disambig_aux; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: delete or rename one of them to remove the ambiguity + +error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux` + --> $DIR/mod_file_disambig.rs:4:16 + | +LL | assert_eq!(mod_file_aux::bar(), 10); + | ^^^^^^^^^^^^ use of undeclared crate or module `mod_file_aux` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0433, E0761. +For more information about an error, try `rustc --explain E0433`. diff --git a/tests/ui/modules_and_files_visibility/mod_file_disambig_aux.rs b/tests/ui/modules_and_files_visibility/mod_file_disambig_aux.rs new file mode 100644 index 00000000000..3bf9609f4ed --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_disambig_aux.rs @@ -0,0 +1 @@ +// ignore-test not a test. aux file diff --git a/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/mod.rs b/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/mod.rs new file mode 100644 index 00000000000..3bf9609f4ed --- /dev/null +++ b/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/mod.rs @@ -0,0 +1 @@ +// ignore-test not a test. aux file |
