diff --git a/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_attribute_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_attribute_fail.stderr index 553c8428a2785..f242c5c8bbd90 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_attribute_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_attribute_fail.stderr @@ -1,13 +1,13 @@ error: unexpected token in attribute - --> tests/deref_derive/invalid_attribute_fail.rs:8:12 - | -8 | #[deref()] String - | ^ + --> tests/deref_derive/invalid_attribute_fail.rs:LL:CC + | +LL | #[deref()] String + | ^ error: unexpected token in attribute - --> tests/deref_derive/invalid_attribute_fail.rs:15:12 + --> tests/deref_derive/invalid_attribute_fail.rs:LL:CC | -15 | #[deref()] +LL | #[deref()] | ^ error: aborting due to 2 previous errors diff --git a/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_item_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_item_fail.stderr index 9a6858769cf11..bc8ad6e804327 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_item_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_derive/invalid_item_fail.stderr @@ -1,17 +1,17 @@ error: Deref cannot be derived on field-less structs - --> tests/deref_derive/invalid_item_fail.rs:3:10 - | -3 | #[derive(Deref)] - | ^^^^^ - | + --> tests/deref_derive/invalid_item_fail.rs:LL:CC + | +LL | #[derive(Deref)] + | ^^^^^ + | = note: this error originates in the derive macro `Deref` (in Nightly builds, run with -Z macro-backtrace for more info) error: Deref can only be derived on structs - --> tests/deref_derive/invalid_item_fail.rs:7:10 - | -7 | #[derive(Deref)] - | ^^^^^ - | + --> tests/deref_derive/invalid_item_fail.rs:LL:CC + | +LL | #[derive(Deref)] + | ^^^^^ + | = note: this error originates in the derive macro `Deref` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/crates/bevy_derive/compile_fail/tests/deref_derive/missing_attribute_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_derive/missing_attribute_fail.stderr index 35740c9e3fcb8..183e5ef011df7 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_derive/missing_attribute_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_derive/missing_attribute_fail.stderr @@ -1,17 +1,17 @@ error: deriving Deref on multi-field structs requires one field to have the `#[deref]` attribute - --> tests/deref_derive/missing_attribute_fail.rs:3:10 - | -3 | #[derive(Deref)] - | ^^^^^ - | + --> tests/deref_derive/missing_attribute_fail.rs:LL:CC + | +LL | #[derive(Deref)] + | ^^^^^ + | = note: this error originates in the derive macro `Deref` (in Nightly builds, run with -Z macro-backtrace for more info) error: deriving Deref on multi-field structs requires one field to have the `#[deref]` attribute - --> tests/deref_derive/missing_attribute_fail.rs:7:10 - | -7 | #[derive(Deref)] - | ^^^^^ - | + --> tests/deref_derive/missing_attribute_fail.rs:LL:CC + | +LL | #[derive(Deref)] + | ^^^^^ + | = note: this error originates in the derive macro `Deref` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/crates/bevy_derive/compile_fail/tests/deref_derive/multiple_attributes_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_derive/multiple_attributes_fail.stderr index bdeeb7e533cbc..5e3d97c57ac27 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_derive/multiple_attributes_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_derive/multiple_attributes_fail.stderr @@ -1,13 +1,13 @@ error: `#[deref]` attribute can only be used on a single field - --> tests/deref_derive/multiple_attributes_fail.rs:6:5 - | -6 | #[deref] String - | ^^^^^^^^ + --> tests/deref_derive/multiple_attributes_fail.rs:LL:CC + | +LL | #[deref] String + | ^^^^^^^^ error: `#[deref]` attribute can only be used on a single field - --> tests/deref_derive/multiple_attributes_fail.rs:14:5 + --> tests/deref_derive/multiple_attributes_fail.rs:LL:CC | -14 | #[deref] +LL | #[deref] | ^^^^^^^^ error: aborting due to 2 previous errors diff --git a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_attribute_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_attribute_fail.stderr index 4cd6b9398025a..31159edc6d8b2 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_attribute_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_attribute_fail.stderr @@ -1,13 +1,13 @@ error: unexpected token in attribute - --> tests/deref_mut_derive/invalid_attribute_fail.rs:9:12 - | -9 | #[deref()] String - | ^ + --> tests/deref_mut_derive/invalid_attribute_fail.rs:LL:CC + | +LL | #[deref()] String + | ^ error: unexpected token in attribute - --> tests/deref_mut_derive/invalid_attribute_fail.rs:24:12 + --> tests/deref_mut_derive/invalid_attribute_fail.rs:LL:CC | -24 | #[deref()] +LL | #[deref()] | ^ error: aborting due to 2 previous errors diff --git a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_item_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_item_fail.stderr index 5eccafb3b2157..6ae73cc9542e0 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_item_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/invalid_item_fail.stderr @@ -1,17 +1,17 @@ error: DerefMut cannot be derived on field-less structs - --> tests/deref_mut_derive/invalid_item_fail.rs:3:10 - | -3 | #[derive(DerefMut)] - | ^^^^^^^^ - | + --> tests/deref_mut_derive/invalid_item_fail.rs:LL:CC + | +LL | #[derive(DerefMut)] + | ^^^^^^^^ + | = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) error: DerefMut can only be derived on structs - --> tests/deref_mut_derive/invalid_item_fail.rs:7:10 - | -7 | #[derive(DerefMut)] - | ^^^^^^^^ - | + --> tests/deref_mut_derive/invalid_item_fail.rs:LL:CC + | +LL | #[derive(DerefMut)] + | ^^^^^^^^ + | = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/mismatched_target_type_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/mismatched_target_type_fail.stderr index 941d2624ea04b..2c42e22267717 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/mismatched_target_type_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/mismatched_target_type_fail.stderr @@ -1,20 +1,20 @@ error[E0308]: mismatched types - --> tests/deref_mut_derive/mismatched_target_type_fail.rs:4:10 - | -4 | #[derive(DerefMut)] - | ^^^^^^^^ - | | - | expected `&mut String`, found `&mut usize` - | expected `&mut String` because of return type - | + --> tests/deref_mut_derive/mismatched_target_type_fail.rs:LL:CC + | +LL | #[derive(DerefMut)] + | ^^^^^^^^ + | | + | expected `&mut String`, found `&mut usize` + | expected `&mut String` because of return type + | = note: expected mutable reference `&mut String` found mutable reference `&mut usize` = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> tests/deref_mut_derive/mismatched_target_type_fail.rs:16:10 + --> tests/deref_mut_derive/mismatched_target_type_fail.rs:LL:CC | -16 | #[derive(DerefMut)] +LL | #[derive(DerefMut)] | ^^^^^^^^ | | | expected `&mut String`, found `&mut usize` diff --git a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_attribute_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_attribute_fail.stderr index 5290c5c7debab..fac726d3cdb95 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_attribute_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_attribute_fail.stderr @@ -1,15 +1,15 @@ error: deriving DerefMut on multi-field structs requires one field to have the `#[deref]` attribute - --> tests/deref_mut_derive/missing_attribute_fail.rs:4:10 - | -4 | #[derive(DerefMut)] - | ^^^^^^^^ - | + --> tests/deref_mut_derive/missing_attribute_fail.rs:LL:CC + | +LL | #[derive(DerefMut)] + | ^^^^^^^^ + | = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) error: deriving DerefMut on multi-field structs requires one field to have the `#[deref]` attribute - --> tests/deref_mut_derive/missing_attribute_fail.rs:16:10 + --> tests/deref_mut_derive/missing_attribute_fail.rs:LL:CC | -16 | #[derive(DerefMut)] +LL | #[derive(DerefMut)] | ^^^^^^^^ | = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_deref_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_deref_fail.stderr index 0315f2be7434b..cb0b0ed8e3fb2 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_deref_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/missing_deref_fail.stderr @@ -1,39 +1,39 @@ error[E0277]: the trait bound `TupleStruct: Deref` is not satisfied - --> tests/deref_mut_derive/missing_deref_fail.rs:10:8 - | -10 | struct TupleStruct(usize, #[deref] String); - | ^^^^^^^^^^^ the trait `Deref` is not implemented for `TupleStruct` - | + --> tests/deref_mut_derive/missing_deref_fail.rs:LL:CC + | +LL | struct TupleStruct(usize, #[deref] String); + | ^^^^^^^^^^^ the trait `Deref` is not implemented for `TupleStruct` + | note: required by a bound in `DerefMut` - --> $RUSTUP_HOME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/core/src/ops/deref.rs:264:21 - | -264 | pub trait DerefMut: Deref { - | ^^^^^ required by this bound in `DerefMut` + --> RUSTLIB/core/src/ops/deref.rs:LL:CC + | +LL | pub trait DerefMut: ~const Deref { + | ^^^^^^^^^^^^ required by this bound in `DerefMut` error[E0277]: the trait bound `TupleStruct: Deref` is not satisfied - --> tests/deref_mut_derive/missing_deref_fail.rs:7:10 - | -7 | #[derive(DerefMut)] - | ^^^^^^^^ the trait `Deref` is not implemented for `TupleStruct` - | + --> tests/deref_mut_derive/missing_deref_fail.rs:LL:CC + | +LL | #[derive(DerefMut)] + | ^^^^^^^^ the trait `Deref` is not implemented for `TupleStruct` + | = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Struct: Deref` is not satisfied - --> tests/deref_mut_derive/missing_deref_fail.rs:15:8 - | -15 | struct Struct { - | ^^^^^^ the trait `Deref` is not implemented for `Struct` - | + --> tests/deref_mut_derive/missing_deref_fail.rs:LL:CC + | +LL | struct Struct { + | ^^^^^^ the trait `Deref` is not implemented for `Struct` + | note: required by a bound in `DerefMut` - --> $RUSTUP_HOME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/core/src/ops/deref.rs:264:21 - | -264 | pub trait DerefMut: Deref { - | ^^^^^ required by this bound in `DerefMut` + --> RUSTLIB/core/src/ops/deref.rs:LL:CC + | +LL | pub trait DerefMut: ~const Deref { + | ^^^^^^^^^^^^ required by this bound in `DerefMut` error[E0277]: the trait bound `Struct: Deref` is not satisfied - --> tests/deref_mut_derive/missing_deref_fail.rs:13:10 + --> tests/deref_mut_derive/missing_deref_fail.rs:LL:CC | -13 | #[derive(DerefMut)] +LL | #[derive(DerefMut)] | ^^^^^^^^ the trait `Deref` is not implemented for `Struct` | = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/multiple_attributes_fail.stderr b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/multiple_attributes_fail.stderr index 987d84b36985e..6b43040c4f232 100644 --- a/crates/bevy_derive/compile_fail/tests/deref_mut_derive/multiple_attributes_fail.stderr +++ b/crates/bevy_derive/compile_fail/tests/deref_mut_derive/multiple_attributes_fail.stderr @@ -1,13 +1,13 @@ error: `#[deref]` attribute can only be used on a single field - --> tests/deref_mut_derive/multiple_attributes_fail.rs:7:5 - | -7 | #[deref] String - | ^^^^^^^^ + --> tests/deref_mut_derive/multiple_attributes_fail.rs:LL:CC + | +LL | #[deref] String + | ^^^^^^^^ error: `#[deref]` attribute can only be used on a single field - --> tests/deref_mut_derive/multiple_attributes_fail.rs:23:5 + --> tests/deref_mut_derive/multiple_attributes_fail.rs:LL:CC | -23 | #[deref] +LL | #[deref] | ^^^^^^^^ error: aborting due to 2 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/entity_ref_mut_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/entity_ref_mut_lifetime_safety.stderr index d20635da9608d..0707e23866e66 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/entity_ref_mut_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/entity_ref_mut_lifetime_safety.stderr @@ -1,81 +1,81 @@ error[E0502]: cannot borrow `e_mut` as mutable because it is also borrowed as immutable - --> tests/ui/entity_ref_mut_lifetime_safety.rs:17:26 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -16 | let gotten: &A = e_mut.get::().unwrap(); +LL | let gotten: &A = e_mut.get::().unwrap(); | ----- immutable borrow occurs here -17 | let gotten2: A = e_mut.take::().unwrap(); +LL | let gotten2: A = e_mut.take::().unwrap(); | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here -18 | -19 | assert_eq!(gotten, &gotten2); // oops UB +LL | +LL | assert_eq!(gotten, &gotten2); // oops UB | ---------------------------- immutable borrow later used here error[E0499]: cannot borrow `e_mut` as mutable more than once at a time - --> tests/ui/entity_ref_mut_lifetime_safety.rs:26:30 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -25 | let mut gotten: Mut = e_mut.get_mut::().unwrap(); +LL | let mut gotten: Mut = e_mut.get_mut::().unwrap(); | ----- first mutable borrow occurs here -26 | let mut gotten2: A = e_mut.take::().unwrap(); +LL | let mut gotten2: A = e_mut.take::().unwrap(); | ^^^^^ second mutable borrow occurs here -27 | -28 | assert_eq!(&mut *gotten, &mut gotten2); // oops UB +LL | +LL | assert_eq!(&mut *gotten, &mut gotten2); // oops UB | ------ first borrow later used here error[E0505]: cannot move out of `e_mut` because it is borrowed - --> tests/ui/entity_ref_mut_lifetime_safety.rs:35:9 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -13 | let mut e_mut = world.entity_mut(e); +LL | let mut e_mut = world.entity_mut(e); | --------- binding `e_mut` declared here ... -34 | let gotten: &A = e_mut.get::().unwrap(); +LL | let gotten: &A = e_mut.get::().unwrap(); | ----- borrow of `e_mut` occurs here -35 | e_mut.despawn(); +LL | e_mut.despawn(); | ^^^^^ move out of `e_mut` occurs here -36 | -37 | assert_eq!(gotten, &A(Box::new(14_usize))); // oops UB +LL | +LL | assert_eq!(gotten, &A(Box::new(14_usize))); // oops UB | ------------------------------------------ borrow later used here error[E0502]: cannot borrow `e_mut` as mutable because it is also borrowed as immutable - --> tests/ui/entity_ref_mut_lifetime_safety.rs:45:34 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -44 | let gotten: &A = e_mut.get::().unwrap(); +LL | let gotten: &A = e_mut.get::().unwrap(); | ----- immutable borrow occurs here -45 | let gotten_mut: Mut = e_mut.get_mut::().unwrap(); +LL | let gotten_mut: Mut = e_mut.get_mut::().unwrap(); | ^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here -46 | -47 | assert_eq!(gotten, &*gotten_mut); // oops UB +LL | +LL | assert_eq!(gotten, &*gotten_mut); // oops UB | -------------------------------- immutable borrow later used here error[E0502]: cannot borrow `e_mut` as immutable because it is also borrowed as mutable - --> tests/ui/entity_ref_mut_lifetime_safety.rs:52:26 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -51 | let gotten_mut: Mut = e_mut.get_mut::().unwrap(); +LL | let gotten_mut: Mut = e_mut.get_mut::().unwrap(); | ----- mutable borrow occurs here -52 | let gotten: &A = e_mut.get::().unwrap(); +LL | let gotten: &A = e_mut.get::().unwrap(); | ^^^^^ immutable borrow occurs here -53 | -54 | assert_eq!(gotten, &*gotten_mut); // oops UB +LL | +LL | assert_eq!(gotten, &*gotten_mut); // oops UB | ---------- mutable borrow later used here error[E0502]: cannot borrow `e_mut` as mutable because it is also borrowed as immutable - --> tests/ui/entity_ref_mut_lifetime_safety.rs:59:9 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -58 | let gotten: &A = e_mut.get::().unwrap(); +LL | let gotten: &A = e_mut.get::().unwrap(); | ----- immutable borrow occurs here -59 | e_mut.insert::(B); +LL | e_mut.insert::(B); | ^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here -60 | -61 | assert_eq!(gotten, &A(Box::new(16_usize))); // oops UB +LL | +LL | assert_eq!(gotten, &A(Box::new(16_usize))); // oops UB | ------------------------------------------ immutable borrow later used here error[E0499]: cannot borrow `e_mut` as mutable more than once at a time - --> tests/ui/entity_ref_mut_lifetime_safety.rs:67:9 + --> tests/ui/entity_ref_mut_lifetime_safety.rs:LL:CC | -66 | let mut gotten_mut: Mut = e_mut.get_mut::().unwrap(); +LL | let mut gotten_mut: Mut = e_mut.get_mut::().unwrap(); | ----- first mutable borrow occurs here -67 | e_mut.insert::(B); +LL | e_mut.insert::(B); | ^^^^^ second mutable borrow occurs here -68 | -69 | assert_eq!(&mut *gotten_mut, &mut A(Box::new(16_usize))); // oops UB +LL | +LL | assert_eq!(&mut *gotten_mut, &mut A(Box::new(16_usize))); // oops UB | ---------- first borrow later used here error: aborting due to 7 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_exact_sized_iterator_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_exact_sized_iterator_safety.stderr index ba14761f58e8f..36cba31cc60df 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_exact_sized_iterator_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_exact_sized_iterator_safety.stderr @@ -1,7 +1,7 @@ error[E0277]: `bevy_ecs::query::Changed` is not a valid `Query` filter based on archetype information - --> tests/ui/query_exact_sized_iterator_safety.rs:7:28 + --> tests/ui/query_exact_sized_iterator_safety.rs:LL:CC | -7 | is_exact_size_iterator(query.iter()); +LL | is_exact_size_iterator(query.iter()); | ---------------------- ^^^^^^^^^^^^ invalid `Query` filter | | | required by a bound introduced by this call @@ -20,15 +20,15 @@ error[E0277]: `bevy_ecs::query::Changed` is not a valid `Query` filter base and 26 others = note: required for `QueryIter<'_, '_, &Foo, bevy_ecs::query::Changed>` to implement `ExactSizeIterator` note: required by a bound in `is_exact_size_iterator` - --> tests/ui/query_exact_sized_iterator_safety.rs:16:30 + --> tests/ui/query_exact_sized_iterator_safety.rs:LL:CC | -16 | fn is_exact_size_iterator(_iter: T) {} +LL | fn is_exact_size_iterator(_iter: T) {} | ^^^^^^^^^^^^^^^^^ required by this bound in `is_exact_size_iterator` error[E0277]: `bevy_ecs::query::Added` is not a valid `Query` filter based on archetype information - --> tests/ui/query_exact_sized_iterator_safety.rs:12:28 + --> tests/ui/query_exact_sized_iterator_safety.rs:LL:CC | -12 | is_exact_size_iterator(query.iter()); +LL | is_exact_size_iterator(query.iter()); | ---------------------- ^^^^^^^^^^^^ invalid `Query` filter | | | required by a bound introduced by this call @@ -47,9 +47,9 @@ error[E0277]: `bevy_ecs::query::Added` is not a valid `Query` filter based and 26 others = note: required for `QueryIter<'_, '_, &Foo, bevy_ecs::query::Added>` to implement `ExactSizeIterator` note: required by a bound in `is_exact_size_iterator` - --> tests/ui/query_exact_sized_iterator_safety.rs:16:30 + --> tests/ui/query_exact_sized_iterator_safety.rs:LL:CC | -16 | fn is_exact_size_iterator(_iter: T) {} +LL | fn is_exact_size_iterator(_iter: T) {} | ^^^^^^^^^^^^^^^^^ required by this bound in `is_exact_size_iterator` error: aborting due to 2 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_iter_combinations_mut_iterator_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_iter_combinations_mut_iterator_safety.stderr index cb40b8f11ccb5..7e5bed5f74c9e 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_iter_combinations_mut_iterator_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_iter_combinations_mut_iterator_safety.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyQueryData` is not satisfied - --> tests/ui/query_iter_combinations_mut_iterator_safety.rs:9:17 + --> tests/ui/query_iter_combinations_mut_iterator_safety.rs:LL:CC | -9 | is_iterator(iter) +LL | is_iterator(iter) | ----------- ^^^^ the trait `ReadOnlyQueryData` is not implemented for `&mut A` | | | required by a bound introduced by this call @@ -19,9 +19,9 @@ error[E0277]: the trait bound `&mut A: ReadOnlyQueryData` is not satisfied = note: `ReadOnlyQueryData` is implemented for `&A`, but not for `&mut A` = note: required for `QueryCombinationIter<'_, '_, &mut A, (), _>` to implement `Iterator` note: required by a bound in `is_iterator` - --> tests/ui/query_iter_combinations_mut_iterator_safety.rs:13:19 + --> tests/ui/query_iter_combinations_mut_iterator_safety.rs:LL:CC | -13 | fn is_iterator(_iter: T) {} +LL | fn is_iterator(_iter: T) {} | ^^^^^^^^ required by this bound in `is_iterator` error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_iter_many_mut_iterator_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_iter_many_mut_iterator_safety.stderr index 24aafb1df49fc..ebf8a3bcdc9d4 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_iter_many_mut_iterator_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_iter_many_mut_iterator_safety.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyQueryData` is not satisfied - --> tests/ui/query_iter_many_mut_iterator_safety.rs:9:17 + --> tests/ui/query_iter_many_mut_iterator_safety.rs:LL:CC | -9 | is_iterator(iter) +LL | is_iterator(iter) | ----------- ^^^^ the trait `ReadOnlyQueryData` is not implemented for `&mut A` | | | required by a bound introduced by this call @@ -19,9 +19,9 @@ error[E0277]: the trait bound `&mut A: ReadOnlyQueryData` is not satisfied = note: `ReadOnlyQueryData` is implemented for `&A`, but not for `&mut A` = note: required for `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter>` to implement `Iterator` note: required by a bound in `is_iterator` - --> tests/ui/query_iter_many_mut_iterator_safety.rs:13:19 + --> tests/ui/query_iter_many_mut_iterator_safety.rs:LL:CC | -13 | fn is_iterator(_iter: T) {} +LL | fn is_iterator(_iter: T) {} | ^^^^^^^^ required by this bound in `is_iterator` error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_lens_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_lens_lifetime_safety.stderr index 170a83d012d43..7ec87f833e898 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_lens_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_lens_lifetime_safety.stderr @@ -1,12 +1,12 @@ error[E0499]: cannot borrow `lens` as mutable more than once at a time - --> tests/ui/query_lens_lifetime_safety.rs:18:39 + --> tests/ui/query_lens_lifetime_safety.rs:LL:CC | -17 | let mut data: Mut = lens.query().get_inner(e).unwrap(); +LL | let mut data: Mut = lens.query().get_inner(e).unwrap(); | ---- first mutable borrow occurs here -18 | let mut data2: Mut = lens.query().get_inner(e).unwrap(); +LL | let mut data2: Mut = lens.query().get_inner(e).unwrap(); | ^^^^ second mutable borrow occurs here -19 | -20 | assert_eq!(&mut *data, &mut *data2); // oops UB +LL | +LL | assert_eq!(&mut *data, &mut *data2); // oops UB | ---- first borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_lifetime_safety.stderr index c634ea8a70e4b..ed56f6239bd7c 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_lifetime_safety.stderr @@ -1,111 +1,111 @@ error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_lifetime_safety.rs:17:39 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -16 | let data: &Foo = query.get(e).unwrap(); +LL | let data: &Foo = query.get(e).unwrap(); | ----- immutable borrow occurs here -17 | let mut data2: Mut = query.get_mut(e).unwrap(); +LL | let mut data2: Mut = query.get_mut(e).unwrap(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here -18 | -19 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----------------------------- immutable borrow later used here error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_lifetime_safety.rs:24:30 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -23 | let mut data2: Mut = query.get_mut(e).unwrap(); +LL | let mut data2: Mut = query.get_mut(e).unwrap(); | ----- mutable borrow occurs here -24 | let data: &Foo = query.get(e).unwrap(); +LL | let data: &Foo = query.get(e).unwrap(); | ^^^^^ immutable borrow occurs here -25 | -26 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----- mutable borrow later used here error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_lifetime_safety.rs:31:39 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -30 | let data: &Foo = query.single(); +LL | let data: &Foo = query.single(); | ----- immutable borrow occurs here -31 | let mut data2: Mut = query.single_mut(); +LL | let mut data2: Mut = query.single_mut(); | ^^^^^^^^^^^^^^^^^^ mutable borrow occurs here -32 | -33 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----------------------------- immutable borrow later used here error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_lifetime_safety.rs:38:30 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -37 | let mut data2: Mut = query.single_mut(); +LL | let mut data2: Mut = query.single_mut(); | ----- mutable borrow occurs here -38 | let data: &Foo = query.single(); +LL | let data: &Foo = query.single(); | ^^^^^ immutable borrow occurs here -39 | -40 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----- mutable borrow later used here error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_lifetime_safety.rs:45:39 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -44 | let data: &Foo = query.get_single().unwrap(); +LL | let data: &Foo = query.get_single().unwrap(); | ----- immutable borrow occurs here -45 | let mut data2: Mut = query.get_single_mut().unwrap(); +LL | let mut data2: Mut = query.get_single_mut().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here -46 | -47 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----------------------------- immutable borrow later used here error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_lifetime_safety.rs:52:30 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -51 | let mut data2: Mut = query.get_single_mut().unwrap(); +LL | let mut data2: Mut = query.get_single_mut().unwrap(); | ----- mutable borrow occurs here -52 | let data: &Foo = query.get_single().unwrap(); +LL | let data: &Foo = query.get_single().unwrap(); | ^^^^^ immutable borrow occurs here -53 | -54 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----- mutable borrow later used here error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_lifetime_safety.rs:59:39 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -58 | let data: &Foo = query.iter().next().unwrap(); +LL | let data: &Foo = query.iter().next().unwrap(); | ----- immutable borrow occurs here -59 | let mut data2: Mut = query.iter_mut().next().unwrap(); +LL | let mut data2: Mut = query.iter_mut().next().unwrap(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here -60 | -61 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----------------------------- immutable borrow later used here error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_lifetime_safety.rs:66:30 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -65 | let mut data2: Mut = query.iter_mut().next().unwrap(); +LL | let mut data2: Mut = query.iter_mut().next().unwrap(); | ----- mutable borrow occurs here -66 | let data: &Foo = query.iter().next().unwrap(); +LL | let data: &Foo = query.iter().next().unwrap(); | ^^^^^ immutable borrow occurs here -67 | -68 | assert_eq!(data, &mut *data2); // oops UB +LL | +LL | assert_eq!(data, &mut *data2); // oops UB | ----- mutable borrow later used here error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_lifetime_safety.rs:75:13 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -74 | query.iter().for_each(|data| opt_data = Some(data)); +LL | query.iter().for_each(|data| opt_data = Some(data)); | ----- immutable borrow occurs here -75 | query.iter_mut().for_each(|data| opt_data_2 = Some(data)); +LL | query.iter_mut().for_each(|data| opt_data_2 = Some(data)); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here -76 | -77 | assert_eq!(opt_data.unwrap(), &mut *opt_data_2.unwrap()); // oops UB +LL | +LL | assert_eq!(opt_data.unwrap(), &mut *opt_data_2.unwrap()); // oops UB | -------- immutable borrow later used here error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_lifetime_safety.rs:84:13 + --> tests/ui/query_lifetime_safety.rs:LL:CC | -83 | query.iter_mut().for_each(|data| opt_data_2 = Some(data)); +LL | query.iter_mut().for_each(|data| opt_data_2 = Some(data)); | ----- mutable borrow occurs here -84 | query.iter().for_each(|data| opt_data = Some(data)); +LL | query.iter().for_each(|data| opt_data = Some(data)); | ^^^^^ immutable borrow occurs here -85 | -86 | assert_eq!(opt_data.unwrap(), &mut *opt_data_2.unwrap()); // oops UB +LL | +LL | assert_eq!(opt_data.unwrap(), &mut *opt_data_2.unwrap()); // oops UB | ---------- mutable borrow later used here error: aborting due to 10 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_to_readonly.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_to_readonly.stderr index 30cbc3c14221b..287997df80d88 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_to_readonly.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_to_readonly.stderr @@ -1,47 +1,47 @@ error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_to_readonly.rs:9:18 - | -8 | for _ in query.iter_mut() { - | ---------------- - | | - | mutable borrow occurs here - | mutable borrow later used here -9 | for _ in query.as_readonly().iter() {} - | ^^^^^ immutable borrow occurs here + --> tests/ui/query_to_readonly.rs:LL:CC + | +LL | for _ in query.iter_mut() { + | ---------------- + | | + | mutable borrow occurs here + | mutable borrow later used here +LL | for _ in query.as_readonly().iter() {} + | ^^^^^ immutable borrow occurs here error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_to_readonly.rs:15:18 + --> tests/ui/query_to_readonly.rs:LL:CC | -14 | for _ in query.as_readonly().iter() { +LL | for _ in query.as_readonly().iter() { | -------------------------- | | | immutable borrow occurs here | immutable borrow later used here -15 | for _ in query.iter_mut() {} +LL | for _ in query.iter_mut() {} | ^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/query_to_readonly.rs:41:30 + --> tests/ui/query_to_readonly.rs:LL:CC | -38 | let mut mut_foo = query.single_mut(); +LL | let mut mut_foo = query.single_mut(); | ----- mutable borrow occurs here ... -41 | let readonly_query = query.as_readonly(); +LL | let readonly_query = query.as_readonly(); | ^^^^^ immutable borrow occurs here ... -46 | *mut_foo = Foo; +LL | *mut_foo = Foo; | ------- mutable borrow later used here error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/query_to_readonly.rs:58:27 + --> tests/ui/query_to_readonly.rs:LL:CC | -54 | let readonly_query = query.as_readonly(); +LL | let readonly_query = query.as_readonly(); | ----- immutable borrow occurs here ... -58 | let mut mut_foo = query.single_mut(); +LL | let mut mut_foo = query.single_mut(); | ^^^^^^^^^^^^^^^^^^ mutable borrow occurs here ... -61 | println!("{ref_foo:?}"); +LL | println!("{ref_foo:?}"); | ----------- immutable borrow later used here error: aborting due to 4 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/query_transmute_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/query_transmute_safety.stderr index d0234b197e595..d1e2928ad4a0b 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/query_transmute_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/query_transmute_safety.stderr @@ -1,23 +1,23 @@ error[E0499]: cannot borrow `query` as mutable more than once at a time - --> tests/ui/query_transmute_safety.rs:19:26 + --> tests/ui/query_transmute_safety.rs:LL:CC | -18 | let mut lens_a = query.transmute_lens::<&mut Foo>(); +LL | let mut lens_a = query.transmute_lens::<&mut Foo>(); | ----- first mutable borrow occurs here -19 | let mut lens_b = query.transmute_lens::<&mut Foo>(); +LL | let mut lens_b = query.transmute_lens::<&mut Foo>(); | ^^^^^ second mutable borrow occurs here ... -22 | let mut query_a = lens_a.query(); +LL | let mut query_a = lens_a.query(); | ------ first borrow later used here error[E0499]: cannot borrow `lens` as mutable more than once at a time - --> tests/ui/query_transmute_safety.rs:34:27 + --> tests/ui/query_transmute_safety.rs:LL:CC | -33 | let mut query_a = lens.query(); +LL | let mut query_a = lens.query(); | ---- first mutable borrow occurs here -34 | let mut query_b = lens.query(); +LL | let mut query_b = lens.query(); | ^^^^ second mutable borrow occurs here ... -37 | let a = query_a.single_mut(); +LL | let a = query_a.single_mut(); | ------- first borrow later used here error: aborting due to 2 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_param_derive_readonly.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_param_derive_readonly.stderr index 2f767d960cb2f..193096df0c4a1 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_param_derive_readonly.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_param_derive_readonly.stderr @@ -1,9 +1,9 @@ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyQueryData` is not satisfied - --> tests/ui/system_param_derive_readonly.rs:16:11 - | -16 | state.get(&world); - | ^^^ the trait `ReadOnlyQueryData` is not implemented for `&'static mut Foo` - | + --> tests/ui/system_param_derive_readonly.rs:LL:CC + | +LL | state.get(&world); + | ^^^ the trait `ReadOnlyQueryData` is not implemented for `&'static mut Foo` + | = help: the following other types implement trait `ReadOnlyQueryData`: &Archetype &T @@ -19,13 +19,13 @@ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyQueryData` is not satis = note: 1 redundant requirement hidden = note: required for `Mutable<'_, '_>` to implement `ReadOnlySystemParam` note: required by a bound in `SystemState::::get` - --> $BEVY_ROOT/bevy_ecs/src/system/function_system.rs:487:16 - | -485 | pub fn get<'w, 's>(&'s mut self, world: &'w World) -> SystemParamItem<'w, 's, Param> - | --- required by a bound in this associated function -486 | where -487 | Param: ReadOnlySystemParam, - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `SystemState::::get` + --> BEVY_ROOT/bevy_ecs/src/system/function_system.rs:LL:CC + | +LL | pub fn get<'w, 's>(&'s mut self, world: &'w World) -> SystemParamItem<'w, 's, Param> + | --- required by a bound in this associated function +LL | where +LL | Param: ReadOnlySystemParam, + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `SystemState::::get` error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_lifetime_safety.stderr index cd003db5125fe..fee35c7e052f0 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_lifetime_safety.stderr @@ -1,12 +1,12 @@ error[E0499]: cannot borrow `query` as mutable more than once at a time - --> tests/ui/system_query_get_lifetime_safety.rs:8:14 + --> tests/ui/system_query_get_lifetime_safety.rs:LL:CC | -7 | let a1 = query.get_mut(e).unwrap(); +LL | let a1 = query.get_mut(e).unwrap(); | ----- first mutable borrow occurs here -8 | let a2 = query.get_mut(e).unwrap(); +LL | let a2 = query.get_mut(e).unwrap(); | ^^^^^ second mutable borrow occurs here -9 | -10 | println!("{} {}", a1.0, a2.0); +LL | +LL | println!("{} {}", a1.0, a2.0); | -- first borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_lifetime_safety.stderr index 91e8b81509e05..ad89898e66235 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_lifetime_safety.stderr @@ -1,12 +1,12 @@ error[E0502]: cannot borrow `query` as mutable because it is also borrowed as immutable - --> tests/ui/system_query_get_many_lifetime_safety.rs:8:14 + --> tests/ui/system_query_get_many_lifetime_safety.rs:LL:CC | -7 | let a1 = query.get_many([e, e]).unwrap(); +LL | let a1 = query.get_many([e, e]).unwrap(); | ----- immutable borrow occurs here -8 | let a2 = query.get_mut(e).unwrap(); +LL | let a2 = query.get_mut(e).unwrap(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here -9 | -10 | println!("{} {}", a1[0].0, a2.0); +LL | +LL | println!("{} {}", a1[0].0, a2.0); | ----- immutable borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_mut_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_mut_lifetime_safety.stderr index 567a1da1a683e..7764b5617db63 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_mut_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_get_many_mut_lifetime_safety.stderr @@ -1,12 +1,12 @@ error[E0499]: cannot borrow `query` as mutable more than once at a time - --> tests/ui/system_query_get_many_mut_lifetime_safety.rs:8:14 + --> tests/ui/system_query_get_many_mut_lifetime_safety.rs:LL:CC | -7 | let a1 = query.get_many_mut([e, e]).unwrap(); +LL | let a1 = query.get_many_mut([e, e]).unwrap(); | ----- first mutable borrow occurs here -8 | let a2 = query.get_mut(e).unwrap(); +LL | let a2 = query.get_mut(e).unwrap(); | ^^^^^ second mutable borrow occurs here -9 | -10 | println!("{} {}", a1[0].0, a2.0); +LL | +LL | println!("{} {}", a1[0].0, a2.0); | ----- first borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_lifetime_safety.stderr index bcae3940a4811..588ed0e7e4f18 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_lifetime_safety.stderr @@ -1,13 +1,13 @@ error[E0499]: cannot borrow `query` as mutable more than once at a time - --> tests/ui/system_query_iter_lifetime_safety.rs:10:21 + --> tests/ui/system_query_iter_lifetime_safety.rs:LL:CC | -7 | let mut iter = query.iter_mut(); +LL | let mut iter = query.iter_mut(); | ----- first mutable borrow occurs here ... -10 | let mut iter2 = query.iter_mut(); +LL | let mut iter2 = query.iter_mut(); | ^^^^^ second mutable borrow occurs here ... -14 | println!("{}", a.0); +LL | println!("{}", a.0); | --- first borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_many_mut_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_many_mut_lifetime_safety.stderr index 70db748d3e57a..42c1454655f20 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_many_mut_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_many_mut_lifetime_safety.stderr @@ -1,9 +1,9 @@ error[E0499]: cannot borrow `iter` as mutable more than once at a time - --> tests/ui/system_query_iter_many_mut_lifetime_safety.rs:10:25 + --> tests/ui/system_query_iter_many_mut_lifetime_safety.rs:LL:CC | -10 | while let Some(a) = iter.fetch_next() { +LL | while let Some(a) = iter.fetch_next() { | ^^^^ `iter` was mutably borrowed here in the previous iteration of the loop -11 | results.push(a); +LL | results.push(a); | ------- first borrow used here, in later iteration of loop error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_sort_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_sort_lifetime_safety.stderr index 4565ece326b29..51ab7fc22d920 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_sort_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_iter_sort_lifetime_safety.stderr @@ -1,12 +1,12 @@ error[E0521]: borrowed data escapes outside of closure - --> tests/ui/system_query_iter_sort_lifetime_safety.rs:12:9 + --> tests/ui/system_query_iter_sort_lifetime_safety.rs:LL:CC | -9 | let mut stored: Option<&A> = None; +LL | let mut stored: Option<&A> = None; | ---------- `stored` declared here, outside of the closure body -10 | let mut sorted = iter.sort_by::<&A>(|left, _right| { +LL | let mut sorted = iter.sort_by::<&A>(|left, _right| { | ---- `left` is a reference that is only valid in the closure body -11 | // Try to smuggle the lens item out of the closure. -12 | stored = Some(left); +LL | // Try to smuggle the lens item out of the closure. +LL | stored = Some(left); | ^^^^^^^^^^^^^^^^^^^ `left` escapes the closure body here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_get_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_get_lifetime_safety.stderr index be0598f1eb767..c28b2c245ba65 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_get_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_get_lifetime_safety.stderr @@ -1,25 +1,25 @@ error[E0499]: cannot borrow `queries` as mutable more than once at a time - --> tests/ui/system_query_set_get_lifetime_safety.rs:10:14 + --> tests/ui/system_query_set_get_lifetime_safety.rs:LL:CC | -7 | let mut q2 = queries.p0(); +LL | let mut q2 = queries.p0(); | ------- first mutable borrow occurs here ... -10 | let q1 = queries.p1(); +LL | let q1 = queries.p1(); | ^^^^^^^ second mutable borrow occurs here ... -15 | b.0 = a.0 +LL | b.0 = a.0 | - first borrow later used here error[E0499]: cannot borrow `queries` as mutable more than once at a time - --> tests/ui/system_query_set_get_lifetime_safety.rs:22:18 + --> tests/ui/system_query_set_get_lifetime_safety.rs:LL:CC | -19 | let q1 = queries.p1(); +LL | let q1 = queries.p1(); | ------- first mutable borrow occurs here ... -22 | let mut q2 = queries.p0(); +LL | let mut q2 = queries.p0(); | ^^^^^^^ second mutable borrow occurs here ... -27 | b.0 = a.0 +LL | b.0 = a.0 | --- first borrow later used here error: aborting due to 2 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_iter_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_iter_lifetime_safety.stderr index 8d1a50bd3f8cc..1eb8b6b35657e 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_iter_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_query_set_iter_lifetime_safety.stderr @@ -1,25 +1,25 @@ error[E0499]: cannot borrow `queries` as mutable more than once at a time - --> tests/ui/system_query_set_iter_lifetime_safety.rs:11:14 + --> tests/ui/system_query_set_iter_lifetime_safety.rs:LL:CC | -7 | let mut q2 = queries.p0(); +LL | let mut q2 = queries.p0(); | ------- first mutable borrow occurs here ... -11 | let q1 = queries.p1(); +LL | let q1 = queries.p1(); | ^^^^^^^ second mutable borrow occurs here ... -16 | b.0 = a.0 +LL | b.0 = a.0 | - first borrow later used here error[E0499]: cannot borrow `queries` as mutable more than once at a time - --> tests/ui/system_query_set_iter_lifetime_safety.rs:24:18 + --> tests/ui/system_query_set_iter_lifetime_safety.rs:LL:CC | -20 | let q1 = queries.p1(); +LL | let q1 = queries.p1(); | ------- first mutable borrow occurs here ... -24 | let mut q2 = queries.p0(); +LL | let mut q2 = queries.p0(); | ^^^^^^^ second mutable borrow occurs here ... -29 | b.0 = a.0; +LL | b.0 = a.0; | --- first borrow later used here error: aborting due to 2 previous errors diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_state_get_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_state_get_lifetime_safety.stderr index 40d137a751458..46f8bb5af046a 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_state_get_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_state_get_lifetime_safety.stderr @@ -1,13 +1,13 @@ error[E0502]: cannot borrow `*world` as mutable because it is also borrowed as immutable - --> tests/ui/system_state_get_lifetime_safety.rs:20:22 + --> tests/ui/system_state_get_lifetime_safety.rs:LL:CC | -17 | let q1 = self.state_r.get(&world); +LL | let q1 = self.state_r.get(&world); | ------ immutable borrow occurs here ... -20 | let mut q2 = self.state_w.get_mut(world); +LL | let mut q2 = self.state_w.get_mut(world); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here ... -24 | println!("{}", a1.0); +LL | println!("{}", a1.0); | ---- immutable borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_lifetime_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_lifetime_safety.stderr index 2e53718b8195b..33a882222ebbf 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_lifetime_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_lifetime_safety.stderr @@ -1,13 +1,13 @@ error[E0502]: cannot borrow `*world` as mutable because it is also borrowed as immutable - --> tests/ui/system_state_iter_lifetime_safety.rs:20:22 + --> tests/ui/system_state_iter_lifetime_safety.rs:LL:CC | -17 | let q1 = self.state_r.get(&world); +LL | let q1 = self.state_r.get(&world); | ------ immutable borrow occurs here ... -20 | let mut q2 = self.state_w.get_mut(world); +LL | let mut q2 = self.state_w.get_mut(world); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here ... -24 | println!("{}", a1.0); +LL | println!("{}", a1.0); | ---- immutable borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_mut_overlap_safety.stderr b/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_mut_overlap_safety.stderr index 47168d5f5086a..9248ae9436e43 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_mut_overlap_safety.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/system_state_iter_mut_overlap_safety.stderr @@ -1,13 +1,13 @@ error[E0502]: cannot borrow `query` as immutable because it is also borrowed as mutable - --> tests/ui/system_state_iter_mut_overlap_safety.rs:18:13 + --> tests/ui/system_state_iter_mut_overlap_safety.rs:LL:CC | -15 | let mut_vec = query.iter_mut().collect::>>(); +LL | let mut_vec = query.iter_mut().collect::>>(); | ----- mutable borrow occurs here ... -18 | query.iter().collect::>(), +LL | query.iter().collect::>(), | ^^^^^ immutable borrow occurs here ... -24 | mut_vec.iter().map(|m| **m).collect::>(), +LL | mut_vec.iter().map(|m| **m).collect::>(), | ------- mutable borrow later used here error: aborting due to 1 previous error diff --git a/crates/bevy_ecs/compile_fail/tests/ui/world_query_derive.stderr b/crates/bevy_ecs/compile_fail/tests/ui/world_query_derive.stderr index 4460ce08a0471..f334e1d79a53f 100644 --- a/crates/bevy_ecs/compile_fail/tests/ui/world_query_derive.stderr +++ b/crates/bevy_ecs/compile_fail/tests/ui/world_query_derive.stderr @@ -1,25 +1,25 @@ error: invalid attribute, expected `mutable` or `derive` - --> tests/ui/world_query_derive.rs:14:14 + --> tests/ui/world_query_derive.rs:LL:CC | -14 | #[query_data(mut)] +LL | #[query_data(mut)] | ^^^ error: `mutable` does not take any arguments - --> tests/ui/world_query_derive.rs:21:14 + --> tests/ui/world_query_derive.rs:LL:CC | -21 | #[query_data(mutable(foo))] +LL | #[query_data(mutable(foo))] | ^^^^^^^ error: `derive` requires at least one argument - --> tests/ui/world_query_derive.rs:28:14 + --> tests/ui/world_query_derive.rs:LL:CC | -28 | #[query_data(derive)] +LL | #[query_data(derive)] | ^^^^^^ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyQueryData` is not satisfied - --> tests/ui/world_query_derive.rs:10:8 + --> tests/ui/world_query_derive.rs:LL:CC | -10 | a: &'static mut Foo, +LL | a: &'static mut Foo, | ^^^^^^^^^^^^^^^^ the trait `ReadOnlyQueryData` is not implemented for `&'static mut Foo` | = help: the following other types implement trait `ReadOnlyQueryData`: @@ -33,16 +33,16 @@ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyQueryData` is not satis (F0, F1, F2, F3, F4) and 39 others note: required by a bound in `_::assert_readonly` - --> tests/ui/world_query_derive.rs:7:10 + --> tests/ui/world_query_derive.rs:LL:CC | -7 | #[derive(QueryData)] +LL | #[derive(QueryData)] | ^^^^^^^^^ required by this bound in `assert_readonly` = note: this error originates in the derive macro `QueryData` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `MutableMarked: ReadOnlyQueryData` is not satisfied - --> tests/ui/world_query_derive.rs:43:8 + --> tests/ui/world_query_derive.rs:LL:CC | -43 | a: MutableMarked, +LL | a: MutableMarked, | ^^^^^^^^^^^^^ the trait `ReadOnlyQueryData` is not implemented for `MutableMarked` | = help: the following other types implement trait `ReadOnlyQueryData`: @@ -56,9 +56,9 @@ error[E0277]: the trait bound `MutableMarked: ReadOnlyQueryData` is not satisfie (F0, F1, F2, F3, F4) and 39 others note: required by a bound in `_::assert_readonly` - --> tests/ui/world_query_derive.rs:40:10 + --> tests/ui/world_query_derive.rs:LL:CC | -40 | #[derive(QueryData)] +LL | #[derive(QueryData)] | ^^^^^^^^^ required by this bound in `assert_readonly` = note: this error originates in the derive macro `QueryData` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/bevy_reflect/compile_fail/tests/into_function/arguments_fail.stderr b/crates/bevy_reflect/compile_fail/tests/into_function/arguments_fail.stderr new file mode 100644 index 0000000000000..c096699d2e3d6 --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/into_function/arguments_fail.stderr @@ -0,0 +1,45 @@ +error[E0599]: the method `into_function` exists for fn item `fn(i32, ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) {too_many_arguments}`, but its trait bounds were not satisfied + --> tests/into_function/arguments_fail.rs:LL:CC + | +LL | let _ = too_many_arguments.into_function(); + | ^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds + | + = note: the full type name has been written to 'BEVY_ROOT/bevy_reflect/compile_fail/target/ui/0/tests/into_function/long-type.sr'' + = note: consider using `--verbose` to print the full type name to the console + = note: the following trait bounds were not satisfied: + `fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: ReflectFn<'_, _>` + which is required by `fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: IntoFunction<'_, (_, _)>` + `fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: TypedFunction<_>` + which is required by `fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: IntoFunction<'_, (_, _)>` + `&fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: ReflectFn<'_, _>` + which is required by `&fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: IntoFunction<'_, (_, _)>` + `&fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: TypedFunction<_>` + which is required by `&fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: IntoFunction<'_, (_, _)>` + `&mut fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: ReflectFn<'_, _>` + which is required by `&mut fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: IntoFunction<'_, (_, _)>` + `&mut fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: TypedFunction<_>` + which is required by `&mut fn(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {too_many_arguments}: IntoFunction<'_, (_, _)>` + +error[E0599]: the method `into_function` exists for fn item `fn(Foo) {argument_not_reflect}`, but its trait bounds were not satisfied + --> tests/into_function/arguments_fail.rs:LL:CC + | +LL | let _ = argument_not_reflect.into_function(); + | ^^^^^^^^^^^^^ method cannot be called on `fn(Foo) {argument_not_reflect}` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `fn(Foo) {argument_not_reflect}: ReflectFn<'_, _>` + which is required by `fn(Foo) {argument_not_reflect}: IntoFunction<'_, (_, _)>` + `fn(Foo) {argument_not_reflect}: TypedFunction<_>` + which is required by `fn(Foo) {argument_not_reflect}: IntoFunction<'_, (_, _)>` + `&fn(Foo) {argument_not_reflect}: ReflectFn<'_, _>` + which is required by `&fn(Foo) {argument_not_reflect}: IntoFunction<'_, (_, _)>` + `&fn(Foo) {argument_not_reflect}: TypedFunction<_>` + which is required by `&fn(Foo) {argument_not_reflect}: IntoFunction<'_, (_, _)>` + `&mut fn(Foo) {argument_not_reflect}: ReflectFn<'_, _>` + which is required by `&mut fn(Foo) {argument_not_reflect}: IntoFunction<'_, (_, _)>` + `&mut fn(Foo) {argument_not_reflect}: TypedFunction<_>` + which is required by `&mut fn(Foo) {argument_not_reflect}: IntoFunction<'_, (_, _)>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/crates/bevy_reflect/compile_fail/tests/into_function/closure_fail.stderr b/crates/bevy_reflect/compile_fail/tests/into_function/closure_fail.stderr new file mode 100644 index 0000000000000..005f1bf005ef0 --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/into_function/closure_fail.stderr @@ -0,0 +1,18 @@ +error[E0597]: `value` does not live long enough + --> tests/into_function/closure_fail.rs:LL:CC + | +LL | let value = String::from("Hello, World!"); + | ----- binding `value` declared here +LL | let closure_capture_reference = || println!("{}", value); + | -- ^^^^^ borrowed value does not live long enough + | | + | value captured here +... +LL | let _: DynamicFunction<'static> = closure_capture_reference.into_function(); + | ------------------------ type annotation requires that `value` is borrowed for `'static` +LL | } + | - `value` dropped here while still borrowed + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/crates/bevy_reflect/compile_fail/tests/into_function/return_fail.stderr b/crates/bevy_reflect/compile_fail/tests/into_function/return_fail.stderr new file mode 100644 index 0000000000000..5dac8c4715fc1 --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/into_function/return_fail.stderr @@ -0,0 +1,39 @@ +error[E0599]: the method `into_function` exists for fn item `fn() -> Foo {return_not_reflect}`, but its trait bounds were not satisfied + --> tests/into_function/return_fail.rs:LL:CC + | +LL | let _ = return_not_reflect.into_function(); + | ^^^^^^^^^^^^^ method cannot be called on `fn() -> Foo {return_not_reflect}` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `fn() -> Foo {return_not_reflect}: ReflectFn<'_, _>` + which is required by `fn() -> Foo {return_not_reflect}: IntoFunction<'_, (_, _)>` + `fn() -> Foo {return_not_reflect}: TypedFunction<_>` + which is required by `fn() -> Foo {return_not_reflect}: IntoFunction<'_, (_, _)>` + `&fn() -> Foo {return_not_reflect}: ReflectFn<'_, _>` + which is required by `&fn() -> Foo {return_not_reflect}: IntoFunction<'_, (_, _)>` + `&fn() -> Foo {return_not_reflect}: TypedFunction<_>` + which is required by `&fn() -> Foo {return_not_reflect}: IntoFunction<'_, (_, _)>` + `&mut fn() -> Foo {return_not_reflect}: ReflectFn<'_, _>` + which is required by `&mut fn() -> Foo {return_not_reflect}: IntoFunction<'_, (_, _)>` + `&mut fn() -> Foo {return_not_reflect}: TypedFunction<_>` + which is required by `&mut fn() -> Foo {return_not_reflect}: IntoFunction<'_, (_, _)>` + +error[E0599]: the method `into_function` exists for fn item `fn(&String, &String) -> &String {return_with_invalid_lifetime}`, but its trait bounds were not satisfied + --> tests/into_function/return_fail.rs:LL:CC + | +LL | let _ = return_with_invalid_lifetime.into_function(); + | ^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds + | + = note: the full type name has been written to 'BEVY_ROOT/bevy_reflect/compile_fail/target/ui/0/tests/into_function/long-type.sr'' + = note: consider using `--verbose` to print the full type name to the console + = note: the following trait bounds were not satisfied: + `for<'a, 'b> fn(&'a std::string::String, &'b std::string::String) -> &'b std::string::String {return_with_invalid_lifetime}: ReflectFn<'_, _>` + which is required by `for<'a, 'b> fn(&'a std::string::String, &'b std::string::String) -> &'b std::string::String {return_with_invalid_lifetime}: IntoFunction<'_, (_, _)>` + `&for<'a, 'b> fn(&'a std::string::String, &'b std::string::String) -> &'b std::string::String {return_with_invalid_lifetime}: ReflectFn<'_, _>` + which is required by `&for<'a, 'b> fn(&'a std::string::String, &'b std::string::String) -> &'b std::string::String {return_with_invalid_lifetime}: IntoFunction<'_, (_, _)>` + `&mut for<'a, 'b> fn(&'a std::string::String, &'b std::string::String) -> &'b std::string::String {return_with_invalid_lifetime}: ReflectFn<'_, _>` + which is required by `&mut for<'a, 'b> fn(&'a std::string::String, &'b std::string::String) -> &'b std::string::String {return_with_invalid_lifetime}: IntoFunction<'_, (_, _)>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_derive/custom_where_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_derive/custom_where_fail.stderr index 0c91377b17dfb..b41380678482d 100644 --- a/crates/bevy_reflect/compile_fail/tests/reflect_derive/custom_where_fail.stderr +++ b/crates/bevy_reflect/compile_fail/tests/reflect_derive/custom_where_fail.stderr @@ -1,8 +1,8 @@ error: expected `:` - --> tests/reflect_derive/custom_where_fail.rs:15:44 + --> tests/reflect_derive/custom_where_fail.rs:LL:CC | -15 | #[reflect(where T: std::fmt::Debug, MyTrait)] - | ^ +LL | #[reflect(where T: core::fmt::Debug, MyTrait)] + | ^ error: aborting due to 1 previous error diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_derive/from_reflect_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_derive/from_reflect_fail.stderr index 54d017767740e..f7c5408829074 100644 --- a/crates/bevy_reflect/compile_fail/tests/reflect_derive/from_reflect_fail.stderr +++ b/crates/bevy_reflect/compile_fail/tests/reflect_derive/from_reflect_fail.stderr @@ -1,19 +1,19 @@ error: `from_reflect` already set to false - --> tests/reflect_derive/from_reflect_fail.rs:6:26 - | -6 | #[reflect(from_reflect = true)] - | ^^^^ + --> tests/reflect_derive/from_reflect_fail.rs:LL:CC + | +LL | #[reflect(from_reflect = true)] + | ^^^^ error: `from_reflect` already set to true - --> tests/reflect_derive/from_reflect_fail.rs:15:26 + --> tests/reflect_derive/from_reflect_fail.rs:LL:CC | -15 | #[reflect(from_reflect = false)] +LL | #[reflect(from_reflect = false)] | ^^^^^ error[E0119]: conflicting implementations of trait `FromReflect` for type `Baz` - --> tests/reflect_derive/from_reflect_fail.rs:22:19 + --> tests/reflect_derive/from_reflect_fail.rs:LL:CC | -22 | #[derive(Reflect, FromReflect)] +LL | #[derive(Reflect, FromReflect)] | ------- ^^^^^^^^^^^ conflicting implementation for `Baz` | | | first implementation here diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_derive/generics_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_derive/generics_fail.stderr index 8c4890827de6c..fbe3e8662c334 100644 --- a/crates/bevy_reflect/compile_fail/tests/reflect_derive/generics_fail.stderr +++ b/crates/bevy_reflect/compile_fail/tests/reflect_derive/generics_fail.stderr @@ -1,58 +1,86 @@ -error[E0277]: `NoReflect` can not be reflected - --> tests/reflect_derive/generics_fail.rs:18:21 - | -18 | foo.get_field::("a").unwrap(); - | --------- ^^^^^^^^^ the trait `Reflect` is not implemented for `NoReflect` - | | - | required by a bound introduced by this call - | - = note: Try using `#[derive(Reflect)]` +error[E0277]: `NoReflect` does not implement `Reflect` so cannot be fully reflected + --> tests/reflect_derive/generics_fail.rs:LL:CC + | +LL | foo.get_field::("a").unwrap(); + | --------- ^^^^^^^^^ the trait `Reflect` is not implemented for `NoReflect` + | | + | required by a bound introduced by this call + | + = note: consider annotating `NoReflect` with `#[derive(Reflect)]` = help: the following other types implement trait `Reflect`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and 74 others + &'static Location<'static> + &'static Path + &'static str + () + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + and 80 others note: required by a bound in `bevy_reflect::GetField::get_field` - --> $BEVY_ROOT/crates/bevy_reflect/src/struct_trait.rs:244:21 - | -244 | fn get_field(&self, name: &str) -> Option<&T>; - | ^^^^^^^ required by this bound in `GetField::get_field` + --> BEVY_ROOT/bevy_reflect/src/struct_trait.rs:LL:CC + | +LL | fn get_field(&self, name: &str) -> Option<&T>; + | ^^^^^^^ required by this bound in `GetField::get_field` + +error[E0277]: `NoReflect` does not implement `Typed` so cannot provide static type information + --> tests/reflect_derive/generics_fail.rs:LL:CC + | +LL | let mut foo: Box = Box::new(Foo:: { a: NoReflect(42.0) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Typed` is not implemented for `NoReflect` + | + = note: consider annotating `NoReflect` with `#[derive(Reflect)]` + = help: the following other types implement trait `Typed`: + &'static Location<'static> + &'static Path + &'static str + () + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + and 81 others + = note: required for `NoReflect` to implement `MaybeTyped` +note: required for `Foo` to implement `bevy_reflect::Struct` + --> tests/reflect_derive/generics_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro +LL | #[reflect(from_reflect = false)] +LL | struct Foo { + | ^^^^^^ + = note: required for the cast from `Box>` to `Box<(dyn bevy_reflect::Struct + 'static)>` + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: `NoReflect` does not provide type registration information - --> tests/reflect_derive/generics_fail.rs:14:36 +error[E0277]: `NoReflect` does not implement `GetTypeRegistration` so cannot provide type registration information + --> tests/reflect_derive/generics_fail.rs:LL:CC | -14 | let mut foo: Box = Box::new(Foo:: { a: NoReflect(42.0) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid Type +LL | let mut foo: Box = Box::new(Foo:: { a: NoReflect(42.0) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `GetTypeRegistration` is not implemented for `NoReflect` | - = help: the trait `GetTypeRegistration` is not implemented for `NoReflect`, which is required by `Foo: bevy_reflect::Struct` - = note: Try using `#[derive(Reflect)]` + = note: consider annotating `NoReflect` with `#[derive(Reflect)]` = help: the following other types implement trait `GetTypeRegistration`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and 67 others + &'static Location<'static> + &'static Path + &'static str + () + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + and 80 others = note: required for `NoReflect` to implement `RegisterForReflection` note: required for `Foo` to implement `bevy_reflect::Struct` - --> tests/reflect_derive/generics_fail.rs:3:10 + --> tests/reflect_derive/generics_fail.rs:LL:CC | -3 | #[derive(Reflect)] +LL | #[derive(Reflect)] | ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro -4 | #[reflect(from_reflect = false)] -5 | struct Foo { +LL | #[reflect(from_reflect = false)] +LL | struct Foo { | ^^^^^^ = note: required for the cast from `Box>` to `Box<(dyn bevy_reflect::Struct + 'static)>` = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_derive/lifetimes_pass.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_derive/lifetimes_pass.stderr index a9da4154a28d8..6f3e82825330a 100644 --- a/crates/bevy_reflect/compile_fail/tests/reflect_derive/lifetimes_pass.stderr +++ b/crates/bevy_reflect/compile_fail/tests/reflect_derive/lifetimes_pass.stderr @@ -1,12 +1,12 @@ warning: field `value` is never read - --> tests/reflect_derive/lifetimes_pass.rs:8:5 - | -6 | struct Foo<'a: 'static> { - | --- field in this struct -7 | #[reflect(ignore)] -8 | value: &'a str, - | ^^^^^ - | + --> tests/reflect_derive/lifetimes_pass.rs:LL:CC + | +LL | struct Foo<'a: 'static> { + | --- field in this struct +LL | #[reflect(ignore)] +LL | value: &'a str, + | ^^^^^ + | = note: `#[warn(dead_code)]` on by default warning: 1 warning emitted diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_remote/incorrect_wrapper_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_remote/incorrect_wrapper_fail.stderr new file mode 100644 index 0000000000000..e41f725c47979 --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/reflect_remote/incorrect_wrapper_fail.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `MyFoo: ReflectRemote` is not satisfied + --> tests/reflect_remote/incorrect_wrapper_fail.rs:LL:CC + | +LL | #[reflect(remote = MyFoo)] + | ^^^^^ the trait `ReflectRemote` is not implemented for `MyFoo` + +error[E0277]: the trait bound `MyFoo: ReflectRemote` is not satisfied + --> tests/reflect_remote/incorrect_wrapper_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ the trait `ReflectRemote` is not implemented for `MyFoo` + | + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_remote/invalid_definition_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_remote/invalid_definition_fail.stderr new file mode 100644 index 0000000000000..a8a6d223ae59a --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/reflect_remote/invalid_definition_fail.stderr @@ -0,0 +1,116 @@ +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `bool` + | + = note: `?` operator cannot convert from `bool` to `u32` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ---------------------------------------------- + | | + | expected due to the type of this binding + | in this procedural macro expansion +... +LL | pub value: bool, + | ^^^^ expected `u32`, found `bool` + | + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `bool` + | + = note: `?` operator cannot convert from `bool` to `u32` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ---------------------------------------------- + | | + | expected due to the type of this binding + | in this procedural macro expansion +... +LL | pub bool, + | ^^^^ expected `u32`, found `bool` + | + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0026]: variant `enums::external_crate::TheirStruct::Unit` does not have a field named `0` + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variant `enums::external_crate::TheirStruct::Unit` does not have this field + | + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0559]: variant `enums::external_crate::TheirStruct::Unit` has no field named `0` + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `enums::external_crate::TheirStruct::Unit` does not have this field + | + = note: all struct fields are already assigned + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `bool` + | + = note: `?` operator cannot convert from `bool` to `u32` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `String` + | + = note: `?` operator cannot convert from `std::string::String` to `usize` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ---------------------------------------------- + | | + | _____in this procedural macro expansion + | | +... | +LL | | Tuple(bool), + | | ^^^- + | |_______________|__| + | | expected due to the type of this binding + | expected `u32`, found `bool` + | + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/invalid_definition_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirStruct)] + | ---------------------------------------------- in this procedural macro expansion +... +LL | Struct { value: String }, + | ^^^^^^ + | | + | expected `usize`, found `String` + | expected due to the type of this binding + | + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0026, E0308, E0559. +For more information about an error, try `rustc --explain E0026`. diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_remote/macro_order_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_remote/macro_order_fail.stderr new file mode 100644 index 0000000000000..45a7ca5225ba3 --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/reflect_remote/macro_order_fail.stderr @@ -0,0 +1,23 @@ +error[E0609]: no field `value` on type `&MyType` + --> tests/reflect_remote/macro_order_fail.rs:LL:CC + | +LL | pub value: String, + | ^^^^^ unknown field + | +help: one of the expressions' fields has a field of the same name + | +LL | pub 0.value: String, + | ++ + +error[E0560]: struct `MyType` has no field named `value` + --> tests/reflect_remote/macro_order_fail.rs:LL:CC + | +LL | struct MyType { + | ------ `MyType` defined here +LL | pub value: String, + | ^^^^^^^^^^^^^^^^^ field does not exist + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0560, E0609. +For more information about an error, try `rustc --explain E0560`. diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_remote/nested_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_remote/nested_fail.stderr new file mode 100644 index 0000000000000..470bfc3e09d0d --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/reflect_remote/nested_fail.stderr @@ -0,0 +1,245 @@ +error[E0277]: `TheirInner` does not implement `PartialReflect` so cannot be introspected + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PartialReflect` is not implemented for `TheirInner` + | + = note: consider annotating `TheirInner` with `#[derive(Reflect)]` + = help: the following other types implement trait `PartialReflect`: + &'static Location<'static> + &'static Path + &'static str + () + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + and 90 others + = note: required for the cast from `&TheirInner` to `&dyn PartialReflect` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `TheirInner` does not implement `PartialReflect` so cannot be introspected + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PartialReflect` is not implemented for `TheirInner` + | + = note: consider annotating `TheirInner` with `#[derive(Reflect)]` + = help: the following other types implement trait `PartialReflect`: + &'static Location<'static> + &'static Path + &'static str + () + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + and 90 others + = note: required for the cast from `&mut TheirInner` to `&mut (dyn PartialReflect + 'static)` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `TheirInner` does not implement `PartialReflect` so cannot be introspected + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PartialReflect` is not implemented for `TheirInner` + | + = note: consider annotating `TheirInner` with `#[derive(Reflect)]` + = help: the following other types implement trait `PartialReflect`: + &'static Location<'static> + &'static Path + &'static str + () + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + and 90 others + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `TheirInner` does not implement `TypePath` so cannot provide dynamic type path information + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TypePath` is not implemented for `TheirInner` + | + = note: consider annotating `TheirInner` with `#[derive(Reflect)]` or `#[derive(TypePath)]` + = help: the following other types implement trait `TypePath`: + &'static Location<'static> + &'static T + &'static mut T + () + (P,) + (P1, P0) + (P1, P2, P0) + (P1, P2, P3, P0) + and 103 others + = note: required for `TheirInner` to implement `DynamicTypePath` +note: required by a bound in `clone_value` + --> BEVY_ROOT/bevy_reflect/src/reflect.rs:LL:CC + | +LL | pub trait PartialReflect: DynamicTypePath + Send + Sync + | ^^^^^^^^^^^^^^^ required by this bound in `PartialReflect::clone_value` +... +LL | fn clone_value(&self) -> Box; + | ----------- required by a bound in this associated function + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `TheirInner`, found `MyInner` + | + = note: `?` operator cannot convert from `incorrect_inner_type::MyInner` to `TheirInner` + = note: expected struct `TheirInner` + found struct `incorrect_inner_type::MyInner` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ------------------------------------------------------- + | | + | expected due to the type of this binding + | in this procedural macro expansion +... +LL | pub inner: MyInner, + | ^^^^^^^ expected `TheirInner`, found `MyInner` + | + = note: expected struct `TheirInner` + found struct `incorrect_inner_type::MyInner` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `&TheirOuter`, found `&TheirInner` + | arguments to this function are incorrect + | + = note: expected reference `&TheirOuter` + found reference `&TheirInner` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper(remote: &Self::Remote) -> &Self; + | ^^^^^^^^^^ + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `&mut TheirOuter`, found `&mut TheirInner` + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut TheirOuter` + found mutable reference `&mut TheirInner` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper_mut(remote: &mut Self::Remote) -> &mut Self; + | ^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ------------------------------------------------------- in this procedural macro expansion +... +LL | #[reflect(remote = MyOuter)] + | ^^^^^^^ + | | + | expected `TheirOuter`, found `TheirInner` + | expected due to this + | + = note: expected struct `TheirOuter` + found struct `TheirInner` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `&TheirInner`, found `&TheirInner` + | arguments to this function are incorrect +... +LL | struct MyOuter { + | - found this type parameter + | + = note: expected reference `&TheirInner` + found reference `&TheirInner` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper(remote: &Self::Remote) -> &Self; + | ^^^^^^^^^^ + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `&mut TheirInner`, found `&mut TheirInner` + | arguments to this function are incorrect +... +LL | struct MyOuter { + | - found this type parameter + | + = note: expected mutable reference `&mut TheirInner` + found mutable reference `&mut TheirInner` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper_mut(remote: &mut Self::Remote) -> &mut Self; + | ^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `TheirInner`, found `TheirInner` +... +LL | struct MyOuter { + | - expected this type parameter + | + = note: `?` operator cannot convert from `TheirInner` to `TheirInner` + = note: expected struct `TheirInner` + found struct `TheirInner` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/nested_fail.rs:LL:CC + | +LL | #[reflect_remote(super::external_crate::TheirOuter)] + | ------------------------------------------------------- + | | + | expected due to the type of this binding + | in this procedural macro expansion +... +LL | struct MyOuter { + | - expected this type parameter +... +LL | pub inner: super::external_crate::TheirInner, + | ^^^^^ expected `TheirInner`, found `TheirInner` + | + = note: expected struct `TheirInner` + found struct `TheirInner` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 13 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/crates/bevy_reflect/compile_fail/tests/reflect_remote/type_mismatch_fail.stderr b/crates/bevy_reflect/compile_fail/tests/reflect_remote/type_mismatch_fail.stderr new file mode 100644 index 0000000000000..cdd730433ee21 --- /dev/null +++ b/crates/bevy_reflect/compile_fail/tests/reflect_remote/type_mismatch_fail.stderr @@ -0,0 +1,193 @@ +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ + | | + | expected `&TheirBar`, found `&TheirFoo` + | arguments to this function are incorrect + | + = note: expected reference `&structs::external_crate::TheirBar` + found reference `&structs::external_crate::TheirFoo` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper(remote: &Self::Remote) -> &Self; + | ^^^^^^^^^^ + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ + | | + | expected `&mut TheirBar`, found `&mut TheirFoo` + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut structs::external_crate::TheirBar` + found mutable reference `&mut structs::external_crate::TheirFoo` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper_mut(remote: &mut Self::Remote) -> &mut Self; + | ^^^^^^^^^^^^^^ + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ------- in this derive macro expansion +... +LL | #[reflect(remote = MyBar)] + | ^^^^^ + | | + | expected `TheirBar`, found `TheirFoo` + | expected due to this + | + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ + | | + | expected `&TheirBar`, found `&TheirFoo` + | arguments to this function are incorrect + | + = note: expected reference `&tuple_structs::external_crate::TheirBar` + found reference `&tuple_structs::external_crate::TheirFoo` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper(remote: &Self::Remote) -> &Self; + | ^^^^^^^^^^ + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ + | | + | expected `&mut TheirBar`, found `&mut TheirFoo` + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut tuple_structs::external_crate::TheirBar` + found mutable reference `&mut tuple_structs::external_crate::TheirFoo` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper_mut(remote: &mut Self::Remote) -> &mut Self; + | ^^^^^^^^^^^^^^ + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ------- in this derive macro expansion +... +LL | #[reflect(remote = MyBar)] external_crate::TheirFoo, + | ^^^^^ + | | + | expected `TheirBar`, found `TheirFoo` + | expected due to this + | + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: `?` operator has incompatible types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirBar)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` + | + = note: `?` operator cannot convert from `u32` to `i32` + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit + | +LL | #[reflect_remote(external_crate::TheirBar)].try_into().unwrap() + | ++++++++++++++++++++ + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[reflect_remote(external_crate::TheirBar)] + | ------------------------------------------- + | | + | _____in this procedural macro expansion + | | +LL | | +LL | | enum MyBar { +LL | | // Reason: Should use `i32` +LL | | Value(u32), + | | ^^- + | |_______________|_| + | | expected due to the type of this binding + | expected `i32`, found `u32` + | + = note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ + | | + | expected `&TheirBar`, found `&TheirFoo` + | arguments to this function are incorrect + | + = note: expected reference `&enums::external_crate::TheirBar` + found reference `&enums::external_crate::TheirFoo` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper(remote: &Self::Remote) -> &Self; + | ^^^^^^^^^^ + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ + | | + | expected `&mut TheirBar`, found `&mut TheirFoo` + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut enums::external_crate::TheirBar` + found mutable reference `&mut enums::external_crate::TheirFoo` +note: associated function defined here + --> BEVY_ROOT/bevy_reflect/src/remote.rs:LL:CC + | +LL | fn as_wrapper_mut(remote: &mut Self::Remote) -> &mut Self; + | ^^^^^^^^^^^^^^ + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ^^^^^^^ expected `TheirFoo`, found `TheirBar` + | + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> tests/reflect_remote/type_mismatch_fail.rs:LL:CC + | +LL | #[derive(Reflect)] + | ------- in this derive macro expansion +... +LL | #[reflect(remote = MyBar)] external_crate::TheirFoo, + | ^^^^^ + | | + | expected `TheirBar`, found `TheirFoo` + | expected due to this + | + = note: this error originates in the derive macro `Reflect` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0308`.