wording improvement

This commit is contained in:
Guillaume Gomez 2017-06-09 22:04:29 +02:00
parent 7b8c6a2d30
commit deb1eb6134
17 changed files with 35 additions and 38 deletions

View file

@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: non-scalar cast: `()` as `u32`
// error-pattern: non-primitive cast: `()` as `u32`
fn main() { let u = (assert!(true) as u32); }

View file

@ -13,8 +13,8 @@ fn foo(_x: isize) { }
fn main() {
let v: u64 = 5;
let x = foo as extern "C" fn() -> isize;
//~^ ERROR non-scalar cast
//~^ ERROR non-primitive cast
let y = v as extern "Rust" fn(isize) -> (isize, isize);
//~^ ERROR non-scalar cast
//~^ ERROR non-primitive cast
y(x());
}

View file

@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: non-scalar cast: `u32` as `()`
// error-pattern: non-primitive cast: `u32` as `()`
fn main() { let u = 0u32 as (); }

View file

@ -14,5 +14,5 @@
fn main() {
let b = 0u8;
let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
//~^ ERROR non-scalar cast
//~^ ERROR non-primitive cast
}

View file

@ -17,7 +17,7 @@ fn cast_a() {
}
fn cast_b() {
let y = 22 as !; //~ ERROR non-scalar cast
let y = 22 as !; //~ ERROR non-primitive cast
}
fn main() { }

View file

@ -22,7 +22,7 @@ fn main() {
a as isize; //~ ERROR casting
a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
b as usize; //~ ERROR non-scalar cast
b as usize; //~ ERROR non-primitive cast
p as usize;
//~^ ERROR casting
//~^^ HELP cast through a thin pointer

View file

@ -10,5 +10,5 @@
fn main() {
let nil = ();
let _t = nil as usize; //~ ERROR: non-scalar cast: `()` as `usize`
let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize`
}

View file

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
0 as &std::any::Any; //~ ERROR non-scalar cast
0 as &std::any::Any; //~ ERROR non-primitive cast
}

View file

@ -19,7 +19,7 @@ pub trait Array2D: Index<usize> {
}
let i = y * self.columns() + x;
let indexer = &(*self as &Index<usize, Output = <Self as Index<usize>>::Output>);
//~^ERROR non-scalar cast
//~^ERROR non-primitive cast
Some(indexer.index(i))
}
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn bad (p: *const isize) {
let _q: &isize = p as &isize; //~ ERROR non-scalar cast
let _q: &isize = p as &isize; //~ ERROR non-primitive cast
}
fn main() { }

View file

@ -8,13 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:non-scalar cast
#[derive(Debug)]
struct foo {
x: isize
}
fn main() {
println!("{}", foo{ x: 1 } as isize);
println!("{}", foo{ x: 1 } as isize); //~ non-primitive cast: `foo` as `isize` [E0605]
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//error-pattern: non-scalar cast
enum non_nullary {
nullary,
other(isize),
@ -17,5 +15,5 @@ enum non_nullary {
fn main() {
let v = non_nullary::nullary;
let val = v as isize;
let val = v as isize; //~ ERROR non-primitive cast: `non_nullary` as `isize` [E0605]
}

View file

@ -11,7 +11,7 @@
enum E {}
fn f(e: E) {
println!("{}", (e as isize).to_string()); //~ ERROR non-scalar cast
println!("{}", (e as isize).to_string()); //~ ERROR non-primitive cast
}
fn main() {}

View file

@ -20,7 +20,7 @@ error[E0609]: no field `f` on type `fn() {main}`
75 | let _ = main.f as *const u32;
| ^
error[E0605]: non-scalar cast: `*const u8` as `&u8`
error[E0605]: non-primitive cast: `*const u8` as `&u8`
--> $DIR/cast-rfc0401.rs:39:13
|
39 | let _ = v as &u8;
@ -28,7 +28,7 @@ error[E0605]: non-scalar cast: `*const u8` as `&u8`
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-scalar cast: `*const u8` as `E`
error[E0605]: non-primitive cast: `*const u8` as `E`
--> $DIR/cast-rfc0401.rs:40:13
|
40 | let _ = v as E;
@ -36,7 +36,7 @@ error[E0605]: non-scalar cast: `*const u8` as `E`
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-scalar cast: `*const u8` as `fn()`
error[E0605]: non-primitive cast: `*const u8` as `fn()`
--> $DIR/cast-rfc0401.rs:41:13
|
41 | let _ = v as fn();
@ -44,7 +44,7 @@ error[E0605]: non-scalar cast: `*const u8` as `fn()`
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-scalar cast: `*const u8` as `(u32,)`
error[E0605]: non-primitive cast: `*const u8` as `(u32,)`
--> $DIR/cast-rfc0401.rs:42:13
|
42 | let _ = v as (u32,);
@ -52,7 +52,7 @@ error[E0605]: non-scalar cast: `*const u8` as `(u32,)`
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-scalar cast: `std::option::Option<&*const u8>` as `*const u8`
error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8`
--> $DIR/cast-rfc0401.rs:43:13
|
43 | let _ = Some(&v) as *const u8;

View file

@ -7,7 +7,7 @@ error[E0308]: mismatched types
37 | write!(hello);
| -------------- in this macro invocation
error[E0605]: non-scalar cast: `{integer}` as `()`
error[E0605]: non-primitive cast: `{integer}` as `()`
--> $DIR/issue-26480.rs:32:19
|
32 | ($x:expr) => ($x as ())