-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #66461 - clemencetbk:master, r=GuillaumeGomez
Add explanation message for E0641 Part of #61137
- Loading branch information
Showing
4 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters