Skip to content

Commit 4c92a02

Browse files
committed
Change rustc_on_unimplemented for Iterator and binops
1 parent c1383e4 commit 4c92a02

33 files changed

+418
-153
lines changed

src/libcore/ops/arith.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
all(_Self="f32", RHS="u16"),
110110
all(_Self="f32", RHS="u8"),
111111
),
112-
message="cannot add `{RHS}` to `{Self}`",
113112
label="no implementation for `{Self} + {RHS}`, but you can safely cast \
114113
`{RHS}` into `{Self}` using `as {Self}`",
115114
),
@@ -146,22 +145,20 @@
146145
all(RHS="f32", _Self="u16"),
147146
all(RHS="f32", _Self="u8"),
148147
),
149-
message="cannot add `{RHS}` to `{Self}`",
150-
label="no implementation for `{Self} + {RHS}`, but you can safely turn \
148+
label="no implementation for `{Self} + {RHS}`, but you can safely cast \
151149
`{Self}` into `{RHS}` using `as {RHS}`",
152150
),
153151
on(
154152
all(_Self="{integer}", RHS="{float}"),
155153
message="cannot add a float to an integer",
156-
label="no implementation for `{Self} + {RHS}`",
157154
),
158155
on(
159156
all(_Self="{float}", RHS="{integer}"),
160157
message="cannot add an integer to a float",
161-
label="no implementation for `{Self} + {RHS}`",
162158
),
163159
message="cannot add `{RHS}` to `{Self}`",
164-
label="no implementation for `{Self} + {RHS}`")]
160+
label="no implementation for `{Self} + {RHS}`",
161+
)]
165162
pub trait Add<RHS=Self> {
166163
/// The resulting type after applying the `+` operator.
167164
#[stable(feature = "rust1", since = "1.0.0")]

src/test/ui/anonymous-higher-ranked-lifetime.stderr

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ error[E0631]: type mismatch in closure arguments
66
| |
77
| expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _`
88
|
9-
= note: required by `f1`
9+
note: required by `f1`
10+
--> $DIR/anonymous-higher-ranked-lifetime.rs:26:1
11+
|
12+
26 | fn f1<F>(_: F) where F: Fn(&(), &()) {}
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1014

1115
error[E0631]: type mismatch in closure arguments
1216
--> $DIR/anonymous-higher-ranked-lifetime.rs:13:5
@@ -16,7 +20,11 @@ error[E0631]: type mismatch in closure arguments
1620
| |
1721
| expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _`
1822
|
19-
= note: required by `f2`
23+
note: required by `f2`
24+
--> $DIR/anonymous-higher-ranked-lifetime.rs:27:1
25+
|
26+
27 | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2028

2129
error[E0631]: type mismatch in closure arguments
2230
--> $DIR/anonymous-higher-ranked-lifetime.rs:14:5
@@ -26,7 +34,11 @@ error[E0631]: type mismatch in closure arguments
2634
| |
2735
| expected signature of `for<'r> fn(&(), &'r ()) -> _`
2836
|
29-
= note: required by `f3`
37+
note: required by `f3`
38+
--> $DIR/anonymous-higher-ranked-lifetime.rs:28:1
39+
|
40+
28 | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3042

3143
error[E0631]: type mismatch in closure arguments
3244
--> $DIR/anonymous-higher-ranked-lifetime.rs:15:5
@@ -36,7 +48,11 @@ error[E0631]: type mismatch in closure arguments
3648
| |
3749
| expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _`
3850
|
39-
= note: required by `f4`
51+
note: required by `f4`
52+
--> $DIR/anonymous-higher-ranked-lifetime.rs:29:1
53+
|
54+
29 | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
55+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4056

4157
error[E0631]: type mismatch in closure arguments
4258
--> $DIR/anonymous-higher-ranked-lifetime.rs:16:5
@@ -46,7 +62,11 @@ error[E0631]: type mismatch in closure arguments
4662
| |
4763
| expected signature of `for<'r> fn(&'r (), &'r ()) -> _`
4864
|
49-
= note: required by `f5`
65+
note: required by `f5`
66+
--> $DIR/anonymous-higher-ranked-lifetime.rs:30:1
67+
|
68+
30 | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
69+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5070

5171
error[E0631]: type mismatch in closure arguments
5272
--> $DIR/anonymous-higher-ranked-lifetime.rs:17:5
@@ -56,7 +76,11 @@ error[E0631]: type mismatch in closure arguments
5676
| |
5777
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _`
5878
|
59-
= note: required by `g1`
79+
note: required by `g1`
80+
--> $DIR/anonymous-higher-ranked-lifetime.rs:33:1
81+
|
82+
33 | fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}
83+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6084

6185
error[E0631]: type mismatch in closure arguments
6286
--> $DIR/anonymous-higher-ranked-lifetime.rs:18:5
@@ -66,7 +90,11 @@ error[E0631]: type mismatch in closure arguments
6690
| |
6791
| expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _`
6892
|
69-
= note: required by `g2`
93+
note: required by `g2`
94+
--> $DIR/anonymous-higher-ranked-lifetime.rs:34:1
95+
|
96+
34 | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
97+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7098

7199
error[E0631]: type mismatch in closure arguments
72100
--> $DIR/anonymous-higher-ranked-lifetime.rs:19:5
@@ -76,7 +104,11 @@ error[E0631]: type mismatch in closure arguments
76104
| |
77105
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _`
78106
|
79-
= note: required by `g3`
107+
note: required by `g3`
108+
--> $DIR/anonymous-higher-ranked-lifetime.rs:35:1
109+
|
110+
35 | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}
111+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80112

81113
error[E0631]: type mismatch in closure arguments
82114
--> $DIR/anonymous-higher-ranked-lifetime.rs:20:5
@@ -86,7 +118,11 @@ error[E0631]: type mismatch in closure arguments
86118
| |
87119
| expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _`
88120
|
89-
= note: required by `g4`
121+
note: required by `g4`
122+
--> $DIR/anonymous-higher-ranked-lifetime.rs:36:1
123+
|
124+
36 | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
125+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90126

91127
error[E0631]: type mismatch in closure arguments
92128
--> $DIR/anonymous-higher-ranked-lifetime.rs:21:5
@@ -96,7 +132,11 @@ error[E0631]: type mismatch in closure arguments
96132
| |
97133
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
98134
|
99-
= note: required by `h1`
135+
note: required by `h1`
136+
--> $DIR/anonymous-higher-ranked-lifetime.rs:39:1
137+
|
138+
39 | fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}
139+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100140

101141
error[E0631]: type mismatch in closure arguments
102142
--> $DIR/anonymous-higher-ranked-lifetime.rs:22:5
@@ -106,7 +146,11 @@ error[E0631]: type mismatch in closure arguments
106146
| |
107147
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
108148
|
109-
= note: required by `h2`
149+
note: required by `h2`
150+
--> $DIR/anonymous-higher-ranked-lifetime.rs:40:1
151+
|
152+
40 | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}
153+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110154

111155
error: aborting due to 11 previous errors
112156

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ error[E0277]: the trait bound `i8: Foo<i32>` is not satisfied
1010
<i8 as Foo<u32>>
1111
<i8 as Foo<u64>>
1212
<i8 as Foo<bool>>
13-
= note: required by `Foo::bar`
13+
note: required by `Foo::bar`
14+
--> $DIR/issue-39802-show-5-trait-impls.rs:12:5
15+
|
16+
12 | fn bar(&self){}
17+
| ^^^^^^^^^^^^^
1418

1519
error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
1620
--> $DIR/issue-39802-show-5-trait-impls.rs:35:5
@@ -23,7 +27,11 @@ error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
2327
<u8 as Foo<u32>>
2428
<u8 as Foo<u64>>
2529
<u8 as Foo<bool>>
26-
= note: required by `Foo::bar`
30+
note: required by `Foo::bar`
31+
--> $DIR/issue-39802-show-5-trait-impls.rs:12:5
32+
|
33+
12 | fn bar(&self){}
34+
| ^^^^^^^^^^^^^
2735

2836
error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
2937
--> $DIR/issue-39802-show-5-trait-impls.rs:36:5
@@ -37,7 +45,11 @@ error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
3745
<bool as Foo<u32>>
3846
<bool as Foo<u64>>
3947
and 2 others
40-
= note: required by `Foo::bar`
48+
note: required by `Foo::bar`
49+
--> $DIR/issue-39802-show-5-trait-impls.rs:12:5
50+
|
51+
12 | fn bar(&self){}
52+
| ^^^^^^^^^^^^^
4153

4254
error: aborting due to 3 previous errors
4355

src/test/ui/did_you_mean/recursion_limit.stderr

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ error[E0275]: overflow evaluating the requirement `K: std::marker::Send`
1515
= note: required because it appears within the type `C`
1616
= note: required because it appears within the type `B`
1717
= note: required because it appears within the type `A`
18-
= note: required by `is_send`
18+
note: required by `is_send`
19+
--> $DIR/recursion_limit.rs:41:1
20+
|
21+
41 | fn is_send<T:Send>() { }
22+
| ^^^^^^^^^^^^^^^^^^^^
1923

2024
error: aborting due to previous error
2125

src/test/ui/feature-gate-abi_unadjusted.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unadjusted ABI is an implementation detail and perma-unstable
1+
error[E0658]: unadjusted ABI is an implementation detail and perma-unstable
22
--> $DIR/feature-gate-abi_unadjusted.rs:11:1
33
|
44
11 | / extern "unadjusted" fn foo() {

src/test/ui/feature-gate-catch_expr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `catch` expression is experimental (see issue #31436)
1+
error[E0658]: `catch` expression is experimental (see issue #31436)
22
--> $DIR/feature-gate-catch_expr.rs:12:24
33
|
44
12 | let catch_result = do catch { //~ ERROR `catch` expression is experimental

src/test/ui/feature-gate-i128_type2.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
error: 128-bit type is unstable (see issue #35118)
1+
error[E0658]: 128-bit type is unstable (see issue #35118)
22
--> $DIR/feature-gate-i128_type2.rs:13:15
33
|
44
13 | fn test1() -> i128 { //~ ERROR 128-bit type is unstable
55
| ^^^^
66
|
77
= help: add #![feature(i128_type)] to the crate attributes to enable
88

9-
error: 128-bit type is unstable (see issue #35118)
9+
error[E0658]: 128-bit type is unstable (see issue #35118)
1010
--> $DIR/feature-gate-i128_type2.rs:17:17
1111
|
1212
17 | fn test1_2() -> u128 { //~ ERROR 128-bit type is unstable
1313
| ^^^^
1414
|
1515
= help: add #![feature(i128_type)] to the crate attributes to enable
1616

17-
error: 128-bit type is unstable (see issue #35118)
17+
error[E0658]: 128-bit type is unstable (see issue #35118)
1818
--> $DIR/feature-gate-i128_type2.rs:22:12
1919
|
2020
22 | let x: i128 = 0; //~ ERROR 128-bit type is unstable
2121
| ^^^^
2222
|
2323
= help: add #![feature(i128_type)] to the crate attributes to enable
2424

25-
error: 128-bit type is unstable (see issue #35118)
25+
error[E0658]: 128-bit type is unstable (see issue #35118)
2626
--> $DIR/feature-gate-i128_type2.rs:26:12
2727
|
2828
26 | let x: u128 = 0; //~ ERROR 128-bit type is unstable
@@ -32,7 +32,7 @@ error: 128-bit type is unstable (see issue #35118)
3232

3333
error[E0601]: main function not found
3434

35-
error: repr with 128-bit type is unstable (see issue #35118)
35+
error[E0658]: repr with 128-bit type is unstable (see issue #35118)
3636
--> $DIR/feature-gate-i128_type2.rs:30:1
3737
|
3838
30 | / enum A { //~ ERROR 128-bit type is unstable

src/test/ui/feature-gate-intrinsics.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: intrinsics are subject to change
1+
error[E0658]: intrinsics are subject to change
22
--> $DIR/feature-gate-intrinsics.rs:11:1
33
|
44
11 | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
@@ -8,7 +8,7 @@ error: intrinsics are subject to change
88
|
99
= help: add #![feature(intrinsics)] to the crate attributes to enable
1010

11-
error: intrinsics are subject to change
11+
error[E0658]: intrinsics are subject to change
1212
--> $DIR/feature-gate-intrinsics.rs:15:1
1313
|
1414
15 | / extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change

0 commit comments

Comments
 (0)