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