File tree 1 file changed +18
-7
lines changed
src/librustc_error_codes/error_codes
1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 1
- In types, the ` + ` type operator has low precedence, so it is often necessary
2
- to use parentheses.
1
+ The ` + ` type operator was used in an ambiguous context.
3
2
4
- For example:
3
+ Erroneous code example:
5
4
6
5
``` compile_fail,E0178
7
6
trait Foo {}
8
7
9
8
struct Bar<'a> {
10
- w: &'a Foo + Copy, // error, use &'a (Foo + Copy)
11
- x: &'a Foo + 'a, // error, use &'a (Foo + 'a)
12
- y: &'a mut Foo + 'a, // error, use &'a mut (Foo + 'a)
13
- z: fn() -> Foo + 'a, // error, use fn() -> (Foo + 'a)
9
+ x: &'a Foo + 'a, // error!
10
+ y: &'a mut Foo + 'a, // error!
11
+ z: fn() -> Foo + 'a, // error!
12
+ }
13
+ ```
14
+
15
+ In types, the ` + ` type operator has low precedence, so it is often necessary
16
+ to use parentheses:
17
+
18
+ ```
19
+ trait Foo {}
20
+
21
+ struct Bar<'a> {
22
+ x: &'a (Foo + 'a), // ok!
23
+ y: &'a mut (Foo + 'a), // ok!
24
+ z: fn() -> (Foo + 'a), // ok!
14
25
}
15
26
```
16
27
You can’t perform that action at this time.
0 commit comments