Allow mutable borrows to coerce into immutable
This commit is contained in:
parent
1c83ca44ab
commit
cc367a38e7
@ -152,7 +152,7 @@ impl TypeKind {
|
||||
(TypeKind::Borrow(val1, mut1), TypeKind::Borrow(val2, mut2)) => {
|
||||
// Extracted to give priority for other collapse-error
|
||||
let collapsed = val1.narrow_into(val2)?;
|
||||
if mut1 == mut2 {
|
||||
if mut1 == mut2 || (*mut1 && !mut2) {
|
||||
Ok(TypeKind::Borrow(Box::new(collapsed), *mut1 && *mut2))
|
||||
} else {
|
||||
Err(ErrorKind::TypesDifferMutability(self.clone(), other.clone()))
|
||||
|
Loading…
Reference in New Issue
Block a user