diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-16 03:02:04 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-08-16 03:02:04 +0000 |
| commit | e37565d2db8d7cf92a6d1df535343d4b2881fc35 (patch) | |
| tree | 05d532d6e7218bb8c19c1f886e5744da592508ce /src/test/ui/borrowck | |
| parent | 84ba2289fdd3c41ebbef53de3fdb5035f2e73e60 (diff) | |
| download | rust-e37565d2db8d7cf92a6d1df535343d4b2881fc35.tar.gz rust-e37565d2db8d7cf92a6d1df535343d4b2881fc35.zip | |
Make as_ref suggestion a note
Diffstat (limited to 'src/test/ui/borrowck')
| -rw-r--r-- | src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr index 17546f73836..b1af090aec2 100644 --- a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr +++ b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr @@ -5,6 +5,7 @@ LL | cb.map(|cb| cb()); | ^^^-------------- | | | | | `*cb` moved due to this method call + | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait | note: this function takes ownership of the receiver `self`, which moves `*cb` @@ -12,10 +13,6 @@ note: this function takes ownership of the receiver `self`, which moves `*cb` | LL | pub const fn map<U, F>(self, f: F) -> Option<U> | ^^^^ -help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents - | -LL | cb.as_ref().map(|cb| cb()); - | +++++++++ error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference --> $DIR/suggest-as-ref-on-mut-closure.rs:12:26 |
