summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-04-26 21:14:37 +0200
committerJosh Stone <jistone@redhat.com>2024-05-09 14:41:12 -0700
commit4b8149f481aadf26593288effc424f65a5adecf7 (patch)
tree29399f5d96744388bd48e227c989c4695400ac0c /tests
parentf5d04caa74a1dfa5ffc4082c2c8f621f25336bbc (diff)
Consider inner modules to be local in the `non_local_definitions` lint
(cherry picked from commit 21c688af86a52cf5d44c69c274179e7410e01a49)
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/non-local-defs/module_as_local.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/lint/non-local-defs/module_as_local.rs b/tests/ui/lint/non-local-defs/module_as_local.rs
new file mode 100644
index 00000000000..bb215026c7d
--- /dev/null
+++ b/tests/ui/lint/non-local-defs/module_as_local.rs
@@ -0,0 +1,38 @@
+//! This test checks that module are treated as if they were local
+//!
+//! https://github.com/rust-lang/rust/issues/124396
+
+//@ check-pass
+
+trait JoinTo {}
+
+fn simple_one() {
+ mod posts {
+ #[allow(non_camel_case_types)]
+ pub struct table {}
+ }
+
+ impl JoinTo for posts::table {}
+}
+
+fn simple_two() {
+ mod posts {
+ pub mod posts {
+ #[allow(non_camel_case_types)]
+ pub struct table {}
+ }
+ }
+
+ impl JoinTo for posts::posts::table {}
+}
+
+struct Global;
+fn trait_() {
+ mod posts {
+ pub trait AdjecentTo {}
+ }
+
+ impl posts::AdjecentTo for Global {}
+}
+
+fn main() {}