Skip to content

Commit

Permalink
Recognize mutable slice argument as permitting mutable return
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 28, 2021
1 parent b7a48dd commit ffd6f84
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions syntax/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ fn check_mut_return_restriction(cx: &mut Check, efn: &ExternFn) {
fn visit_type(&mut self, ty: &'t Type) {
self.found |= match ty {
Type::Ref(ty) => ty.mutable,
Type::SliceRef(slice) => slice.mutable,
Type::Ident(ident) if Atom::from(&ident.rust).is_none() => {
match self.cx.types.try_resolve(ident) {
Some(resolve) => !resolve.generics.lifetimes.is_empty(),
Expand Down

0 comments on commit ffd6f84

Please sign in to comment.