Skip to content

Commit c77ad2d

Browse files
committed
Remove mention of "assoc type" in label as it is already in the note message
1 parent 71db025 commit c77ad2d

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
30113011
primary_spans.push(span);
30123012
span_labels.push((
30133013
span,
3014-
format!("associated type `{assoc}` is `{ty}` here"),
3014+
format!("`{assoc}` is `{ty}` here"),
30153015
));
30163016
}
30173017
break;
@@ -3025,15 +3025,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
30253025
primary_spans.push(span);
30263026
span_labels.push((
30273027
span,
3028-
format!("associated type `{assoc}` changed to `{ty}` here"),
3028+
format!("`{assoc}` changed to `{ty}` here"),
30293029
));
30303030
}
30313031
}
30323032
(Some((span, (assoc, ty))), None) => {
3033-
span_labels.push((
3034-
span,
3035-
format!("associated type `{assoc}` is `{ty}` here"),
3036-
));
3033+
span_labels
3034+
.push((span, format!("`{assoc}` is `{ty}` here")));
30373035
}
30383036
(None, Some(_)) | (None, None) => {}
30393037
}
@@ -3055,7 +3053,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
30553053
multi_span,
30563054
format!(
30573055
"the method call chain might not have had the expected \
3058-
associated types",
3056+
associated types",
30593057
),
30603058
);
30613059
}

src/test/ui/issues/issue-34334.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ LL | let sr: Vec<(u32, _, _) = vec![];
2929
| ------ this expression has type `Vec<(_, _, _)>`
3030
...
3131
LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
32-
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
32+
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here
3333
| |
34-
| associated type `std::iter::Iterator::Item` is `&(_, _, _)` here
34+
| `std::iter::Iterator::Item` is `&(_, _, _)` here
3535
note: required by a bound in `collect`
3636
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
3737
|

src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ note: the method call chain might not have had the expected associated types
1414
LL | let x1: &[f64] = &v;
1515
| -- this expression has type `&Vec<f64>`
1616
LL | let x2: Vec<f64> = x1.into_iter().collect();
17-
| ^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `&f64` here
17+
| ^^^^^^^^^^^ `std::iter::Iterator::Item` is `&f64` here
1818
note: required by a bound in `collect`
1919
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
2020
|
@@ -38,7 +38,7 @@ LL | let x1: &[f64] = &v;
3838
| -- this expression has type `&Vec<f64>`
3939
...
4040
LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
41-
| ^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `&f64` here
41+
| ^^^^^^^^^^^ `std::iter::Iterator::Item` is `&f64` here
4242
note: required by a bound in `collect`
4343
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
4444
|

src/test/ui/iterators/invalid-iterator-chain.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ note: the method call chain might not have had the expected associated types
1515
LL | let scores = vec![(0, 0)]
1616
| ------------ this expression has type `Vec<({integer}, {integer})>`
1717
LL | .iter()
18-
| ^^^^^^ associated type `std::iter::Iterator::Item` is `&({integer}, {integer})` here
18+
| ^^^^^^ `std::iter::Iterator::Item` is `&({integer}, {integer})` here
1919
LL | .map(|(a, b)| {
2020
| __________^
2121
LL | | a + b;
2222
LL | | });
23-
| |__________^ associated type `std::iter::Iterator::Item` changed to `()` here
23+
| |__________^ `std::iter::Iterator::Item` changed to `()` here
2424
note: required by a bound in `std::iter::Iterator::sum`
2525
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
2626
|
@@ -50,19 +50,19 @@ note: the method call chain might not have had the expected associated types
5050
LL | vec![0, 1]
5151
| ---------- this expression has type `Vec<{integer}>`
5252
LL | .iter()
53-
| ^^^^^^ associated type `std::iter::Iterator::Item` is `&{integer}` here
53+
| ^^^^^^ `std::iter::Iterator::Item` is `&{integer}` here
5454
LL | .map(|x| x * 2)
55-
| ^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `{integer}` here
55+
| ^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `{integer}` here
5656
LL | .map(|x| x as f64)
57-
| ^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `f64` here
57+
| ^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `f64` here
5858
LL | .map(|x| x as i64)
59-
| ^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `i64` here
59+
| ^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `i64` here
6060
LL | .filter(|x| *x > 0)
6161
| ------------------
6262
LL | .map(|x| { x + 1 })
6363
| ------------------
6464
LL | .map(|x| { x; })
65-
| ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
65+
| ^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here
6666
note: required by a bound in `std::iter::Iterator::sum`
6767
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
6868
|
@@ -84,9 +84,9 @@ note: the method call chain might not have had the expected associated types
8484
--> $DIR/invalid-iterator-chain.rs:20:31
8585
|
8686
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
87-
| ---------- ^^^^^^ ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
87+
| ---------- ^^^^^^ ^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here
8888
| | |
89-
| | associated type `std::iter::Iterator::Item` is `&{integer}` here
89+
| | `std::iter::Iterator::Item` is `&{integer}` here
9090
| this expression has type `Vec<{integer}>`
9191
note: required by a bound in `std::iter::Iterator::sum`
9292
--> $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
109109
--> $DIR/invalid-iterator-chain.rs:21:33
110110
|
111111
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
112-
| ------------ ^^^^^^ associated type `std::iter::Iterator::Item` is `&()` here
112+
| ------------ ^^^^^^ `std::iter::Iterator::Item` is `&()` here
113113
| |
114114
| this expression has type `Vec<()>`
115115
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
134134
LL | let a = vec![0];
135135
| ------- this expression has type `Vec<{integer}>`
136136
LL | let b = a.into_iter();
137-
| ^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `{integer}` here
137+
| ^^^^^^^^^^^ `std::iter::Iterator::Item` is `{integer}` here
138138
LL | let c = b.map(|x| x + 1);
139139
| --------------
140140
LL | let d = c.filter(|x| *x > 10 );
@@ -143,7 +143,7 @@ LL | let e = d.map(|x| {
143143
| _______________^
144144
LL | | x + 1;
145145
LL | | });
146-
| |______^ associated type `std::iter::Iterator::Item` changed to `()` here
146+
| |______^ `std::iter::Iterator::Item` changed to `()` here
147147
LL | let f = e.filter(|_| false);
148148
| -----------------
149149
note: required by a bound in `collect`

0 commit comments

Comments
 (0)