diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-19 13:10:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-19 13:10:19 +0100 |
| commit | b5166b1e854ee07a3cf2cbd55b4658da10447fdc (patch) | |
| tree | 56a7c31de0757789f4e3a2a613f5834e78448686 | |
| parent | ee535a0f95f40513b130d7bcf0a2d77477b1b7b4 (diff) | |
| parent | dc137dd868daaa2d7821997e6a87d49fbb9e4ca8 (diff) | |
| download | rust-b5166b1e854ee07a3cf2cbd55b4658da10447fdc.tar.gz rust-b5166b1e854ee07a3cf2cbd55b4658da10447fdc.zip | |
Rollup merge of #66461 - clemencetbk:master, r=GuillaumeGomez
Add explanation message for E0641 Part of #61137
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 2 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0641.md | 19 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-45730.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/order-dependent-cast-inference.stderr | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 9fc375cc7b0..e575528a463 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -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"), @@ -584,7 +585,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 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 diff --git a/src/test/ui/issues/issue-45730.stderr b/src/test/ui/issues/issue-45730.stderr index 4fc1e3835f7..3c400d6eefa 100644 --- a/src/test/ui/issues/issue-45730.stderr +++ b/src/test/ui/issues/issue-45730.stderr @@ -30,3 +30,4 @@ LL | let x = 0 as *const i32 as *const _ as *mut _; error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0641`. diff --git a/src/test/ui/order-dependent-cast-inference.stderr b/src/test/ui/order-dependent-cast-inference.stderr index 01e59f8f022..081038c573a 100644 --- a/src/test/ui/order-dependent-cast-inference.stderr +++ b/src/test/ui/order-dependent-cast-inference.stderr @@ -10,3 +10,4 @@ LL | let mut y = 0 as *const _; error: aborting due to previous error +For more information about this error, try `rustc --explain E0641`. |
