From 4e1eeb9a4543c9c1bfbbac0b7813520c5b0be5ef Mon Sep 17 00:00:00 2001 From: clemencetbk Date: Sat, 16 Nov 2019 12:04:17 -0500 Subject: Add explanation message for E0641 --- src/librustc_error_codes/error_codes/E0641.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/librustc_error_codes/error_codes/E0641.md (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0641.md b/src/librustc_error_codes/error_codes/E0641.md new file mode 100644 index 00000000000..e39bebce1fe --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0641.md @@ -0,0 +1,19 @@ +Attempted to cast to/from a pointer with an unknown kind. + +Erroneous code examples: + +```compile_fail,E0641 +let b = 0 as *const _; // error +``` + +Must give information for type of pointer that is being cast from/to if the +type cannot be inferred. + +``` +// Creating a pointer from reference: type can be inferred +let a = &(String::from("Hello world!")) as *const _; // Ok + +let b = 0 as *const i32; // Ok + +let c: *const i32 = 0 as *const _; // Ok +``` \ No newline at end of file -- cgit 1.4.1-3-g733a5