about summary refs log tree commit diff
path: root/src/test/ui/closures
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-06-14 21:36:25 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-06-15 08:57:20 -0700
commite857696cf8c3b4a4381d00424f165c10f93a9ebd (patch)
tree0da7c7f3617583ad133b881c0fffab9df5c94ab9 /src/test/ui/closures
parentbb8674837a9cc5225020e07fc3f164762bb4c11c (diff)
downloadrust-e857696cf8c3b4a4381d00424f165c10f93a9ebd.tar.gz
rust-e857696cf8c3b4a4381d00424f165c10f93a9ebd.zip
Tweak "non-primitive cast" error
- Suggest borrowing expression if it would allow cast to work.
- Suggest using `<Type>::from(<expr>)` when appropriate.
- Minor tweak to `;` typo suggestion.

Partily address #47136.
Diffstat (limited to 'src/test/ui/closures')
-rw-r--r--src/test/ui/closures/closure-no-fn-3.stderr4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/test/ui/closures/closure-no-fn-3.stderr b/src/test/ui/closures/closure-no-fn-3.stderr
index ab6056b6547..4b3b4be798f 100644
--- a/src/test/ui/closures/closure-no-fn-3.stderr
+++ b/src/test/ui/closures/closure-no-fn-3.stderr
@@ -2,9 +2,7 @@ error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37 b
   --> $DIR/closure-no-fn-3.rs:6:27
    |
 LL |     let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
 
 error: aborting due to previous error