bevy/crates/bevy_reflect/src
rmsthebest 278380394f
Avoid bevy_reflect::List::iter wrapping in release mode (#13271)
# Objective
Fixes  #13230

## Solution
Uses solution described in  #13230
They mention a worry about adding a branch, but I'm not sure there is
one.

This code
```Rust
#[no_mangle]
pub fn next_if_some(num: i32, b: Option<bool>) -> i32 {
    num + b.is_some() as i32
}
```
produces this assembly with opt-level 3
```asm
next_if_some:
        xor     eax, eax
        cmp     sil, 2
        setne   al
        add     eax, edi
        ret
```

## Testing
Added test from #13230, tagged it as ignore as it is only useful in
release mode and very slow if you accidentally invoke it in debug mode.

---

## Changelog
Iterationg of ListIter will no longer overflow and wrap around

## Migration Guide
2024-05-12 15:01:05 +00:00
..
enums Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
impls Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00
path Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
serde bevy_reflect: Rename UntypedReflectDeserializer to ReflectDeserializer (#12721) 2024-03-26 19:58:29 +00:00
array.rs Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
fields.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
from_reflect.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
lib.rs Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00
list.rs Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
map.rs Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
reflect.rs Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00
std_traits.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
struct_trait.rs Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
tuple_struct.rs Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
tuple.rs Avoid bevy_reflect::List::iter wrapping in release mode (#13271) 2024-05-12 15:01:05 +00:00
type_info.rs Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00
type_path.rs Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00
type_registry.rs iter_with_data (#13102) 2024-04-26 02:09:34 +00:00
utility.rs Finish the work on try_apply (#12646) 2024-05-08 14:26:01 +00:00