about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-02-08 21:05:43 -0800
committerEsteban Küber <esteban@kuber.com.ar>2020-02-08 21:05:43 -0800
commitd51f2bd9d76a493f321acd31c1a4c1eb35f254f2 (patch)
tree99d215552b2ea430896278bdb87ac5ea7d9b77ec
parent109d5c189f4b5c3405a7d6cfb312e04d866c0c31 (diff)
downloadrust-d51f2bd9d76a493f321acd31c1a4c1eb35f254f2.tar.gz
rust-d51f2bd9d76a493f321acd31c1a4c1eb35f254f2.zip
review comments
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs13
-rw-r--r--src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr8
2 files changed, 9 insertions, 12 deletions
diff --git a/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
index 4fc31b3a412..d91f6edc980 100644
--- a/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
@@ -447,7 +447,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
 
     /// Targetted error when encountering an `FnMut` closure where an `Fn` closure was expected.
     fn expected_fn_found_fn_mut_call(&self, err: &mut DiagnosticBuilder<'_>, sp: Span, act: &str) {
-        err.span_label(sp, format!("cannot {ACT}", ACT = act));
+        err.span_label(sp, format!("cannot {}", act));
 
         let hir = self.infcx.tcx.hir();
         let closure_id = hir.as_local_hir_id(self.mir_def_id).unwrap();
@@ -528,13 +528,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
                     kind: hir::ImplItemKind::Method(sig, _),
                     ..
                 }) => {
-                    err.span_label(ident.span, "you might have to change this...");
-                    err.span_label(sig.decl.output.span(), "...to return `FnMut` instead of `Fn`");
+                    err.span_label(ident.span, "");
+                    err.span_label(
+                        sig.decl.output.span(),
+                        "change this to return `FnMut` instead of `Fn`",
+                    );
                     err.span_label(self.body.span, "in this closure");
                 }
-                parent => {
-                    err.note(&format!("parent {:?}", parent));
-                }
+                _ => {}
             }
         }
     }
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
index a97d694685d..3046b047d00 100644
--- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
+++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
@@ -68,9 +68,7 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closu
   --> $DIR/borrow-immutable-upvar-mutation.rs:43:9
    |
 LL |   fn foo() -> Box<dyn Fn() -> usize> {
-   |      ---      ---------------------- ...to return `FnMut` instead of `Fn`
-   |      |
-   |      you might have to change this...
+   |      ---      ---------------------- change this to return `FnMut` instead of `Fn`
 LL |       let mut x = 0;
 LL |       Box::new(move || {
    |  ______________-
@@ -84,9 +82,7 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closu
   --> $DIR/borrow-immutable-upvar-mutation.rs:51:9
    |
 LL |   fn bar() -> impl Fn() -> usize {
-   |      ---      ------------------ ...to return `FnMut` instead of `Fn`
-   |      |
-   |      you might have to change this...
+   |      ---      ------------------ change this to return `FnMut` instead of `Fn`
 LL |       let mut x = 0;
 LL | /     move || {
 LL | |         x += 1;