diff options
| author | bors <bors@rust-lang.org> | 2020-01-07 04:54:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-07 04:54:02 +0000 |
| commit | 4f074dea1dbf28d7519bf408b7530e8cba019243 (patch) | |
| tree | 32898820efab3cbd1ab73a44cfdeeb49650880ff /src/librustc_error_codes/error_codes | |
| parent | aa0769b92e60f5298f0b6326b8654c9b04351b98 (diff) | |
| parent | 23d97880bc2b5022fb4331cdff90550de7fc5328 (diff) | |
| download | rust-4f074dea1dbf28d7519bf408b7530e8cba019243.tar.gz rust-4f074dea1dbf28d7519bf408b7530e8cba019243.zip | |
Auto merge of #67964 - JohnTitor:rollup-pu5kosl, r=JohnTitor
Rollup of 13 pull requests Successful merges: - #67566 (Add an unstable conversion from thread ID to u64) - #67671 (Account for `type X = impl Trait;` in lifetime suggestion) - #67727 (Stabilise vec::remove_item) - #67877 (Omit underscore constants from rustdoc) - #67880 (Handle multiple error fix suggestions carefuly) - #67898 (Improve hygiene of `newtype_index`) - #67908 (rustdoc: HTML escape const values) - #67909 (Fix ICE in const pretty printing and resolve FIXME) - #67929 (Formatting an example for method Vec.retain) - #67934 (Clean up E0178 explanation) - #67936 (fire "non_camel_case_types" for associated types) - #67943 (Missing module std in example.) - #67962 (Update books) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0178.md | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/librustc_error_codes/error_codes/E0178.md b/src/librustc_error_codes/error_codes/E0178.md index 07980ad83f1..0c6f918632f 100644 --- a/src/librustc_error_codes/error_codes/E0178.md +++ b/src/librustc_error_codes/error_codes/E0178.md @@ -1,16 +1,27 @@ -In types, the `+` type operator has low precedence, so it is often necessary -to use parentheses. +The `+` type operator was used in an ambiguous context. -For example: +Erroneous code example: ```compile_fail,E0178 trait Foo {} struct Bar<'a> { - w: &'a Foo + Copy, // error, use &'a (Foo + Copy) - x: &'a Foo + 'a, // error, use &'a (Foo + 'a) - y: &'a mut Foo + 'a, // error, use &'a mut (Foo + 'a) - z: fn() -> Foo + 'a, // error, use fn() -> (Foo + 'a) + x: &'a Foo + 'a, // error! + y: &'a mut Foo + 'a, // error! + z: fn() -> Foo + 'a, // error! +} +``` + +In types, the `+` type operator has low precedence, so it is often necessary +to use parentheses: + +``` +trait Foo {} + +struct Bar<'a> { + x: &'a (Foo + 'a), // ok! + y: &'a mut (Foo + 'a), // ok! + z: fn() -> (Foo + 'a), // ok! } ``` |
