From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/directory_ownership/foo/compiletest-ignore-dir | 0 .../directory_ownership/foo/mod_file_not_owning/aux2.rs | 1 + .../directory_ownership/foo/mod_file_not_owning_aux2.rs | 1 + tests/ui/directory_ownership/macro-expanded-mod.rs | 15 +++++++++++++++ tests/ui/directory_ownership/macro-expanded-mod.stderr | 13 +++++++++++++ .../macro_expanded_mod_helper/foo/bar.rs | 1 + .../macro_expanded_mod_helper/foo/mod.rs | 3 +++ tests/ui/directory_ownership/mod_file_not_owning_aux1.rs | 6 ++++++ .../mod_file_not_owning_aux1/compiletest-ignore-dir | 0 .../mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs | 1 + tests/ui/directory_ownership/mod_file_not_owning_aux2.rs | 1 + tests/ui/directory_ownership/mod_file_not_owning_aux3.rs | 3 +++ .../ui/directory_ownership/non-inline-mod-restriction.rs | 5 +++++ .../directory_ownership/non-inline-mod-restriction.stderr | 8 ++++++++ 14 files changed, 58 insertions(+) create mode 100644 tests/ui/directory_ownership/foo/compiletest-ignore-dir create mode 100644 tests/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs create mode 100644 tests/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs create mode 100644 tests/ui/directory_ownership/macro-expanded-mod.rs create mode 100644 tests/ui/directory_ownership/macro-expanded-mod.stderr create mode 100644 tests/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs create mode 100644 tests/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs create mode 100644 tests/ui/directory_ownership/mod_file_not_owning_aux1.rs create mode 100644 tests/ui/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir create mode 100644 tests/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs create mode 100644 tests/ui/directory_ownership/mod_file_not_owning_aux2.rs create mode 100644 tests/ui/directory_ownership/mod_file_not_owning_aux3.rs create mode 100644 tests/ui/directory_ownership/non-inline-mod-restriction.rs create mode 100644 tests/ui/directory_ownership/non-inline-mod-restriction.stderr (limited to 'tests/ui/directory_ownership') diff --git a/tests/ui/directory_ownership/foo/compiletest-ignore-dir b/tests/ui/directory_ownership/foo/compiletest-ignore-dir new file mode 100644 index 000000000..e69de29bb diff --git a/tests/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs b/tests/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs b/tests/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/ui/directory_ownership/macro-expanded-mod.rs b/tests/ui/directory_ownership/macro-expanded-mod.rs new file mode 100644 index 000000000..fa81769e5 --- /dev/null +++ b/tests/ui/directory_ownership/macro-expanded-mod.rs @@ -0,0 +1,15 @@ +// Test that macro-expanded non-inline modules behave correctly + +macro_rules! mod_decl { + ($i:ident) => { + mod $i; //~ ERROR cannot declare a non-inline module inside a block + }; +} + +mod macro_expanded_mod_helper { + mod_decl!(foo); // This should search in the folder `macro_expanded_mod_helper` +} + +fn main() { + mod_decl!(foo); +} diff --git a/tests/ui/directory_ownership/macro-expanded-mod.stderr b/tests/ui/directory_ownership/macro-expanded-mod.stderr new file mode 100644 index 000000000..8976341b1 --- /dev/null +++ b/tests/ui/directory_ownership/macro-expanded-mod.stderr @@ -0,0 +1,13 @@ +error: cannot declare a non-inline module inside a block unless it has a path attribute + --> $DIR/macro-expanded-mod.rs:5:9 + | +LL | mod $i; + | ^^^^^^^ +... +LL | mod_decl!(foo); + | -------------- in this macro invocation + | + = note: this error originates in the macro `mod_decl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/tests/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs b/tests/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs new file mode 100644 index 000000000..01c087dbc --- /dev/null +++ b/tests/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs @@ -0,0 +1 @@ +// ignore-test not a test, auxiliary diff --git a/tests/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs b/tests/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs new file mode 100644 index 000000000..2ec1c8bcc --- /dev/null +++ b/tests/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs @@ -0,0 +1,3 @@ +// ignore-test not a test, auxiliary + +mod_decl!(bar); diff --git a/tests/ui/directory_ownership/mod_file_not_owning_aux1.rs b/tests/ui/directory_ownership/mod_file_not_owning_aux1.rs new file mode 100644 index 000000000..eb5e8e3e1 --- /dev/null +++ b/tests/ui/directory_ownership/mod_file_not_owning_aux1.rs @@ -0,0 +1,6 @@ +// ignore-test this is not a test + +macro_rules! m { + () => { mod mod_file_not_owning_aux2; } +} +m!(); diff --git a/tests/ui/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir b/tests/ui/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir new file mode 100644 index 000000000..e69de29bb diff --git a/tests/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs b/tests/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/ui/directory_ownership/mod_file_not_owning_aux2.rs b/tests/ui/directory_ownership/mod_file_not_owning_aux2.rs new file mode 100644 index 000000000..920938c4a --- /dev/null +++ b/tests/ui/directory_ownership/mod_file_not_owning_aux2.rs @@ -0,0 +1 @@ +// ignore-test this is not a test diff --git a/tests/ui/directory_ownership/mod_file_not_owning_aux3.rs b/tests/ui/directory_ownership/mod_file_not_owning_aux3.rs new file mode 100644 index 000000000..6e4a39289 --- /dev/null +++ b/tests/ui/directory_ownership/mod_file_not_owning_aux3.rs @@ -0,0 +1,3 @@ +// ignore-test this is not a test + +mod mod_file_not_owning_aux2; diff --git a/tests/ui/directory_ownership/non-inline-mod-restriction.rs b/tests/ui/directory_ownership/non-inline-mod-restriction.rs new file mode 100644 index 000000000..de4f81665 --- /dev/null +++ b/tests/ui/directory_ownership/non-inline-mod-restriction.rs @@ -0,0 +1,5 @@ +// Test that non-inline modules are not allowed inside blocks. + +fn main() { + mod foo; //~ ERROR cannot declare a non-inline module inside a block +} diff --git a/tests/ui/directory_ownership/non-inline-mod-restriction.stderr b/tests/ui/directory_ownership/non-inline-mod-restriction.stderr new file mode 100644 index 000000000..64189bee4 --- /dev/null +++ b/tests/ui/directory_ownership/non-inline-mod-restriction.stderr @@ -0,0 +1,8 @@ +error: cannot declare a non-inline module inside a block unless it has a path attribute + --> $DIR/non-inline-mod-restriction.rs:4:5 + | +LL | mod foo; + | ^^^^^^^^ + +error: aborting due to previous error + -- cgit v1.2.3