From e53625706106e0227656ddd2fa4d7df54ae2b90e Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Sat, 11 Apr 2020 11:31:54 -0700 Subject: 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. --- src/librustc_error_codes/error_codes/E0746.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/librustc_error_codes/error_codes') 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); } -- cgit 1.4.1-3-g733a5