Add test ensuring that rust keywords can be message names

PiperOrigin-RevId: 561057538
diff --git a/rust/test/reserved.proto b/rust/test/reserved.proto
index 87e94d2..0817f54 100644
--- a/rust/test/reserved.proto
+++ b/rust/test/reserved.proto
@@ -34,4 +34,7 @@
 
 message Reserved {
   optional int32 for = 1; // for is a reserved word in rust, let's make sure we can compile it
+
+  message Inner {}
+  optional Inner pub = 2;  // pub is reserved too!
 }
diff --git a/rust/test/shared/reserved_test.rs b/rust/test/shared/reserved_test.rs
index 0c8ed4e..43e1b9f 100644
--- a/rust/test/shared/reserved_test.rs
+++ b/rust/test/shared/reserved_test.rs
@@ -37,3 +37,9 @@
     let res = msg.r#for();
     assert_eq!(res, 0);
 }
+
+#[test]
+fn test_reserved_keyword_in_messages() {
+    let msg = Reserved::new();
+    let _ = msg.r#pub();
+}