Move to {integer} and {float}
This commit is contained in:
parent
cfdaca049a
commit
ea77049cfa
35 changed files with 42 additions and 41 deletions
|
@ -975,7 +975,8 @@ impl fmt::Display for ty::InferTy {
|
||||||
ty::IntVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
|
ty::IntVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
|
||||||
ty::FloatVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
|
ty::FloatVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
|
||||||
ty::TyVar(_) => write!(f, "_"),
|
ty::TyVar(_) => write!(f, "_"),
|
||||||
ty::IntVar(_) | ty::FloatVar(_) => write!(f, "{}", "{numeric}"),
|
ty::IntVar(_) => write!(f, "{}", "{integer}"),
|
||||||
|
ty::FloatVar(_) => write!(f, "{}", "{float}"),
|
||||||
ty::FreshTy(v) => write!(f, "FreshTy({})", v),
|
ty::FreshTy(v) => write!(f, "FreshTy({})", v),
|
||||||
ty::FreshIntTy(v) => write!(f, "FreshIntTy({})", v),
|
ty::FreshIntTy(v) => write!(f, "FreshIntTy({})", v),
|
||||||
ty::FreshFloatTy(v) => write!(f, "FreshFloatTy({})", v)
|
ty::FreshFloatTy(v) => write!(f, "FreshFloatTy({})", v)
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn main() {
|
||||||
let _x: i32 = [1, 2, 3];
|
let _x: i32 = [1, 2, 3];
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `i32`
|
//~| expected type `i32`
|
||||||
//~| found type `[{numeric}; 3]`
|
//~| found type `[{integer}; 3]`
|
||||||
//~| expected i32, found array of 3 elements
|
//~| expected i32, found array of 3 elements
|
||||||
|
|
||||||
let x: &[i32] = &[1, 2, 3];
|
let x: &[i32] = &[1, 2, 3];
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
static i: String = 10;
|
static i: String = 10;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `std::string::String`
|
//~| expected type `std::string::String`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected struct `std::string::String`, found integral variable
|
//~| expected struct `std::string::String`, found integral variable
|
||||||
fn main() { println!("{}", i); }
|
fn main() { println!("{}", i); }
|
||||||
|
|
|
@ -15,6 +15,6 @@ fn main() {
|
||||||
f(&x);
|
f(&x);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `&mut i32`
|
//~| expected type `&mut i32`
|
||||||
//~| found type `&{numeric}`
|
//~| found type `&{integer}`
|
||||||
//~| values differ in mutability
|
//~| values differ in mutability
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,6 @@ fn main() {
|
||||||
let _: &[i32] = [0];
|
let _: &[i32] = [0];
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `&[i32]`
|
//~| expected type `&[i32]`
|
||||||
//~| found type `[{numeric}; 1]`
|
//~| found type `[{integer}; 1]`
|
||||||
//~| expected &-ptr, found array of 1 elements
|
//~| expected &-ptr, found array of 1 elements
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,6 @@ fn main() {
|
||||||
x = 5;
|
x = 5;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `std::option::Option<usize>`
|
//~| expected type `std::option::Option<usize>`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected enum `std::option::Option`, found integral variable
|
//~| expected enum `std::option::Option`, found integral variable
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn main() {
|
||||||
if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types
|
if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types
|
||||||
//~^ expected (), found integral variable
|
//~^ expected (), found integral variable
|
||||||
//~| expected type `()`
|
//~| expected type `()`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
()
|
()
|
||||||
} else { //~ NOTE: `if let` arm with an incompatible type
|
} else { //~ NOTE: `if let` arm with an incompatible type
|
||||||
1
|
1
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
fn bar<T>(_: T) {}
|
fn bar<T>(_: T) {}
|
||||||
[0][0u8]; //~ ERROR: `[{numeric}]: std::ops::Index<u8>` is not satisfied
|
[0][0u8]; //~ ERROR: `[{integer}]: std::ops::Index<u8>` is not satisfied
|
||||||
|
|
||||||
[0][0]; // should infer to be a usize
|
[0][0]; // should infer to be a usize
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn main() {
|
||||||
let mut x = 2;
|
let mut x = 2;
|
||||||
x = 5.0;
|
x = 5.0;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `{numeric}`
|
//~| expected type `{integer}`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{float}`
|
||||||
//~| expected integral variable, found floating-point variable
|
//~| expected integral variable, found floating-point variable
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,13 @@ pub fn main() {
|
||||||
let _x: usize = match Some(1) {
|
let _x: usize = match Some(1) {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `std::option::Option<{numeric}>`
|
//~| expected type `std::option::Option<{integer}>`
|
||||||
//~| found type `std::result::Result<_, _>`
|
//~| found type `std::result::Result<_, _>`
|
||||||
//~| expected enum `std::option::Option`, found enum `std::result::Result`
|
//~| expected enum `std::option::Option`, found enum `std::result::Result`
|
||||||
|
|
||||||
Err(e) => panic!(e)
|
Err(e) => panic!(e)
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `std::option::Option<{numeric}>`
|
//~| expected type `std::option::Option<{integer}>`
|
||||||
//~| found type `std::result::Result<_, _>`
|
//~| found type `std::result::Result<_, _>`
|
||||||
//~| expected enum `std::option::Option`, found enum `std::result::Result`
|
//~| expected enum `std::option::Option`, found enum `std::result::Result`
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,5 +14,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||||
(|| Box::new(*(&[0][..])))();
|
(|| Box::new(*(&[0][..])))();
|
||||||
//~^ ERROR `[{numeric}]: std::marker::Sized` is not satisfied
|
//~^ ERROR `[{integer}]: std::marker::Sized` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
|
if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
|
||||||
//~| expected type `()`
|
//~| expected type `()`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected (), found integral variable
|
//~| expected (), found integral variable
|
||||||
765
|
765
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
macro_rules! macro_panic {
|
macro_rules! macro_panic {
|
||||||
($not_a_function:expr, $some_argument:ident) => {
|
($not_a_function:expr, $some_argument:ident) => {
|
||||||
$not_a_function($some_argument)
|
$not_a_function($some_argument)
|
||||||
//~^ ERROR expected function, found `{numeric}`
|
//~^ ERROR expected function, found `{integer}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
} else if false {
|
} else if false {
|
||||||
//~^ ERROR if may be missing an else clause
|
//~^ ERROR if may be missing an else clause
|
||||||
//~| expected type `()`
|
//~| expected type `()`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected (), found integral variable
|
//~| expected (), found integral variable
|
||||||
1
|
1
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ const A: (isize,isize) = (4,2);
|
||||||
fn main() {
|
fn main() {
|
||||||
match 42 { A => () }
|
match 42 { A => () }
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `{numeric}`
|
//~| expected type `{integer}`
|
||||||
//~| found type `(isize, isize)`
|
//~| found type `(isize, isize)`
|
||||||
//~| expected integral variable, found tuple
|
//~| expected integral variable, found tuple
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,12 @@ fn main() {
|
||||||
match &Some(42) {
|
match &Some(42) {
|
||||||
Some(x) => (),
|
Some(x) => (),
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `&std::option::Option<{numeric}>`
|
//~| expected type `&std::option::Option<{integer}>`
|
||||||
//~| found type `std::option::Option<_>`
|
//~| found type `std::option::Option<_>`
|
||||||
//~| expected &-ptr, found enum `std::option::Option`
|
//~| expected &-ptr, found enum `std::option::Option`
|
||||||
None => ()
|
None => ()
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `&std::option::Option<{numeric}>`
|
//~| expected type `&std::option::Option<{integer}>`
|
||||||
//~| found type `std::option::Option<_>`
|
//~| found type `std::option::Option<_>`
|
||||||
//~| expected &-ptr, found enum `std::option::Option`
|
//~| expected &-ptr, found enum `std::option::Option`
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@ fn take_param<T:Foo>(foo: &T) { }
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: Box<_> = box 3;
|
let x: Box<_> = box 3;
|
||||||
take_param(&x);
|
take_param(&x);
|
||||||
//~^ ERROR `Box<{numeric}>: std::marker::Copy` is not satisfied
|
//~^ ERROR `Box<{integer}>: std::marker::Copy` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ fn main() {
|
||||||
10 ... "what" => ()
|
10 ... "what" => ()
|
||||||
};
|
};
|
||||||
//~^^ ERROR only char and numeric types are allowed in range
|
//~^^ ERROR only char and numeric types are allowed in range
|
||||||
//~| start type: {numeric}
|
//~| start type: {integer}
|
||||||
//~| end type: &'static str
|
//~| end type: &'static str
|
||||||
|
|
||||||
match 5 {
|
match 5 {
|
||||||
|
@ -28,6 +28,6 @@ fn main() {
|
||||||
_ => { }
|
_ => { }
|
||||||
};
|
};
|
||||||
//~^^^ ERROR mismatched types
|
//~^^^ ERROR mismatched types
|
||||||
//~| expected type `_`
|
//~| expected type `{integer}`
|
||||||
//~| found type `char`
|
//~| found type `char`
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
match &[0, 1, 2] {
|
match &[0, 1, 2] {
|
||||||
[..] => {} //~ ERROR expected an array or slice, found `&[{numeric}; 3]`
|
[..] => {} //~ ERROR expected an array or slice, found `&[{integer}; 3]`
|
||||||
};
|
};
|
||||||
|
|
||||||
match &[0, 1, 2] {
|
match &[0, 1, 2] {
|
||||||
|
|
|
@ -24,6 +24,6 @@ fn main() {
|
||||||
//~| expected &-ptr, found struct `Foo`
|
//~| expected &-ptr, found struct `Foo`
|
||||||
Foo::bar(&42); //~ ERROR mismatched types
|
Foo::bar(&42); //~ ERROR mismatched types
|
||||||
//~| expected type `&Foo`
|
//~| expected type `&Foo`
|
||||||
//~| found type `&{numeric}`
|
//~| found type `&{integer}`
|
||||||
//~| expected struct `Foo`, found integral variable
|
//~| expected struct `Foo`, found integral variable
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
// (separate lines to ensure the spans are accurate)
|
// (separate lines to ensure the spans are accurate)
|
||||||
|
|
||||||
let &_ //~ ERROR mismatched types
|
let &_ //~ ERROR mismatched types
|
||||||
//~| expected type `&mut {numeric}`
|
//~| expected type `&mut {integer}`
|
||||||
//~| found type `&_`
|
//~| found type `&_`
|
||||||
//~| values differ in mutability
|
//~| values differ in mutability
|
||||||
= foo;
|
= foo;
|
||||||
|
@ -23,7 +23,7 @@ fn main() {
|
||||||
let bar = &1;
|
let bar = &1;
|
||||||
let &_ = bar;
|
let &_ = bar;
|
||||||
let &mut _ //~ ERROR mismatched types
|
let &mut _ //~ ERROR mismatched types
|
||||||
//~| expected type `&{numeric}`
|
//~| expected type `&{integer}`
|
||||||
//~| found type `&mut _`
|
//~| found type `&mut _`
|
||||||
//~| values differ in mutability
|
//~| values differ in mutability
|
||||||
= bar;
|
= bar;
|
||||||
|
|
|
@ -15,5 +15,5 @@ fn bar<T: Send>(_: T) {}
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = Rc::new(5);
|
let x = Rc::new(5);
|
||||||
bar(x);
|
bar(x);
|
||||||
//~^ ERROR `std::rc::Rc<{numeric}>: std::marker::Send` is not satisfied
|
//~^ ERROR `std::rc::Rc<{integer}>: std::marker::Send` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@ pub fn main() {
|
||||||
// Unsized type.
|
// Unsized type.
|
||||||
let arr: &[_] = &[1, 2, 3];
|
let arr: &[_] = &[1, 2, 3];
|
||||||
let range = *arr..;
|
let range = *arr..;
|
||||||
//~^ ERROR `[{numeric}]: std::marker::Sized` is not satisfied
|
//~^ ERROR `[{integer}]: std::marker::Sized` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ fn main() {
|
||||||
let d = [0; 0.5];
|
let d = [0; 0.5];
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `usize`
|
//~| expected type `usize`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{float}`
|
||||||
//~| expected usize, found floating-point variable
|
//~| expected usize, found floating-point variable
|
||||||
//~| ERROR expected usize for repeat count, found float [E0306]
|
//~| ERROR expected usize for repeat count, found float [E0306]
|
||||||
let e = [0; "foo"];
|
let e = [0; "foo"];
|
||||||
|
|
|
@ -16,8 +16,8 @@ fn main() {
|
||||||
match Foo(1.1, marker::PhantomData) {
|
match Foo(1.1, marker::PhantomData) {
|
||||||
1 => {}
|
1 => {}
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `Foo<{numeric}, _>`
|
//~| expected type `Foo<{float}, _>`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected struct `Foo`, found integral variable
|
//~| expected struct `Foo`, found integral variable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let s: &str = "hello";
|
let s: &str = "hello";
|
||||||
let c: u8 = s[4]; //~ ERROR `str: std::ops::Index<{numeric}>` is not satisfied
|
let c: u8 = s[4]; //~ ERROR `str: std::ops::Index<{integer}>` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,6 @@ fn main() {
|
||||||
//~| expected struct `Foo`, found struct `Bar`
|
//~| expected struct `Foo`, found struct `Bar`
|
||||||
let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types
|
let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types
|
||||||
//~| expected type `Foo`
|
//~| expected type `Foo`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected struct `Foo`, found integral variable
|
//~| expected struct `Foo`, found integral variable
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types
|
||||||
//~| expected struct `Foo`, found struct `Bar`
|
//~| expected struct `Foo`, found struct `Bar`
|
||||||
static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types
|
static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types
|
||||||
//~| expected type `Foo`
|
//~| expected type `Foo`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected struct `Foo`, found integral variable
|
//~| expected struct `Foo`, found integral variable
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -26,5 +26,5 @@ fn is_ee<T: Combo>(t: T) {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
is_ee(4);
|
is_ee(4);
|
||||||
//~^ ERROR overflow evaluating the requirement `{numeric}: Tweedle
|
//~^ ERROR overflow evaluating the requirement `{integer}: Tweedle
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn main() {
|
||||||
let y = first ((1,2.0,3));
|
let y = first ((1,2.0,3));
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `(isize, f64)`
|
//~| expected type `(isize, f64)`
|
||||||
//~| found type `(isize, f64, {numeric})`
|
//~| found type `(isize, f64, {integer})`
|
||||||
//~| expected a tuple with 2 elements, found one with 3 elements
|
//~| expected a tuple with 2 elements, found one with 3 elements
|
||||||
|
|
||||||
let y = first ((1,));
|
let y = first ((1,));
|
||||||
|
|
|
@ -20,5 +20,5 @@ fn main() {
|
||||||
tuple.0;
|
tuple.0;
|
||||||
tuple.1;
|
tuple.1;
|
||||||
tuple.2;
|
tuple.2;
|
||||||
//~^ ERROR attempted out-of-bounds tuple index `2` on type `({numeric}, {numeric})`
|
//~^ ERROR attempted out-of-bounds tuple index `2` on type `({integer}, {integer})`
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
fn main() { let a: bool = 1; let b: i32 = true; }
|
fn main() { let a: bool = 1; let b: i32 = true; }
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `bool`
|
//~| expected type `bool`
|
||||||
//~| found type `{numeric}`
|
//~| found type `{integer}`
|
||||||
//~| expected bool, found integral variable
|
//~| expected bool, found integral variable
|
||||||
//~| ERROR mismatched types
|
//~| ERROR mismatched types
|
||||||
//~| expected i32, found bool
|
//~| expected i32, found bool
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn test<T: Sync>(s: T) {}
|
||||||
fn main() {
|
fn main() {
|
||||||
let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)});
|
let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)});
|
||||||
test(us);
|
test(us);
|
||||||
//~^ ERROR `std::cell::UnsafeCell<MySync<{numeric}>>: std::marker::Sync` is not satisfied
|
//~^ ERROR `std::cell::UnsafeCell<MySync<{integer}>>: std::marker::Sync` is not satisfied
|
||||||
|
|
||||||
let uns = UnsafeCell::new(NoSync);
|
let uns = UnsafeCell::new(NoSync);
|
||||||
test(uns);
|
test(uns);
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl TraitB for isize {
|
||||||
|
|
||||||
fn call_it<B:TraitB>(b: B) -> isize {
|
fn call_it<B:TraitB>(b: B) -> isize {
|
||||||
let y = 4;
|
let y = 4;
|
||||||
b.gimme_an_a(y) //~ ERROR `{numeric}: TraitA` is not satisfied
|
b.gimme_an_a(y) //~ ERROR `{integer}: TraitA` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ error[E0308]: mismatched types
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize
|
||||||
$DIR/issue-26480.rs:38:5: 38:19 note: in this expansion of write! (defined in $DIR/issue-26480.rs)
|
$DIR/issue-26480.rs:38:5: 38:19 note: in this expansion of write! (defined in $DIR/issue-26480.rs)
|
||||||
|
|
||||||
error: non-scalar cast: `{numeric}` as `()`
|
error: non-scalar cast: `{integer}` as `()`
|
||||||
--> $DIR/issue-26480.rs:33:19
|
--> $DIR/issue-26480.rs:33:19
|
||||||
|
|
|
|
||||||
33 | ($x:expr) => ($x as ())
|
33 | ($x:expr) => ($x as ())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue