Add explanation message for E0641

This commit is contained in:
clemencetbk 2019-11-16 12:04:17 -05:00
parent 1bd30ce2aa
commit 4e1eeb9a45
2 changed files with 20 additions and 1 deletions

View File

@ -351,6 +351,7 @@ E0635: include_str!("./error_codes/E0635.md"),
E0636: include_str!("./error_codes/E0636.md"),
E0638: include_str!("./error_codes/E0638.md"),
E0639: include_str!("./error_codes/E0639.md"),
E0641: include_str!("./error_codes/E0641.md"),
E0642: include_str!("./error_codes/E0642.md"),
E0643: include_str!("./error_codes/E0643.md"),
E0644: include_str!("./error_codes/E0644.md"),
@ -585,7 +586,6 @@ E0744: include_str!("./error_codes/E0744.md"),
E0634, // type has conflicting packed representaton hints
E0637, // "'_" is not a valid lifetime bound
E0640, // infer outlives requirements
E0641, // cannot cast to/from a pointer with an unknown kind
// E0645, // trait aliases not finished
E0657, // `impl Trait` can only capture lifetimes bound at the fn level
E0667, // `impl Trait` in projections

View File

@ -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
```