Skip to content

Commit cfdaca0

Browse files
author
Jonathan Turner
committed
Rename _ to {numerics} for unknown numeric types
1 parent cec262e commit cfdaca0

35 files changed

+41
-40
lines changed

src/librustc/util/ppaux.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,8 @@ impl fmt::Display for ty::InferTy {
974974
ty::TyVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
975975
ty::IntVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
976976
ty::FloatVar(ref vid) if print_var_ids => write!(f, "{:?}", vid),
977-
ty::TyVar(_) | ty::IntVar(_) | ty::FloatVar(_) => write!(f, "_"),
977+
ty::TyVar(_) => write!(f, "_"),
978+
ty::IntVar(_) | ty::FloatVar(_) => write!(f, "{}", "{numeric}"),
978979
ty::FreshTy(v) => write!(f, "FreshTy({})", v),
979980
ty::FreshIntTy(v) => write!(f, "FreshIntTy({})", v),
980981
ty::FreshFloatTy(v) => write!(f, "FreshFloatTy({})", v)

src/test/compile-fail/array-not-vector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212
let _x: i32 = [1, 2, 3];
1313
//~^ ERROR mismatched types
1414
//~| expected type `i32`
15-
//~| found type `[_; 3]`
15+
//~| found type `[{numeric}; 3]`
1616
//~| expected i32, found array of 3 elements
1717

1818
let x: &[i32] = &[1, 2, 3];

src/test/compile-fail/bad-const-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
static i: String = 10;
1212
//~^ ERROR mismatched types
1313
//~| expected type `std::string::String`
14-
//~| found type `_`
14+
//~| found type `{numeric}`
1515
//~| expected struct `std::string::String`, found integral variable
1616
fn main() { println!("{}", i); }

src/test/compile-fail/coerce-mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ fn main() {
1515
f(&x);
1616
//~^ ERROR mismatched types
1717
//~| expected type `&mut i32`
18-
//~| found type `&_`
18+
//~| found type `&{numeric}`
1919
//~| values differ in mutability
2020
}

src/test/compile-fail/coercion-slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ fn main() {
1414
let _: &[i32] = [0];
1515
//~^ ERROR mismatched types
1616
//~| expected type `&[i32]`
17-
//~| found type `[_; 1]`
17+
//~| found type `[{numeric}; 1]`
1818
//~| expected &-ptr, found array of 1 elements
1919
}

src/test/compile-fail/fully-qualified-type-name1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ fn main() {
1515
x = 5;
1616
//~^ ERROR mismatched types
1717
//~| expected type `std::option::Option<usize>`
18-
//~| found type `_`
18+
//~| found type `{numeric}`
1919
//~| expected enum `std::option::Option`, found integral variable
2020
}

src/test/compile-fail/if-let-arm-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212
if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types
1313
//~^ expected (), found integral variable
1414
//~| expected type `()`
15-
//~| found type `_`
15+
//~| found type `{numeric}`
1616
()
1717
} else { //~ NOTE: `if let` arm with an incompatible type
1818
1

src/test/compile-fail/indexing-requires-a-uint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
fn main() {
1515
fn bar<T>(_: T) {}
16-
[0][0u8]; //~ ERROR: `[_]: std::ops::Index<u8>` is not satisfied
16+
[0][0u8]; //~ ERROR: `[{numeric}]: std::ops::Index<u8>` is not satisfied
1717

1818
[0][0]; // should infer to be a usize
1919

src/test/compile-fail/integral-variable-unification-error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212
let mut x = 2;
1313
x = 5.0;
1414
//~^ ERROR mismatched types
15-
//~| expected type `_`
16-
//~| found type `_`
15+
//~| expected type `{numeric}`
16+
//~| found type `{numeric}`
1717
//~| expected integral variable, found floating-point variable
1818
}

src/test/compile-fail/issue-13466.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ pub fn main() {
1717
let _x: usize = match Some(1) {
1818
Ok(u) => u,
1919
//~^ ERROR mismatched types
20-
//~| expected type `std::option::Option<_>`
20+
//~| expected type `std::option::Option<{numeric}>`
2121
//~| found type `std::result::Result<_, _>`
2222
//~| expected enum `std::option::Option`, found enum `std::result::Result`
2323

2424
Err(e) => panic!(e)
2525
//~^ ERROR mismatched types
26-
//~| expected type `std::option::Option<_>`
26+
//~| expected type `std::option::Option<{numeric}>`
2727
//~| found type `std::result::Result<_, _>`
2828
//~| expected enum `std::option::Option`, found enum `std::result::Result`
2929
};

0 commit comments

Comments
 (0)