diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs
index 17bd3b5a1a377..7b368b62ef471 100644
--- a/crates/bevy_ecs/src/system/mod.rs
+++ b/crates/bevy_ecs/src/system/mod.rs
@@ -927,6 +927,129 @@ mod tests {
}
}
+ #[test]
+ fn convert_mut_to_immut() {
+ {
+ let mut world = World::new();
+
+ fn mutable_query(mut query: Query<&mut A>) {
+ for _ in &mut query {}
+
+ immutable_query(query.to_readonly());
+ }
+
+ fn immutable_query(_: Query<&A>) {}
+
+ let mut sys = IntoSystem::into_system(mutable_query);
+ sys.initialize(&mut world);
+ }
+
+ {
+ let mut world = World::new();
+
+ fn mutable_query(mut query: Query