Skip to content

Commit

Permalink
Add E0512 error explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 8, 2015
1 parent 95285c4 commit 3448e3c
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/librustc_trans/diagnostics.rs
Expand Up @@ -12,6 +12,35 @@

register_long_diagnostics! {

E0512: r##"
A transmute was called on types with different sizes. Erroneous code example:
```
extern "rust-intrinsic" {
pub fn ctpop8(x: u8) -> u8;
}
fn main() {
unsafe { ctpop8(::std::mem::transmute(0u16)); }
// error: transmute called on types with different sizes
}
```
Please use types with same size or use the awaited type directly. Example:
```
extern "rust-intrinsic" {
pub fn ctpop8(x: u8) -> u8;
}
fn main() {
unsafe { ctpop8(::std::mem::transmute(0i8)); } // ok!
// or:
unsafe { ctpop8(0u8); } // ok!
}
```
"##,

E0515: r##"
A constant index expression was out of bounds. Erroneous code example:
Expand All @@ -23,7 +52,7 @@ Please specify a valid index (not inferior to 0 or superior to array length).
Example:
```
let x = &[0, 1, 2][2]; // ok!
let x = &[0, 1, 2][2]; // ok
```
"##,

Expand All @@ -32,5 +61,4 @@ let x = &[0, 1, 2][2]; // ok!
register_diagnostics! {
E0510, // invalid use of `return_address` intrinsic: function does not use out pointer
E0511, // invalid monomorphization of `{}` intrinsic
E0512, // transmute called on types with potentially different sizes...
}

0 comments on commit 3448e3c

Please sign in to comment.