Recognize mutable slice in return position of a safe function
diff --git a/syntax/check.rs b/syntax/check.rs
index 10025ac..bab2dec 100644
--- a/syntax/check.rs
+++ b/syntax/check.rs
@@ -514,6 +514,7 @@
match &efn.ret {
Some(Type::Ref(ty)) if ty.mutable => {}
+ Some(Type::SliceRef(slice)) if slice.mutable => {}
_ => return,
}
diff --git a/tests/ui/mut_return.stderr b/tests/ui/mut_return.stderr
index 5845eb8..e33393d 100644
--- a/tests/ui/mut_return.stderr
+++ b/tests/ui/mut_return.stderr
@@ -3,3 +3,9 @@
|
10 | fn f(t: &Thing) -> Pin<&mut CxxString>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: &mut return type is not allowed unless there is a &mut argument
+ --> $DIR/mut_return.rs:14:9
+ |
+14 | fn j(t: &Thing) -> &mut [u8];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^