Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1310d9b

Browse files
author
Yuki Okushi
authoredDec 6, 2022
Rollup merge of rust-lang#105338 - estebank:other-impls, r=compiler-errors
Tweak "the following other types implement trait" When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. r? `@compiler-errors`
2 parents e09c71e + e1649c4 commit 1310d9b

23 files changed

+138
-395
lines changed
 

‎compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
18101810
&self,
18111811
trait_pred: ty::PolyTraitPredicate<'tcx>,
18121812
) -> Vec<ImplCandidate<'tcx>> {
1813-
self.tcx
1813+
let mut candidates: Vec<_> = self
1814+
.tcx
18141815
.all_impls(trait_pred.def_id())
18151816
.filter_map(|def_id| {
18161817
if self.tcx.impl_polarity(def_id) == ty::ImplPolarity::Negative
@@ -1826,7 +1827,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
18261827
self.fuzzy_match_tys(trait_pred.skip_binder().self_ty(), imp.self_ty(), false)
18271828
.map(|similarity| ImplCandidate { trait_ref: imp, similarity })
18281829
})
1829-
.collect()
1830+
.collect();
1831+
if candidates.iter().any(|c| matches!(c.similarity, CandidateSimilarity::Exact { .. })) {
1832+
// If any of the candidates is a perfect match, we don't want to show all of them.
1833+
// This is particularly relevant for the case of numeric types (as they all have the
1834+
// same cathegory).
1835+
candidates.retain(|c| matches!(c.similarity, CandidateSimilarity::Exact { .. }));
1836+
}
1837+
candidates
18301838
}
18311839

18321840
fn report_similar_impl_candidates(

‎src/test/ui/binop/binop-mul-i32-f32.stderr

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ LL | x * y
66
|
77
= help: the trait `Mul<f32>` is not implemented for `i32`
88
= help: the following other types implement trait `Mul<Rhs>`:
9-
<&'a f32 as Mul<f32>>
10-
<&'a f64 as Mul<f64>>
11-
<&'a i128 as Mul<i128>>
12-
<&'a i16 as Mul<i16>>
139
<&'a i32 as Mul<i32>>
14-
<&'a i64 as Mul<i64>>
15-
<&'a i8 as Mul<i8>>
16-
<&'a isize as Mul<isize>>
17-
and 49 others
10+
<&i32 as Mul<&i32>>
11+
<i32 as Mul<&i32>>
12+
<i32 as Mul>
1813

1914
error: aborting due to previous error
2015

‎src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ LL |
1818
LL | 1_u32
1919
| ----- return type was inferred to be `u32` here
2020
|
21-
= help: the following other types implement trait `Traitor<N, M>`:
22-
<u32 as Traitor<N, 2>>
23-
<u64 as Traitor<1, 2>>
21+
= help: the trait `Traitor<N, 2>` is implemented for `u32`
2422

2523
error[E0277]: the trait bound `u64: Traitor` is not satisfied
2624
--> $DIR/rp_impl_trait_fail.rs:21:13
@@ -31,9 +29,7 @@ LL |
3129
LL | 1_u64
3230
| ----- return type was inferred to be `u64` here
3331
|
34-
= help: the following other types implement trait `Traitor<N, M>`:
35-
<u32 as Traitor<N, 2>>
36-
<u64 as Traitor<1, 2>>
32+
= help: the trait `Traitor<1, 2>` is implemented for `u64`
3733

3834
error: aborting due to 3 previous errors
3935

‎src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ LL | = [0; (i8::MAX + 1u8) as usize];
1212
|
1313
= help: the trait `~const Add<u8>` is not implemented for `i8`
1414
= help: the following other types implement trait `Add<Rhs>`:
15-
<&'a f32 as Add<f32>>
16-
<&'a f64 as Add<f64>>
17-
<&'a i128 as Add<i128>>
18-
<&'a i16 as Add<i16>>
19-
<&'a i32 as Add<i32>>
20-
<&'a i64 as Add<i64>>
2115
<&'a i8 as Add<i8>>
22-
<&'a isize as Add<isize>>
23-
and 48 others
16+
<&i8 as Add<&i8>>
17+
<i8 as Add<&i8>>
18+
<i8 as Add>
2419

2520
error: aborting due to 2 previous errors
2621

‎src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
1212
|
1313
= help: the trait `~const Add<u8>` is not implemented for `i8`
1414
= help: the following other types implement trait `Add<Rhs>`:
15-
<&'a f32 as Add<f32>>
16-
<&'a f64 as Add<f64>>
17-
<&'a i128 as Add<i128>>
18-
<&'a i16 as Add<i16>>
19-
<&'a i32 as Add<i32>>
20-
<&'a i64 as Add<i64>>
2115
<&'a i8 as Add<i8>>
22-
<&'a isize as Add<isize>>
23-
and 48 others
16+
<&i8 as Add<&i8>>
17+
<i8 as Add<&i8>>
18+
<i8 as Add>
2419

2520
error[E0604]: only `u8` can be cast as `char`, not `i8`
2621
--> $DIR/const-eval-overflow-4b.rs:22:13

‎src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ LL | Foo::<i32>::bar(&1i8);
1212
<i8 as Foo<u32>>
1313
<i8 as Foo<u64>>
1414
<i8 as Foo<u8>>
15-
<u8 as Foo<bool>>
16-
<u8 as Foo<u16>>
17-
<u8 as Foo<u32>>
18-
<u8 as Foo<u64>>
1915

2016
error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
2117
--> $DIR/issue-39802-show-5-trait-impls.rs:25:21
@@ -26,11 +22,6 @@ LL | Foo::<i32>::bar(&1u8);
2622
| required by a bound introduced by this call
2723
|
2824
= help: the following other types implement trait `Foo<B>`:
29-
<i8 as Foo<bool>>
30-
<i8 as Foo<u16>>
31-
<i8 as Foo<u32>>
32-
<i8 as Foo<u64>>
33-
<i8 as Foo<u8>>
3425
<u8 as Foo<bool>>
3526
<u8 as Foo<u16>>
3627
<u8 as Foo<u32>>

‎src/test/ui/impl-trait/equality.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,10 @@ LL | n + sum_to(n - 1)
3030
|
3131
= help: the trait `Add<impl Foo>` is not implemented for `u32`
3232
= help: the following other types implement trait `Add<Rhs>`:
33-
<&'a f32 as Add<f32>>
34-
<&'a f64 as Add<f64>>
35-
<&'a i128 as Add<i128>>
36-
<&'a i16 as Add<i16>>
37-
<&'a i32 as Add<i32>>
38-
<&'a i64 as Add<i64>>
39-
<&'a i8 as Add<i8>>
40-
<&'a isize as Add<isize>>
41-
and 48 others
33+
<&'a u32 as Add<u32>>
34+
<&u32 as Add<&u32>>
35+
<u32 as Add<&u32>>
36+
<u32 as Add>
4237

4338
error: aborting due to 2 previous errors; 1 warning emitted
4439

‎src/test/ui/issues/issue-24352.stderr

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ LL | 1.0f64 - 1
66
|
77
= help: the trait `Sub<{integer}>` is not implemented for `f64`
88
= help: the following other types implement trait `Sub<Rhs>`:
9-
<&'a f32 as Sub<f32>>
109
<&'a f64 as Sub<f64>>
11-
<&'a i128 as Sub<i128>>
12-
<&'a i16 as Sub<i16>>
13-
<&'a i32 as Sub<i32>>
14-
<&'a i64 as Sub<i64>>
15-
<&'a i8 as Sub<i8>>
16-
<&'a isize as Sub<isize>>
17-
and 48 others
10+
<&f64 as Sub<&f64>>
11+
<f64 as Sub<&f64>>
12+
<f64 as Sub>
1813
help: consider using a floating-point literal by writing it with `.0`
1914
|
2015
LL | 1.0f64 - 1.0

‎src/test/ui/kindck/kindck-copy.stderr

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@ error[E0277]: the trait bound `&'static mut isize: Copy` is not satisfied
44
LL | assert_copy::<&'static mut isize>();
55
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize`
66
|
7-
= help: the following other types implement trait `Copy`:
8-
f32
9-
f64
10-
i128
11-
i16
12-
i32
13-
i64
14-
i8
15-
isize
16-
and 6 others
7+
= help: the trait `Copy` is implemented for `isize`
178
note: required by a bound in `assert_copy`
189
--> $DIR/kindck-copy.rs:5:18
1910
|
@@ -26,16 +17,7 @@ error[E0277]: the trait bound `&'a mut isize: Copy` is not satisfied
2617
LL | assert_copy::<&'a mut isize>();
2718
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize`
2819
|
29-
= help: the following other types implement trait `Copy`:
30-
f32
31-
f64
32-
i128
33-
i16
34-
i32
35-
i64
36-
i8
37-
isize
38-
and 6 others
20+
= help: the trait `Copy` is implemented for `isize`
3921
note: required by a bound in `assert_copy`
4022
--> $DIR/kindck-copy.rs:5:18
4123
|

‎src/test/ui/lexer/lex-bad-char-literals-6.stderr

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ LL | if x == y {}
4242
<&'a str as PartialEq<OsString>>
4343
<&'a str as PartialEq<String>>
4444
<&'b str as PartialEq<Cow<'a, str>>>
45-
<String as PartialEq<&'a str>>
46-
<String as PartialEq<Cow<'a, str>>>
47-
<String as PartialEq<str>>
48-
<String as PartialEq>
4945
<str as PartialEq<Cow<'a, str>>>
50-
and 4 others
46+
<str as PartialEq<OsStr>>
47+
<str as PartialEq<OsString>>
48+
<str as PartialEq<String>>
49+
<str as PartialEq>
5150

5251
error[E0308]: mismatched types
5352
--> $DIR/lex-bad-char-literals-6.rs:15:20
@@ -68,12 +67,11 @@ LL | if x == z {}
6867
<&'a str as PartialEq<OsString>>
6968
<&'a str as PartialEq<String>>
7069
<&'b str as PartialEq<Cow<'a, str>>>
71-
<String as PartialEq<&'a str>>
72-
<String as PartialEq<Cow<'a, str>>>
73-
<String as PartialEq<str>>
74-
<String as PartialEq>
7570
<str as PartialEq<Cow<'a, str>>>
76-
and 4 others
71+
<str as PartialEq<OsStr>>
72+
<str as PartialEq<OsString>>
73+
<str as PartialEq<String>>
74+
<str as PartialEq>
7775

7876
error: aborting due to 6 previous errors
7977

‎src/test/ui/mismatched_types/binops.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,10 @@ LL | 2 as usize - Some(1);
2424
|
2525
= help: the trait `Sub<Option<{integer}>>` is not implemented for `usize`
2626
= help: the following other types implement trait `Sub<Rhs>`:
27-
<&'a f32 as Sub<f32>>
28-
<&'a f64 as Sub<f64>>
29-
<&'a i128 as Sub<i128>>
30-
<&'a i16 as Sub<i16>>
31-
<&'a i32 as Sub<i32>>
32-
<&'a i64 as Sub<i64>>
33-
<&'a i8 as Sub<i8>>
34-
<&'a isize as Sub<isize>>
35-
and 48 others
27+
<&'a usize as Sub<usize>>
28+
<&usize as Sub<&usize>>
29+
<usize as Sub<&usize>>
30+
<usize as Sub>
3631

3732
error[E0277]: cannot multiply `{integer}` by `()`
3833
--> $DIR/binops.rs:4:7

‎src/test/ui/never_type/issue-13352.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ LL | 2_usize + (loop {});
66
|
77
= help: the trait `Add<()>` is not implemented for `usize`
88
= help: the following other types implement trait `Add<Rhs>`:
9-
<&'a f32 as Add<f32>>
10-
<&'a f64 as Add<f64>>
11-
<&'a i128 as Add<i128>>
12-
<&'a i16 as Add<i16>>
13-
<&'a i32 as Add<i32>>
14-
<&'a i64 as Add<i64>>
15-
<&'a i8 as Add<i8>>
16-
<&'a isize as Add<isize>>
17-
and 48 others
9+
<&'a usize as Add<usize>>
10+
<&usize as Add<&usize>>
11+
<usize as Add<&usize>>
12+
<usize as Add>
1813

1914
error: aborting due to previous error
2015

‎src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr

Lines changed: 41 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ LL | x + 100.0
66
|
77
= help: the trait `Add<{float}>` is not implemented for `u8`
88
= help: the following other types implement trait `Add<Rhs>`:
9-
<&'a f32 as Add<f32>>
10-
<&'a f64 as Add<f64>>
11-
<&'a i128 as Add<i128>>
12-
<&'a i16 as Add<i16>>
13-
<&'a i32 as Add<i32>>
14-
<&'a i64 as Add<i64>>
15-
<&'a i8 as Add<i8>>
16-
<&'a isize as Add<isize>>
17-
and 48 others
9+
<&'a u8 as Add<u8>>
10+
<&u8 as Add<&u8>>
11+
<u8 as Add<&u8>>
12+
<u8 as Add>
1813

1914
error[E0277]: cannot add `&str` to `f64`
2015
--> $DIR/not-suggest-float-literal.rs:6:7
@@ -24,15 +19,10 @@ LL | x + "foo"
2419
|
2520
= help: the trait `Add<&str>` is not implemented for `f64`
2621
= help: the following other types implement trait `Add<Rhs>`:
27-
<&'a f32 as Add<f32>>
2822
<&'a f64 as Add<f64>>
29-
<&'a i128 as Add<i128>>
30-
<&'a i16 as Add<i16>>
31-
<&'a i32 as Add<i32>>
32-
<&'a i64 as Add<i64>>
33-
<&'a i8 as Add<i8>>
34-
<&'a isize as Add<isize>>
35-
and 48 others
23+
<&f64 as Add<&f64>>
24+
<f64 as Add<&f64>>
25+
<f64 as Add>
3626

3727
error[E0277]: cannot add `{integer}` to `f64`
3828
--> $DIR/not-suggest-float-literal.rs:11:7
@@ -42,15 +32,10 @@ LL | x + y
4232
|
4333
= help: the trait `Add<{integer}>` is not implemented for `f64`
4434
= help: the following other types implement trait `Add<Rhs>`:
45-
<&'a f32 as Add<f32>>
4635
<&'a f64 as Add<f64>>
47-
<&'a i128 as Add<i128>>
48-
<&'a i16 as Add<i16>>
49-
<&'a i32 as Add<i32>>
50-
<&'a i64 as Add<i64>>
51-
<&'a i8 as Add<i8>>
52-
<&'a isize as Add<isize>>
53-
and 48 others
36+
<&f64 as Add<&f64>>
37+
<f64 as Add<&f64>>
38+
<f64 as Add>
5439

5540
error[E0277]: cannot subtract `{float}` from `u8`
5641
--> $DIR/not-suggest-float-literal.rs:15:7
@@ -60,15 +45,10 @@ LL | x - 100.0
6045
|
6146
= help: the trait `Sub<{float}>` is not implemented for `u8`
6247
= help: the following other types implement trait `Sub<Rhs>`:
63-
<&'a f32 as Sub<f32>>
64-
<&'a f64 as Sub<f64>>
65-
<&'a i128 as Sub<i128>>
66-
<&'a i16 as Sub<i16>>
67-
<&'a i32 as Sub<i32>>
68-
<&'a i64 as Sub<i64>>
69-
<&'a i8 as Sub<i8>>
70-
<&'a isize as Sub<isize>>
71-
and 48 others
48+
<&'a u8 as Sub<u8>>
49+
<&u8 as Sub<&u8>>
50+
<u8 as Sub<&u8>>
51+
<u8 as Sub>
7252

7353
error[E0277]: cannot subtract `&str` from `f64`
7454
--> $DIR/not-suggest-float-literal.rs:19:7
@@ -78,15 +58,10 @@ LL | x - "foo"
7858
|
7959
= help: the trait `Sub<&str>` is not implemented for `f64`
8060
= help: the following other types implement trait `Sub<Rhs>`:
81-
<&'a f32 as Sub<f32>>
8261
<&'a f64 as Sub<f64>>
83-
<&'a i128 as Sub<i128>>
84-
<&'a i16 as Sub<i16>>
85-
<&'a i32 as Sub<i32>>
86-
<&'a i64 as Sub<i64>>
87-
<&'a i8 as Sub<i8>>
88-
<&'a isize as Sub<isize>>
89-
and 48 others
62+
<&f64 as Sub<&f64>>
63+
<f64 as Sub<&f64>>
64+
<f64 as Sub>
9065

9166
error[E0277]: cannot subtract `{integer}` from `f64`
9267
--> $DIR/not-suggest-float-literal.rs:24:7
@@ -96,15 +71,10 @@ LL | x - y
9671
|
9772
= help: the trait `Sub<{integer}>` is not implemented for `f64`
9873
= help: the following other types implement trait `Sub<Rhs>`:
99-
<&'a f32 as Sub<f32>>
10074
<&'a f64 as Sub<f64>>
101-
<&'a i128 as Sub<i128>>
102-
<&'a i16 as Sub<i16>>
103-
<&'a i32 as Sub<i32>>
104-
<&'a i64 as Sub<i64>>
105-
<&'a i8 as Sub<i8>>
106-
<&'a isize as Sub<isize>>
107-
and 48 others
75+
<&f64 as Sub<&f64>>
76+
<f64 as Sub<&f64>>
77+
<f64 as Sub>
10878

10979
error[E0277]: cannot multiply `u8` by `{float}`
11080
--> $DIR/not-suggest-float-literal.rs:28:7
@@ -114,15 +84,10 @@ LL | x * 100.0
11484
|
11585
= help: the trait `Mul<{float}>` is not implemented for `u8`
11686
= help: the following other types implement trait `Mul<Rhs>`:
117-
<&'a f32 as Mul<f32>>
118-
<&'a f64 as Mul<f64>>
119-
<&'a i128 as Mul<i128>>
120-
<&'a i16 as Mul<i16>>
121-
<&'a i32 as Mul<i32>>
122-
<&'a i64 as Mul<i64>>
123-
<&'a i8 as Mul<i8>>
124-
<&'a isize as Mul<isize>>
125-
and 49 others
87+
<&'a u8 as Mul<u8>>
88+
<&u8 as Mul<&u8>>
89+
<u8 as Mul<&u8>>
90+
<u8 as Mul>
12691

12792
error[E0277]: cannot multiply `f64` by `&str`
12893
--> $DIR/not-suggest-float-literal.rs:32:7
@@ -132,15 +97,10 @@ LL | x * "foo"
13297
|
13398
= help: the trait `Mul<&str>` is not implemented for `f64`
13499
= help: the following other types implement trait `Mul<Rhs>`:
135-
<&'a f32 as Mul<f32>>
136100
<&'a f64 as Mul<f64>>
137-
<&'a i128 as Mul<i128>>
138-
<&'a i16 as Mul<i16>>
139-
<&'a i32 as Mul<i32>>
140-
<&'a i64 as Mul<i64>>
141-
<&'a i8 as Mul<i8>>
142-
<&'a isize as Mul<isize>>
143-
and 49 others
101+
<&f64 as Mul<&f64>>
102+
<f64 as Mul<&f64>>
103+
<f64 as Mul>
144104

145105
error[E0277]: cannot multiply `f64` by `{integer}`
146106
--> $DIR/not-suggest-float-literal.rs:37:7
@@ -150,15 +110,10 @@ LL | x * y
150110
|
151111
= help: the trait `Mul<{integer}>` is not implemented for `f64`
152112
= help: the following other types implement trait `Mul<Rhs>`:
153-
<&'a f32 as Mul<f32>>
154113
<&'a f64 as Mul<f64>>
155-
<&'a i128 as Mul<i128>>
156-
<&'a i16 as Mul<i16>>
157-
<&'a i32 as Mul<i32>>
158-
<&'a i64 as Mul<i64>>
159-
<&'a i8 as Mul<i8>>
160-
<&'a isize as Mul<isize>>
161-
and 49 others
114+
<&f64 as Mul<&f64>>
115+
<f64 as Mul<&f64>>
116+
<f64 as Mul>
162117

163118
error[E0277]: cannot divide `u8` by `{float}`
164119
--> $DIR/not-suggest-float-literal.rs:41:7
@@ -168,15 +123,11 @@ LL | x / 100.0
168123
|
169124
= help: the trait `Div<{float}>` is not implemented for `u8`
170125
= help: the following other types implement trait `Div<Rhs>`:
171-
<&'a f32 as Div<f32>>
172-
<&'a f64 as Div<f64>>
173-
<&'a i128 as Div<i128>>
174-
<&'a i16 as Div<i16>>
175-
<&'a i32 as Div<i32>>
176-
<&'a i64 as Div<i64>>
177-
<&'a i8 as Div<i8>>
178-
<&'a isize as Div<isize>>
179-
and 54 others
126+
<&'a u8 as Div<u8>>
127+
<&u8 as Div<&u8>>
128+
<u8 as Div<&u8>>
129+
<u8 as Div<NonZeroU8>>
130+
<u8 as Div>
180131

181132
error[E0277]: cannot divide `f64` by `&str`
182133
--> $DIR/not-suggest-float-literal.rs:45:7
@@ -186,15 +137,10 @@ LL | x / "foo"
186137
|
187138
= help: the trait `Div<&str>` is not implemented for `f64`
188139
= help: the following other types implement trait `Div<Rhs>`:
189-
<&'a f32 as Div<f32>>
190140
<&'a f64 as Div<f64>>
191-
<&'a i128 as Div<i128>>
192-
<&'a i16 as Div<i16>>
193-
<&'a i32 as Div<i32>>
194-
<&'a i64 as Div<i64>>
195-
<&'a i8 as Div<i8>>
196-
<&'a isize as Div<isize>>
197-
and 54 others
141+
<&f64 as Div<&f64>>
142+
<f64 as Div<&f64>>
143+
<f64 as Div>
198144

199145
error[E0277]: cannot divide `f64` by `{integer}`
200146
--> $DIR/not-suggest-float-literal.rs:50:7
@@ -204,15 +150,10 @@ LL | x / y
204150
|
205151
= help: the trait `Div<{integer}>` is not implemented for `f64`
206152
= help: the following other types implement trait `Div<Rhs>`:
207-
<&'a f32 as Div<f32>>
208153
<&'a f64 as Div<f64>>
209-
<&'a i128 as Div<i128>>
210-
<&'a i16 as Div<i16>>
211-
<&'a i32 as Div<i32>>
212-
<&'a i64 as Div<i64>>
213-
<&'a i8 as Div<i8>>
214-
<&'a isize as Div<isize>>
215-
and 54 others
154+
<&f64 as Div<&f64>>
155+
<f64 as Div<&f64>>
156+
<f64 as Div>
216157

217158
error: aborting due to 12 previous errors
218159

‎src/test/ui/numbers-arithmetic/suggest-float-literal.stderr

Lines changed: 24 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ LL | x + 100
77
= help: the trait `Add<{integer}>` is not implemented for `f32`
88
= help: the following other types implement trait `Add<Rhs>`:
99
<&'a f32 as Add<f32>>
10-
<&'a f64 as Add<f64>>
11-
<&'a i128 as Add<i128>>
12-
<&'a i16 as Add<i16>>
13-
<&'a i32 as Add<i32>>
14-
<&'a i64 as Add<i64>>
15-
<&'a i8 as Add<i8>>
16-
<&'a isize as Add<isize>>
17-
and 48 others
10+
<&f32 as Add<&f32>>
11+
<f32 as Add<&f32>>
12+
<f32 as Add>
1813
help: consider using a floating-point literal by writing it with `.0`
1914
|
2015
LL | x + 100.0
@@ -28,15 +23,10 @@ LL | x + 100
2823
|
2924
= help: the trait `Add<{integer}>` is not implemented for `f64`
3025
= help: the following other types implement trait `Add<Rhs>`:
31-
<&'a f32 as Add<f32>>
3226
<&'a f64 as Add<f64>>
33-
<&'a i128 as Add<i128>>
34-
<&'a i16 as Add<i16>>
35-
<&'a i32 as Add<i32>>
36-
<&'a i64 as Add<i64>>
37-
<&'a i8 as Add<i8>>
38-
<&'a isize as Add<isize>>
39-
and 48 others
27+
<&f64 as Add<&f64>>
28+
<f64 as Add<&f64>>
29+
<f64 as Add>
4030
help: consider using a floating-point literal by writing it with `.0`
4131
|
4232
LL | x + 100.0
@@ -51,14 +41,9 @@ LL | x - 100
5141
= help: the trait `Sub<{integer}>` is not implemented for `f32`
5242
= help: the following other types implement trait `Sub<Rhs>`:
5343
<&'a f32 as Sub<f32>>
54-
<&'a f64 as Sub<f64>>
55-
<&'a i128 as Sub<i128>>
56-
<&'a i16 as Sub<i16>>
57-
<&'a i32 as Sub<i32>>
58-
<&'a i64 as Sub<i64>>
59-
<&'a i8 as Sub<i8>>
60-
<&'a isize as Sub<isize>>
61-
and 48 others
44+
<&f32 as Sub<&f32>>
45+
<f32 as Sub<&f32>>
46+
<f32 as Sub>
6247
help: consider using a floating-point literal by writing it with `.0`
6348
|
6449
LL | x - 100.0
@@ -72,15 +57,10 @@ LL | x - 100
7257
|
7358
= help: the trait `Sub<{integer}>` is not implemented for `f64`
7459
= help: the following other types implement trait `Sub<Rhs>`:
75-
<&'a f32 as Sub<f32>>
7660
<&'a f64 as Sub<f64>>
77-
<&'a i128 as Sub<i128>>
78-
<&'a i16 as Sub<i16>>
79-
<&'a i32 as Sub<i32>>
80-
<&'a i64 as Sub<i64>>
81-
<&'a i8 as Sub<i8>>
82-
<&'a isize as Sub<isize>>
83-
and 48 others
61+
<&f64 as Sub<&f64>>
62+
<f64 as Sub<&f64>>
63+
<f64 as Sub>
8464
help: consider using a floating-point literal by writing it with `.0`
8565
|
8666
LL | x - 100.0
@@ -95,14 +75,9 @@ LL | x * 100
9575
= help: the trait `Mul<{integer}>` is not implemented for `f32`
9676
= help: the following other types implement trait `Mul<Rhs>`:
9777
<&'a f32 as Mul<f32>>
98-
<&'a f64 as Mul<f64>>
99-
<&'a i128 as Mul<i128>>
100-
<&'a i16 as Mul<i16>>
101-
<&'a i32 as Mul<i32>>
102-
<&'a i64 as Mul<i64>>
103-
<&'a i8 as Mul<i8>>
104-
<&'a isize as Mul<isize>>
105-
and 49 others
78+
<&f32 as Mul<&f32>>
79+
<f32 as Mul<&f32>>
80+
<f32 as Mul>
10681
help: consider using a floating-point literal by writing it with `.0`
10782
|
10883
LL | x * 100.0
@@ -116,15 +91,10 @@ LL | x * 100
11691
|
11792
= help: the trait `Mul<{integer}>` is not implemented for `f64`
11893
= help: the following other types implement trait `Mul<Rhs>`:
119-
<&'a f32 as Mul<f32>>
12094
<&'a f64 as Mul<f64>>
121-
<&'a i128 as Mul<i128>>
122-
<&'a i16 as Mul<i16>>
123-
<&'a i32 as Mul<i32>>
124-
<&'a i64 as Mul<i64>>
125-
<&'a i8 as Mul<i8>>
126-
<&'a isize as Mul<isize>>
127-
and 49 others
95+
<&f64 as Mul<&f64>>
96+
<f64 as Mul<&f64>>
97+
<f64 as Mul>
12898
help: consider using a floating-point literal by writing it with `.0`
12999
|
130100
LL | x * 100.0
@@ -139,14 +109,9 @@ LL | x / 100
139109
= help: the trait `Div<{integer}>` is not implemented for `f32`
140110
= help: the following other types implement trait `Div<Rhs>`:
141111
<&'a f32 as Div<f32>>
142-
<&'a f64 as Div<f64>>
143-
<&'a i128 as Div<i128>>
144-
<&'a i16 as Div<i16>>
145-
<&'a i32 as Div<i32>>
146-
<&'a i64 as Div<i64>>
147-
<&'a i8 as Div<i8>>
148-
<&'a isize as Div<isize>>
149-
and 54 others
112+
<&f32 as Div<&f32>>
113+
<f32 as Div<&f32>>
114+
<f32 as Div>
150115
help: consider using a floating-point literal by writing it with `.0`
151116
|
152117
LL | x / 100.0
@@ -160,15 +125,10 @@ LL | x / 100
160125
|
161126
= help: the trait `Div<{integer}>` is not implemented for `f64`
162127
= help: the following other types implement trait `Div<Rhs>`:
163-
<&'a f32 as Div<f32>>
164128
<&'a f64 as Div<f64>>
165-
<&'a i128 as Div<i128>>
166-
<&'a i16 as Div<i16>>
167-
<&'a i32 as Div<i32>>
168-
<&'a i64 as Div<i64>>
169-
<&'a i8 as Div<i8>>
170-
<&'a isize as Div<isize>>
171-
and 54 others
129+
<&f64 as Div<&f64>>
130+
<f64 as Div<&f64>>
131+
<f64 as Div>
172132
help: consider using a floating-point literal by writing it with `.0`
173133
|
174134
LL | x / 100.0

‎src/test/ui/span/multiline-span-simple.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ LL | foo(1 as u32 +
66
|
77
= help: the trait `Add<()>` is not implemented for `u32`
88
= help: the following other types implement trait `Add<Rhs>`:
9-
<&'a f32 as Add<f32>>
10-
<&'a f64 as Add<f64>>
11-
<&'a i128 as Add<i128>>
12-
<&'a i16 as Add<i16>>
13-
<&'a i32 as Add<i32>>
14-
<&'a i64 as Add<i64>>
15-
<&'a i8 as Add<i8>>
16-
<&'a isize as Add<isize>>
17-
and 48 others
9+
<&'a u32 as Add<u32>>
10+
<&u32 as Add<&u32>>
11+
<u32 as Add<&u32>>
12+
<u32 as Add>
1813

1914
error: aborting due to previous error
2015

‎src/test/ui/traits/issue-79458.stderr

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ LL | struct Foo<'a, T> {
77
LL | bar: &'a mut T
88
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&mut T`
99
|
10-
= help: the following other types implement trait `Clone`:
11-
&T
12-
*const T
13-
*mut T
10+
= help: the trait `Clone` is implemented for `&T`
1411
= note: `Clone` is implemented for `&T`, but not for `&mut T`
1512
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
1613

‎src/test/ui/try-trait/bad-interconversion.stderr

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@ LL | Ok(Err(123_i32)?)
88
|
99
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
1010
= help: the following other types implement trait `From<T>`:
11-
<f32 as From<i16>>
12-
<f32 as From<i8>>
13-
<f32 as From<u16>>
14-
<f32 as From<u8>>
15-
<f64 as From<f32>>
16-
<f64 as From<i16>>
17-
<f64 as From<i32>>
18-
<f64 as From<i8>>
19-
and 68 others
11+
<u8 as From<NonZeroU8>>
12+
<u8 as From<bool>>
2013
= note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>`
2114

2215
error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`

‎src/test/ui/type-alias-impl-trait/self-referential-2.stderr

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,7 @@ LL | 42_i32
77
| ------ return type was inferred to be `i32` here
88
|
99
= help: the trait `PartialEq<Foo>` is not implemented for `i32`
10-
= help: the following other types implement trait `PartialEq<Rhs>`:
11-
f32
12-
f64
13-
i128
14-
i16
15-
i32
16-
i64
17-
i8
18-
isize
19-
and 6 others
10+
= help: the trait `PartialEq` is implemented for `i32`
2011

2112
error: aborting due to previous error
2213

‎src/test/ui/type-alias-impl-trait/self-referential-4.stderr

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,7 @@ LL | i
77
| - return type was inferred to be `&i32` here
88
|
99
= help: the trait `PartialEq<Bar<'b, 'static>>` is not implemented for `&i32`
10-
= help: the following other types implement trait `PartialEq<Rhs>`:
11-
f32
12-
f64
13-
i128
14-
i16
15-
i32
16-
i64
17-
i8
18-
isize
19-
and 6 others
10+
= help: the trait `PartialEq` is implemented for `i32`
2011

2112
error[E0277]: can't compare `&i32` with `Foo<'static, 'b>`
2213
--> $DIR/self-referential-4.rs:11:31
@@ -27,16 +18,7 @@ LL | i
2718
| - return type was inferred to be `&i32` here
2819
|
2920
= help: the trait `PartialEq<Foo<'static, 'b>>` is not implemented for `&i32`
30-
= help: the following other types implement trait `PartialEq<Rhs>`:
31-
f32
32-
f64
33-
i128
34-
i16
35-
i32
36-
i64
37-
i8
38-
isize
39-
and 6 others
21+
= help: the trait `PartialEq` is implemented for `i32`
4022

4123
error[E0277]: can't compare `&i32` with `Moo<'static, 'a>`
4224
--> $DIR/self-referential-4.rs:17:31
@@ -47,16 +29,7 @@ LL | i
4729
| - return type was inferred to be `&i32` here
4830
|
4931
= help: the trait `PartialEq<Moo<'static, 'a>>` is not implemented for `&i32`
50-
= help: the following other types implement trait `PartialEq<Rhs>`:
51-
f32
52-
f64
53-
i128
54-
i16
55-
i32
56-
i64
57-
i8
58-
isize
59-
and 6 others
32+
= help: the trait `PartialEq` is implemented for `i32`
6033

6134
error: aborting due to 3 previous errors
6235

‎src/test/ui/type-alias-impl-trait/self-referential.stderr

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@ LL | i
88
| - return type was inferred to be `&i32` here
99
|
1010
= help: the trait `PartialEq<Bar<'b, 'a>>` is not implemented for `&i32`
11-
= help: the following other types implement trait `PartialEq<Rhs>`:
12-
f32
13-
f64
14-
i128
15-
i16
16-
i32
17-
i64
18-
i8
19-
isize
20-
and 6 others
11+
= help: the trait `PartialEq` is implemented for `i32`
2112

2213
error[E0277]: can't compare `&i32` with `(i32, &i32)`
2314
--> $DIR/self-referential.rs:12:31
@@ -29,16 +20,7 @@ LL | (42, i)
2920
| ------- return type was inferred to be `(i32, &i32)` here
3021
|
3122
= help: the trait `PartialEq<(i32, &i32)>` is not implemented for `&i32`
32-
= help: the following other types implement trait `PartialEq<Rhs>`:
33-
f32
34-
f64
35-
i128
36-
i16
37-
i32
38-
i64
39-
i8
40-
isize
41-
and 6 others
23+
= help: the trait `PartialEq` is implemented for `i32`
4224

4325
error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})`
4426
--> $DIR/self-referential.rs:19:31
@@ -50,16 +32,7 @@ LL | (42, i)
5032
| ------- return type was inferred to be `(i32, &i32)` here
5133
|
5234
= help: the trait `PartialEq<(i32, Moo<'b, 'a>::{opaque#0})>` is not implemented for `&i32`
53-
= help: the following other types implement trait `PartialEq<Rhs>`:
54-
f32
55-
f64
56-
i128
57-
i16
58-
i32
59-
i64
60-
i8
61-
isize
62-
and 6 others
35+
= help: the trait `PartialEq` is implemented for `i32`
6336

6437
error: aborting due to 3 previous errors
6538

‎src/test/ui/type/type-check-defaults.stderr

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,10 @@ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
6666
|
6767
= help: the trait `Add<u8>` is not implemented for `i32`
6868
= help: the following other types implement trait `Add<Rhs>`:
69-
<&'a f32 as Add<f32>>
70-
<&'a f64 as Add<f64>>
71-
<&'a i128 as Add<i128>>
72-
<&'a i16 as Add<i16>>
7369
<&'a i32 as Add<i32>>
74-
<&'a i64 as Add<i64>>
75-
<&'a i8 as Add<i8>>
76-
<&'a isize as Add<isize>>
77-
and 48 others
70+
<&i32 as Add<&i32>>
71+
<i32 as Add<&i32>>
72+
<i32 as Add>
7873

7974
error: aborting due to 7 previous errors
8075

‎src/test/ui/typeck/issue-81293.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@ LL | a = c + b * 5;
2121
|
2222
= help: the trait `Add<u16>` is not implemented for `usize`
2323
= help: the following other types implement trait `Add<Rhs>`:
24-
<&'a f32 as Add<f32>>
25-
<&'a f64 as Add<f64>>
26-
<&'a i128 as Add<i128>>
27-
<&'a i16 as Add<i16>>
28-
<&'a i32 as Add<i32>>
29-
<&'a i64 as Add<i64>>
30-
<&'a i8 as Add<i8>>
31-
<&'a isize as Add<isize>>
32-
and 48 others
24+
<&'a usize as Add<usize>>
25+
<&usize as Add<&usize>>
26+
<usize as Add<&usize>>
27+
<usize as Add>
3328

3429
error: aborting due to 3 previous errors
3530

‎src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@ LL | <i32 as Add<u32>>::add(1, 2);
88
|
99
= help: the trait `Add<u32>` is not implemented for `i32`
1010
= help: the following other types implement trait `Add<Rhs>`:
11-
<&'a f32 as Add<f32>>
12-
<&'a f64 as Add<f64>>
13-
<&'a i128 as Add<i128>>
14-
<&'a i16 as Add<i16>>
1511
<&'a i32 as Add<i32>>
16-
<&'a i64 as Add<i64>>
17-
<&'a i8 as Add<i8>>
18-
<&'a isize as Add<isize>>
19-
and 48 others
12+
<&i32 as Add<&i32>>
13+
<i32 as Add<&i32>>
14+
<i32 as Add>
2015

2116
error[E0308]: mismatched types
2217
--> $DIR/ufcs-qpath-self-mismatch.rs:7:28
@@ -62,15 +57,10 @@ LL | <i32 as Add<u32>>::add(1, 2);
6257
|
6358
= help: the trait `Add<u32>` is not implemented for `i32`
6459
= help: the following other types implement trait `Add<Rhs>`:
65-
<&'a f32 as Add<f32>>
66-
<&'a f64 as Add<f64>>
67-
<&'a i128 as Add<i128>>
68-
<&'a i16 as Add<i16>>
6960
<&'a i32 as Add<i32>>
70-
<&'a i64 as Add<i64>>
71-
<&'a i8 as Add<i8>>
72-
<&'a isize as Add<isize>>
73-
and 48 others
61+
<&i32 as Add<&i32>>
62+
<i32 as Add<&i32>>
63+
<i32 as Add>
7464

7565
error: aborting due to 4 previous errors
7666

0 commit comments

Comments
 (0)
This repository has been archived.