about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2022-12-07 11:32:26 -0800
committerEsteban Küber <esteban@kuber.com.ar>2022-12-11 09:46:02 -0800
commitc77ad2d76576b97f6b2ea8c8b5ddb672c3383512 (patch)
treefaabc591007323f2005c7be2cf3576957ba10436
parent71db025cfa85ea3c1e7d628f4c596ca498c7acf0 (diff)
downloadrust-c77ad2d76576b97f6b2ea8c8b5ddb672c3383512.tar.gz
rust-c77ad2d76576b97f6b2ea8c8b5ddb672c3383512.zip
Remove mention of "assoc type" in label as it is already in the `note` message
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs12
-rw-r--r--src/test/ui/issues/issue-34334.stderr4
-rw-r--r--src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr4
-rw-r--r--src/test/ui/iterators/invalid-iterator-chain.stderr24
4 files changed, 21 insertions, 23 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 87ab863fa7b..bef2a067ae3 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -3011,7 +3011,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
                                     primary_spans.push(span);
                                     span_labels.push((
                                         span,
-                                        format!("associated type `{assoc}` is `{ty}` here"),
+                                        format!("`{assoc}` is `{ty}` here"),
                                     ));
                                 }
                                 break;
@@ -3025,15 +3025,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
                                             primary_spans.push(span);
                                             span_labels.push((
                                                 span,
-                                                format!("associated type `{assoc}` changed to `{ty}` here"),
+                                                format!("`{assoc}` changed to `{ty}` here"),
                                             ));
                                         }
                                     }
                                     (Some((span, (assoc, ty))), None) => {
-                                        span_labels.push((
-                                            span,
-                                            format!("associated type `{assoc}` is `{ty}` here"),
-                                        ));
+                                        span_labels
+                                            .push((span, format!("`{assoc}` is `{ty}` here")));
                                     }
                                     (None, Some(_)) | (None, None) => {}
                                 }
@@ -3055,7 +3053,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
                                 multi_span,
                                 format!(
                                     "the method call chain might not have had the expected \
-                                        associated types",
+                                     associated types",
                                 ),
                             );
                         }
diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr
index 89f5c45d7a9..ac3b3e95faf 100644
--- a/src/test/ui/issues/issue-34334.stderr
+++ b/src/test/ui/issues/issue-34334.stderr
@@ -29,9 +29,9 @@ LL |     let sr: Vec<(u32, _, _) = vec![];
    |                               ------ this expression has type `Vec<(_, _, _)>`
 ...
 LL |     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
-   |                                    ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
+   |                                    ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here
    |                                    |
-   |                                    associated type `std::iter::Iterator::Item` is `&(_, _, _)` here
+   |                                    `std::iter::Iterator::Item` is `&(_, _, _)` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
    |
diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
index 7fe786dcfb5..9a560c631fe 100644
--- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
+++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
@@ -14,7 +14,7 @@ note: the method call chain might not have had the expected associated types
 LL |     let x1: &[f64] = &v;
    |                      -- this expression has type `&Vec<f64>`
 LL |     let x2: Vec<f64> = x1.into_iter().collect();
-   |                           ^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `&f64` here
+   |                           ^^^^^^^^^^^ `std::iter::Iterator::Item` is `&f64` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
    |
@@ -38,7 +38,7 @@ LL |     let x1: &[f64] = &v;
    |                      -- this expression has type `&Vec<f64>`
 ...
 LL |     let x3 = x1.into_iter().collect::<Vec<f64>>();
-   |                 ^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `&f64` here
+   |                 ^^^^^^^^^^^ `std::iter::Iterator::Item` is `&f64` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
    |
diff --git a/src/test/ui/iterators/invalid-iterator-chain.stderr b/src/test/ui/iterators/invalid-iterator-chain.stderr
index 8bf7eb93a72..0505dd86af3 100644
--- a/src/test/ui/iterators/invalid-iterator-chain.stderr
+++ b/src/test/ui/iterators/invalid-iterator-chain.stderr
@@ -15,12 +15,12 @@ note: the method call chain might not have had the expected associated types
 LL |       let scores = vec![(0, 0)]
    |                    ------------ this expression has type `Vec<({integer}, {integer})>`
 LL |           .iter()
-   |            ^^^^^^ associated type `std::iter::Iterator::Item` is `&({integer}, {integer})` here
+   |            ^^^^^^ `std::iter::Iterator::Item` is `&({integer}, {integer})` here
 LL |           .map(|(a, b)| {
    |  __________^
 LL | |             a + b;
 LL | |         });
-   | |__________^ associated type `std::iter::Iterator::Item` changed to `()` here
+   | |__________^ `std::iter::Iterator::Item` changed to `()` here
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
    |
@@ -50,19 +50,19 @@ note: the method call chain might not have had the expected associated types
 LL |         vec![0, 1]
    |         ---------- this expression has type `Vec<{integer}>`
 LL |             .iter()
-   |              ^^^^^^ associated type `std::iter::Iterator::Item` is `&{integer}` here
+   |              ^^^^^^ `std::iter::Iterator::Item` is `&{integer}` here
 LL |             .map(|x| x * 2)
-   |              ^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `{integer}` here
+   |              ^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `{integer}` here
 LL |             .map(|x| x as f64)
-   |              ^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `f64` here
+   |              ^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `f64` here
 LL |             .map(|x| x as i64)
-   |              ^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `i64` here
+   |              ^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `i64` here
 LL |             .filter(|x| *x > 0)
    |              ------------------
 LL |             .map(|x| { x + 1 })
    |              ------------------
 LL |             .map(|x| { x; })
-   |              ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
+   |              ^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
    |
@@ -84,9 +84,9 @@ note: the method call chain might not have had the expected associated types
   --> $DIR/invalid-iterator-chain.rs:20:31
    |
 LL |     println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
-   |                    ---------- ^^^^^^ ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
+   |                    ---------- ^^^^^^ ^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here
    |                    |          |
-   |                    |          associated type `std::iter::Iterator::Item` is `&{integer}` here
+   |                    |          `std::iter::Iterator::Item` is `&{integer}` here
    |                    this expression has type `Vec<{integer}>`
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
@@ -109,7 +109,7 @@ note: the method call chain might not have had the expected associated types
   --> $DIR/invalid-iterator-chain.rs:21:33
    |
 LL |     println!("{}", vec![(), ()].iter().sum::<i32>());
-   |                    ------------ ^^^^^^ associated type `std::iter::Iterator::Item` is `&()` here
+   |                    ------------ ^^^^^^ `std::iter::Iterator::Item` is `&()` here
    |                    |
    |                    this expression has type `Vec<()>`
 note: required by a bound in `std::iter::Iterator::sum`
@@ -134,7 +134,7 @@ note: the method call chain might not have had the expected associated types
 LL |       let a = vec![0];
    |               ------- this expression has type `Vec<{integer}>`
 LL |       let b = a.into_iter();
-   |                 ^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `{integer}` here
+   |                 ^^^^^^^^^^^ `std::iter::Iterator::Item` is `{integer}` here
 LL |       let c = b.map(|x| x + 1);
    |                 --------------
 LL |       let d = c.filter(|x| *x > 10 );
@@ -143,7 +143,7 @@ LL |       let e = d.map(|x| {
    |  _______________^
 LL | |         x + 1;
 LL | |     });
-   | |______^ associated type `std::iter::Iterator::Item` changed to `()` here
+   | |______^ `std::iter::Iterator::Item` changed to `()` here
 LL |       let f = e.filter(|_| false);
    |                 -----------------
 note: required by a bound in `collect`