@@ -1275,34 +1275,21 @@ macro_rules! impl_anytuple_fetch {
1275
1275
fn update_component_access( state: & Self :: State , _access: & mut FilteredAccess <ComponentId >) {
1276
1276
let ( $( $name, ) * ) = state;
1277
1277
1278
- // We do not unconditionally add `$name`'s `with`/`without` accesses to `_access`
1279
- // as this would be unsound. For example the following two queries should conflict:
1280
- // - Query<(AnyOf<(&A, ())>, &mut B)>
1281
- // - Query<&mut B, Without<A>>
1282
- //
1283
- // If we were to unconditionally add `$name`'s `with`/`without` accesses then `AnyOf<(&A, ())>`
1284
- // would have a `With<A>` access which is incorrect as this `WorldQuery` will match entities that
1285
- // do not have the `A` component. This is the same logic as the `Or<...>: WorldQuery` impl.
1286
- //
1287
- // The correct thing to do here is to only add a `with`/`without` access to `_access` if all
1288
- // `$name` params have that `with`/`without` access. More jargony put- we add the intersection
1289
- // of all `with`/`without` accesses of the `$name` params to `_access`.
1290
- let mut _intersected_access = _access. clone( ) ;
1278
+ let mut _new_access = _access. clone( ) ;
1291
1279
let mut _not_first = false ;
1292
1280
$(
1293
1281
if _not_first {
1294
1282
let mut intermediate = _access. clone( ) ;
1295
1283
$name:: update_component_access( $name, & mut intermediate) ;
1296
- _intersected_access . append_or( & intermediate) ;
1297
- _intersected_access . extend_access( & intermediate) ;
1284
+ _new_access . append_or( & intermediate) ;
1285
+ _new_access . extend_access( & intermediate) ;
1298
1286
} else {
1299
-
1300
- $name:: update_component_access( $name, & mut _intersected_access) ;
1287
+ $name:: update_component_access( $name, & mut _new_access) ;
1301
1288
_not_first = true ;
1302
1289
}
1303
1290
) *
1304
1291
1305
- * _access = _intersected_access ;
1292
+ * _access = _new_access ;
1306
1293
}
1307
1294
1308
1295
fn update_archetype_component_access( state: & Self :: State , _archetype: & Archetype , _access: & mut Access <ArchetypeComponentId >) {
0 commit comments