File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 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.
32
4- For example:
3+ Erroneous code example:
54
65``` compile_fail,E0178
76trait Foo {}
87
98struct 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!
1425}
1526```
1627
You can’t perform that action at this time.
0 commit comments