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
   |
16 |         let gotten: &A = e_mut.get::<A>().unwrap();
   |                          ---------------- immutable borrow occurs here
17 |         let gotten2: A = e_mut.remove::<A>().unwrap();
   |                          ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
18 |         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:25:30
   |
24 |         let mut gotten: Mut<A> = e_mut.get_mut::<A>().unwrap();
   |                                  -------------------- first mutable borrow occurs here
25 |         let mut gotten2: A = e_mut.remove::<A>().unwrap();
   |                              ^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
26 |         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:33:9
   |
32 |         let gotten: &A = e_mut.get::<A>().unwrap();
   |                          ---------------- borrow of `e_mut` occurs here
33 |         e_mut.despawn();
   |         ^^^^^ move out of `e_mut` occurs here
34 |         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:42:34
   |
41 |         let gotten: &A = e_mut.get::<A>().unwrap();
   |                          ---------------- immutable borrow occurs here
42 |         let gotten_mut: Mut<A> = e_mut.get_mut::<A>().unwrap();
   |                                  ^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
43 |         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:48:26
   |
47 |         let gotten_mut: Mut<A> = e_mut.get_mut::<A>().unwrap();
   |                                  -------------------- mutable borrow occurs here
48 |         let gotten: &A = e_mut.get::<A>().unwrap();
   |                          ^^^^^^^^^^^^^^^^ immutable borrow occurs here
49 |         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:54:9
   |
53 |         let gotten: &A = e_mut.get::<A>().unwrap();
   |                          ---------------- immutable borrow occurs here
54 |         e_mut.insert::<B>(B);
   |         ^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
55 |         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:61:9
   |
60 |         let mut gotten_mut: Mut<A> = e_mut.get_mut::<A>().unwrap();
   |                                      -------------------- first mutable borrow occurs here
61 |         e_mut.insert::<B>(B);
   |         ^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
62 |         assert_eq!(&mut *gotten_mut, &mut A(Box::new(16_usize))); // oops UB
   |                          ---------- first borrow later used here
