Skip to content

Commit

Permalink
Remove usages in compile fail tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Feb 27, 2025
1 parent ba3dc9c commit 75684d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ fn main() {
}

{
let data: &Foo = query.single();
let mut data2: Mut<Foo> = query.single_mut();
let data: &Foo = query.get_single().unwrap();
let mut data2: Mut<Foo> = query.get_single_mut().unwrap();
//~^ E0502
assert_eq!(data, &mut *data2); // oops UB
}

{
let mut data2: Mut<Foo> = query.single_mut();
let data: &Foo = query.single();
let mut data2: Mut<Foo> = query.get_single_mut().unwrap();
let data: &Foo = query.get_single().unwrap();
//~^ E0502
assert_eq!(data, &mut *data2); // oops UB
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fn main() {
let mut query_a = lens_a.query();
let mut query_b = lens_b.query();

let a = query_a.single_mut();
let b = query_b.single_mut(); // oops 2 mutable references to same Foo
let a = query_a.get_single_mut().unwrap();
let b = query_b.get_single_mut().unwrap(); // oops 2 mutable references to same Foo
assert_eq!(*a, *b);
}

Expand All @@ -34,8 +34,8 @@ fn main() {
let mut query_b = lens.query();
//~^ E0499

let a = query_a.single_mut();
let b = query_b.single_mut(); // oops 2 mutable references to same Foo
let a = query_a.get_single_mut().unwrap();
let b = query_b.get_single_mut().unwrap(); // oops 2 mutable references to same Foo
assert_eq!(*a, *b);
}
}

0 comments on commit 75684d1

Please sign in to comment.