Simplify mutability assert!s

This commit is contained in:
Maybe Waffle 2022-11-23 19:26:12 +00:00
parent f9a332a48c
commit 550319059d
2 changed files with 2 additions and 2 deletions

View file

@ -464,7 +464,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
// `self.x` both have `&mut `type would be a move of
// `self.x`, but we auto-coerce it to `foo(&mut *self.x)`,
// which is a borrow.
assert_eq!(mutbl_b, hir::Mutability::Not); // can only coerce &T -> &U
assert!(mutbl_b.is_not()); // can only coerce &T -> &U
return success(vec![], ty, obligations);
}

View file

@ -199,7 +199,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
Some(probe::AutorefOrPtrAdjustment::ToConstPtr) => {
target = match target.kind() {
&ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => {
assert_eq!(mutbl, hir::Mutability::Mut);
assert!(mutbl.is_mut());
self.tcx.mk_ptr(ty::TypeAndMut { mutbl: hir::Mutability::Not, ty })
}
other => panic!("Cannot adjust receiver type {:?} to const ptr", other),