Skip to content

Commit 4e1eeb9

Browse files
committed
Add explanation message for E0641
1 parent 1bd30ce commit 4e1eeb9

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Diff for: src/librustc_error_codes/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ E0635: include_str!("./error_codes/E0635.md"),
351351
E0636: include_str!("./error_codes/E0636.md"),
352352
E0638: include_str!("./error_codes/E0638.md"),
353353
E0639: include_str!("./error_codes/E0639.md"),
354+
E0641: include_str!("./error_codes/E0641.md"),
354355
E0642: include_str!("./error_codes/E0642.md"),
355356
E0643: include_str!("./error_codes/E0643.md"),
356357
E0644: include_str!("./error_codes/E0644.md"),
@@ -585,7 +586,6 @@ E0744: include_str!("./error_codes/E0744.md"),
585586
E0634, // type has conflicting packed representaton hints
586587
E0637, // "'_" is not a valid lifetime bound
587588
E0640, // infer outlives requirements
588-
E0641, // cannot cast to/from a pointer with an unknown kind
589589
// E0645, // trait aliases not finished
590590
E0657, // `impl Trait` can only capture lifetimes bound at the fn level
591591
E0667, // `impl Trait` in projections

Diff for: src/librustc_error_codes/error_codes/E0641.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Attempted to cast to/from a pointer with an unknown kind.
2+
3+
Erroneous code examples:
4+
5+
```compile_fail,E0641
6+
let b = 0 as *const _; // error
7+
```
8+
9+
Must give information for type of pointer that is being cast from/to if the
10+
type cannot be inferred.
11+
12+
```
13+
// Creating a pointer from reference: type can be inferred
14+
let a = &(String::from("Hello world!")) as *const _; // Ok
15+
16+
let b = 0 as *const i32; // Ok
17+
18+
let c: *const i32 = 0 as *const _; // Ok
19+
```

0 commit comments

Comments
 (0)