diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-04-11 11:31:54 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-04-20 11:17:03 -0700 |
| commit | e53625706106e0227656ddd2fa4d7df54ae2b90e (patch) | |
| tree | ca5862cc1e9602ebb3e5c20b671293de8732f9f1 /src/librustc_error_codes/error_codes | |
| parent | d3c96f03b5f6b4457cbabf4f3e1ec6c1aed23385 (diff) | |
| download | rust-e53625706106e0227656ddd2fa4d7df54ae2b90e.tar.gz rust-e53625706106e0227656ddd2fa4d7df54ae2b90e.zip | |
Ensure tail expression will have a `Ty` for E0746
When the return type is `!Sized` we look for all the returned expressions in the body to fetch their types and provide a reasonable suggestion. The tail expression of the body is normally evaluated after checking whether the return type is `Sized`. Changing the order of the evaluation produces undesirable knock down effects, so we detect the specific case that newcomers are likely to encounter ,returning a single bare trait object, and only in that case we evaluate the tail expression's type so that the suggestion will be accurate.
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0746.md | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/librustc_error_codes/error_codes/E0746.md b/src/librustc_error_codes/error_codes/E0746.md index 16b2722f0ea..305667e58f8 100644 --- a/src/librustc_error_codes/error_codes/E0746.md +++ b/src/librustc_error_codes/error_codes/E0746.md @@ -2,8 +2,7 @@ Return types cannot be `dyn Trait`s as they must be `Sized`. Erroneous code example: -```compile_fail,E0277 -# // FIXME: after E0746 is in beta, change the above +```compile_fail,E0746 trait T { fn bar(&self); } |
