From 2baa0ceff4e6dc75751fdca4be68e87f5cf35a6e Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 8 Nov 2020 11:45:13 -0500 Subject: Don't reuse bindings for `ref mut` Reusing bindings causes errors later in lowering: ``` error[E0596]: cannot borrow `vec` as mutable, as it is not declared as mutable --> /checkout/src/test/ui/async-await/argument-patterns.rs:12:20 | LL | async fn b(n: u32, ref mut vec: A) { | ^^^^^^^^^^^ | | | cannot borrow as mutable | help: consider changing this to be mutable: `mut vec` ``` --- src/test/rustdoc/async-fn.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/test/rustdoc') diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index 5a03e821e8a..d7c89073829 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -20,6 +20,12 @@ pub async unsafe fn qux() -> char { '⚠' } +// @has async_fn/fn.mut_args.html '//pre[@class="rust fn"]' 'pub async fn mut_args(a: usize)' +pub async fn mut_args(mut a: usize) {} + +// @has async_fn/fn.mut_ref.html '//pre[@class="rust fn"]' 'pub async fn mut_ref(x: i32)' +pub async fn mut_ref(ref mut x: i32) {} + trait Bar {} impl Bar for () {} @@ -32,9 +38,11 @@ pub async fn quux() -> impl Bar { // @has async_fn/struct.Foo.html // @matches - '//code' 'pub async fn f\(\)$' // @matches - '//code' 'pub async unsafe fn g\(\)$' +// @matches - '//code' 'pub async fn mut_self\(self, first: usize\)$' pub struct Foo; impl Foo { pub async fn f() {} pub async unsafe fn g() {} + pub async fn mut_self(mut self, mut first: usize) {} } -- cgit 1.4.1-3-g733a5