Use smaller spans for some structured suggestions

Use more accurate suggestion spans for

* argument parse error
* fully qualified path
* missing code block type
* numeric casts
* E0212
This commit is contained in:
Esteban Kuber 2021-08-10 10:53:43 +00:00
parent eb2226b1f1
commit 34d19634f5
60 changed files with 1200 additions and 958 deletions

View file

@ -14,7 +14,7 @@ LL | | /// ```
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
| ~~~~~~~
| ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:9:5
@ -32,7 +32,7 @@ LL | | /// ```
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
| ~~~~~~~
| ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:21:5
@ -47,7 +47,7 @@ LL | | /// ```
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
| ~~~~~~~
| ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:35:5
@ -123,7 +123,7 @@ LL | | /// ```
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
| ~~~~~~~
| ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:92:9
@ -148,7 +148,7 @@ LL | | /// ```
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
| ~~~~~~~
| ++++
warning: 12 warnings emitted

View file

@ -8,15 +8,15 @@ LL | fn foo(i32);
help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: i32);
| ~~~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | fn foo(i32: TypeName);
| ~~~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(_: i32);
| ~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:9:29
@ -28,7 +28,7 @@ LL | fn foo_with_ref(&mut i32);
help: if this is a `self` type, give it a parameter name
|
LL | fn foo_with_ref(self: &mut i32);
| ~~~~~~~~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | fn foo_with_ref(i32: &mut TypeName);
@ -36,7 +36,7 @@ LL | fn foo_with_ref(i32: &mut TypeName);
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo_with_ref(_: &mut i32);
| ~~~~~~~~~~~
| ++
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:12:47
@ -96,15 +96,15 @@ LL | fn bar_with_default_impl(String, String) {}
help: if this is a `self` type, give it a parameter name
|
LL | fn bar_with_default_impl(self: String, String) {}
| ~~~~~~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | fn bar_with_default_impl(String: TypeName, String) {}
| ~~~~~~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar_with_default_impl(_: String, String) {}
| ~~~~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:22:44
@ -116,11 +116,11 @@ LL | fn bar_with_default_impl(String, String) {}
help: if this is a parameter name, give it a type
|
LL | fn bar_with_default_impl(String, String: TypeName) {}
| ~~~~~~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar_with_default_impl(String, _: String) {}
| ~~~~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `,`
--> $DIR/anon-params-denied-2018.rs:27:22
@ -132,11 +132,11 @@ LL | fn baz(a:usize, b, c: usize) -> usize {
help: if this is a parameter name, give it a type
|
LL | fn baz(a:usize, b: TypeName, c: usize) -> usize {
| ~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn baz(a:usize, _: b, c: usize) -> usize {
| ~~~~
| ++
error: aborting due to 9 previous errors

View file

@ -13,11 +13,11 @@ LL | fn a<C:Vehicle+Box>(_: C::Color) {
help: use fully qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) {
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `C`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12
@ -34,11 +34,11 @@ LL | fn b<C>(_: C::Color) where C : Vehicle+Box {
help: use fully qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box {
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box {
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `C`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12
@ -55,11 +55,11 @@ LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box {
help: use fully qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box {
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `X`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20
@ -76,11 +76,11 @@ LL | fn e(&self, _: X::Color) where X : Box;
help: use fully qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `X`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20
@ -97,11 +97,11 @@ LL | fn f(&self, _: X::Color) where X : Box { }
help: use fully qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `X`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20
@ -118,11 +118,11 @@ LL | fn d(&self, _: X::Color) where X : Box { }
help: use fully qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
error: aborting due to 6 previous errors

View file

@ -21,11 +21,11 @@ LL | fn dent<C:BoxCar>(c: C, color: C::Color) {
help: use fully qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37
@ -74,11 +74,11 @@ LL | fn paint<C:BoxCar>(c: C, d: C::Color) {
help: use fully qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
| ~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~
error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32

View file

@ -19,11 +19,11 @@ LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {}
help: use fully qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {}
| ~~~~~~~~~~~~~
| ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {}
| ~~~~~~~~~~~~~
| ~~~~~~~~~~~~
error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | f1(2i32, 4i32);
help: change the type of the numeric literal from `i32` to `u32`
|
LL | f1(2i32, 4u32);
| ~~~~
| ~~~
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:29:5
@ -50,7 +50,7 @@ LL | let _: i32 = f2(2i32);
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
LL | let _: i32 = f2(2i32).try_into().unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to 6 previous errors

View file

@ -2,7 +2,12 @@ error[E0212]: cannot use the associated type of a trait with uninferred generic
--> $DIR/associated-types-project-from-hrtb-in-fn.rs:13:8
|
LL | x: I::A)
| ^^^^ help: use a fully qualified path with inferred lifetimes: `<I as Foo<&isize>>::A`
| ^^^^
|
help: use a fully qualified path with inferred lifetimes
|
LL | x: <I as Foo<&isize>>::A)
| ~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

View file

@ -2,13 +2,23 @@ error[E0212]: cannot use the associated type of a trait with uninferred generic
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:13:32
|
LL | fn some_method(&self, arg: I::A);
| ^^^^ help: use a fully qualified path with inferred lifetimes: `<I as Foo<&isize>>::A`
| ^^^^
|
help: use a fully qualified path with inferred lifetimes
|
LL | fn some_method(&self, arg: <I as Foo<&isize>>::A);
| ~~~~~~~~~~~~~~~~~~~~
error[E0212]: cannot use the associated type of a trait with uninferred generic parameters
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24
|
LL | fn mango(&self) -> X::Assoc {
| ^^^^^^^^ help: use a fully qualified path with inferred lifetimes: `<X as Banana<'_>>::Assoc`
| ^^^^^^^^
|
help: use a fully qualified path with inferred lifetimes
|
LL | fn mango(&self) -> <X as Banana<'_>>::Assoc {
| ~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | assert_eq!(R.method::<1u16>(), 1);
help: change the type of the numeric literal from `u16` to `u8`
|
LL | assert_eq!(R.method::<1u8>(), 1);
| ~~~
| ~~
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | assert_eq!(R.method::<1u16>(), 1);
help: change the type of the numeric literal from `u16` to `u8`
|
LL | assert_eq!(R.method::<1u8>(), 1);
| ~~~
| ~~
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | OhNo = 0_u8,
help: change the type of the numeric literal from `u8` to `i8`
|
LL | OhNo = 0_i8,
| ~~~~
| ~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:28:16
@ -18,7 +18,7 @@ LL | OhNo = 0_i8,
help: change the type of the numeric literal from `i8` to `u8`
|
LL | OhNo = 0_u8,
| ~~~~
| ~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:41:16
@ -29,7 +29,7 @@ LL | OhNo = 0_u16,
help: change the type of the numeric literal from `u16` to `i16`
|
LL | OhNo = 0_i16,
| ~~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:54:16
@ -40,7 +40,7 @@ LL | OhNo = 0_i16,
help: change the type of the numeric literal from `i16` to `u16`
|
LL | OhNo = 0_u16,
| ~~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:67:16
@ -51,7 +51,7 @@ LL | OhNo = 0_u32,
help: change the type of the numeric literal from `u32` to `i32`
|
LL | OhNo = 0_i32,
| ~~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:80:16
@ -62,7 +62,7 @@ LL | OhNo = 0_i32,
help: change the type of the numeric literal from `i32` to `u32`
|
LL | OhNo = 0_u32,
| ~~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:93:16
@ -73,7 +73,7 @@ LL | OhNo = 0_u64,
help: change the type of the numeric literal from `u64` to `i64`
|
LL | OhNo = 0_i64,
| ~~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:106:16
@ -84,7 +84,7 @@ LL | OhNo = 0_i64,
help: change the type of the numeric literal from `i64` to `u64`
|
LL | OhNo = 0_u64,
| ~~~~~
| ~~~
error: aborting due to 8 previous errors

View file

@ -13,11 +13,11 @@ LL | let _: Self::A;
help: use fully qualified syntax to disambiguate
|
LL | let _: <Self as Foo>::A;
| ~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | let _: <Self as Bar>::A;
| ~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Err` in bounds of `Self`
--> $DIR/E0221.rs:21:16
@ -26,12 +26,13 @@ LL | type Err: T3;
| ------------- ambiguous `Err` from `My`
LL | fn test() {
LL | let _: Self::Err;
| ^^^^^^^^^
| |
| ambiguous associated type `Err`
| help: use fully qualified syntax to disambiguate: `<Self as My>::Err`
| ^^^^^^^^^ ambiguous associated type `Err`
|
= note: associated type `Self` could derive from `FromStr`
help: use fully qualified syntax to disambiguate
|
LL | let _: <Self as My>::Err;
| ~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

View file

@ -19,7 +19,7 @@ LL | let y: f32 = 1f64;
help: change the type of the numeric literal from `f64` to `f32`
|
LL | let y: f32 = 1f32;
| ~~~~
| ~~~
error: aborting due to 2 previous errors

View file

@ -16,7 +16,7 @@ LL | bar::<isize>(i); // i should not be re-coerced back to an isize
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
| ~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | id_i8(a16);
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(a16.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:41:11
@ -18,7 +18,7 @@ LL | id_i8(a32);
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(a32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:44:11
@ -29,7 +29,7 @@ LL | id_i8(a64);
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(a64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:47:11
@ -40,16 +40,18 @@ LL | id_i8(asize);
help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(asize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:51:12
|
LL | id_i16(a8);
| ^^
| |
| expected `i16`, found `i8`
| help: you can convert an `i8` to an `i16`: `a8.into()`
| ^^ expected `i16`, found `i8`
|
help: you can convert an `i8` to an `i16`
|
LL | id_i16(a8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:55:12
@ -60,7 +62,7 @@ LL | id_i16(a32);
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(a32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:58:12
@ -71,7 +73,7 @@ LL | id_i16(a64);
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(a64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:61:12
@ -82,25 +84,29 @@ LL | id_i16(asize);
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(asize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:65:12
|
LL | id_i32(a8);
| ^^
| |
| expected `i32`, found `i8`
| help: you can convert an `i8` to an `i32`: `a8.into()`
| ^^ expected `i32`, found `i8`
|
help: you can convert an `i8` to an `i32`
|
LL | id_i32(a8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:68:12
|
LL | id_i32(a16);
| ^^^
| |
| expected `i32`, found `i16`
| help: you can convert an `i16` to an `i32`: `a16.into()`
| ^^^ expected `i32`, found `i16`
|
help: you can convert an `i16` to an `i32`
|
LL | id_i32(a16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:72:12
@ -111,7 +117,7 @@ LL | id_i32(a64);
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | id_i32(a64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:75:12
@ -122,34 +128,40 @@ LL | id_i32(asize);
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
|
LL | id_i32(asize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:79:12
|
LL | id_i64(a8);
| ^^
| |
| expected `i64`, found `i8`
| help: you can convert an `i8` to an `i64`: `a8.into()`
| ^^ expected `i64`, found `i8`
|
help: you can convert an `i8` to an `i64`
|
LL | id_i64(a8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:82:12
|
LL | id_i64(a16);
| ^^^
| |
| expected `i64`, found `i16`
| help: you can convert an `i16` to an `i64`: `a16.into()`
| ^^^ expected `i64`, found `i16`
|
help: you can convert an `i16` to an `i64`
|
LL | id_i64(a16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:85:12
|
LL | id_i64(a32);
| ^^^
| |
| expected `i64`, found `i32`
| help: you can convert an `i32` to an `i64`: `a32.into()`
| ^^^ expected `i64`, found `i32`
|
help: you can convert an `i32` to an `i64`
|
LL | id_i64(a32.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:89:12
@ -160,25 +172,29 @@ LL | id_i64(asize);
help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
|
LL | id_i64(asize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:93:14
|
LL | id_isize(a8);
| ^^
| |
| expected `isize`, found `i8`
| help: you can convert an `i8` to an `isize`: `a8.into()`
| ^^ expected `isize`, found `i8`
|
help: you can convert an `i8` to an `isize`
|
LL | id_isize(a8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:96:14
|
LL | id_isize(a16);
| ^^^
| |
| expected `isize`, found `i16`
| help: you can convert an `i16` to an `isize`: `a16.into()`
| ^^^ expected `isize`, found `i16`
|
help: you can convert an `i16` to an `isize`
|
LL | id_isize(a16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:99:14
@ -189,7 +205,7 @@ LL | id_isize(a32);
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
|
LL | id_isize(a32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:102:14
@ -200,7 +216,7 @@ LL | id_isize(a64);
help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
|
LL | id_isize(a64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:108:11
@ -211,7 +227,7 @@ LL | id_i8(c16);
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(c16.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:111:11
@ -222,7 +238,7 @@ LL | id_i8(c32);
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(c32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:114:11
@ -233,16 +249,18 @@ LL | id_i8(c64);
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(c64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:118:12
|
LL | id_i16(c8);
| ^^
| |
| expected `i16`, found `i8`
| help: you can convert an `i8` to an `i16`: `c8.into()`
| ^^ expected `i16`, found `i8`
|
help: you can convert an `i8` to an `i16`
|
LL | id_i16(c8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:122:12
@ -253,7 +271,7 @@ LL | id_i16(c32);
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(c32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:125:12
@ -264,25 +282,29 @@ LL | id_i16(c64);
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(c64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:129:12
|
LL | id_i32(c8);
| ^^
| |
| expected `i32`, found `i8`
| help: you can convert an `i8` to an `i32`: `c8.into()`
| ^^ expected `i32`, found `i8`
|
help: you can convert an `i8` to an `i32`
|
LL | id_i32(c8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:132:12
|
LL | id_i32(c16);
| ^^^
| |
| expected `i32`, found `i16`
| help: you can convert an `i16` to an `i32`: `c16.into()`
| ^^^ expected `i32`, found `i16`
|
help: you can convert an `i16` to an `i32`
|
LL | id_i32(c16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:136:12
@ -293,34 +315,40 @@ LL | id_i32(c64);
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | id_i32(c64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:140:12
|
LL | id_i64(a8);
| ^^
| |
| expected `i64`, found `i8`
| help: you can convert an `i8` to an `i64`: `a8.into()`
| ^^ expected `i64`, found `i8`
|
help: you can convert an `i8` to an `i64`
|
LL | id_i64(a8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:143:12
|
LL | id_i64(a16);
| ^^^
| |
| expected `i64`, found `i16`
| help: you can convert an `i16` to an `i64`: `a16.into()`
| ^^^ expected `i64`, found `i16`
|
help: you can convert an `i16` to an `i64`
|
LL | id_i64(a16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:146:12
|
LL | id_i64(a32);
| ^^^
| |
| expected `i64`, found `i32`
| help: you can convert an `i32` to an `i64`: `a32.into()`
| ^^^ expected `i64`, found `i32`
|
help: you can convert an `i32` to an `i64`
|
LL | id_i64(a32.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:152:11
@ -331,7 +359,7 @@ LL | id_u8(b16);
help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(b16.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:155:11
@ -342,7 +370,7 @@ LL | id_u8(b32);
help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(b32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:158:11
@ -353,7 +381,7 @@ LL | id_u8(b64);
help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(b64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:161:11
@ -364,16 +392,18 @@ LL | id_u8(bsize);
help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(bsize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:165:12
|
LL | id_u16(b8);
| ^^
| |
| expected `u16`, found `u8`
| help: you can convert a `u8` to a `u16`: `b8.into()`
| ^^ expected `u16`, found `u8`
|
help: you can convert a `u8` to a `u16`
|
LL | id_u16(b8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:169:12
@ -384,7 +414,7 @@ LL | id_u16(b32);
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
|
LL | id_u16(b32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:172:12
@ -395,7 +425,7 @@ LL | id_u16(b64);
help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
|
LL | id_u16(b64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:175:12
@ -406,25 +436,29 @@ LL | id_u16(bsize);
help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
|
LL | id_u16(bsize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:179:12
|
LL | id_u32(b8);
| ^^
| |
| expected `u32`, found `u8`
| help: you can convert a `u8` to a `u32`: `b8.into()`
| ^^ expected `u32`, found `u8`
|
help: you can convert a `u8` to a `u32`
|
LL | id_u32(b8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:182:12
|
LL | id_u32(b16);
| ^^^
| |
| expected `u32`, found `u16`
| help: you can convert a `u16` to a `u32`: `b16.into()`
| ^^^ expected `u32`, found `u16`
|
help: you can convert a `u16` to a `u32`
|
LL | id_u32(b16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:186:12
@ -435,7 +469,7 @@ LL | id_u32(b64);
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
LL | id_u32(b64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:189:12
@ -446,34 +480,40 @@ LL | id_u32(bsize);
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | id_u32(bsize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:193:12
|
LL | id_u64(b8);
| ^^
| |
| expected `u64`, found `u8`
| help: you can convert a `u8` to a `u64`: `b8.into()`
| ^^ expected `u64`, found `u8`
|
help: you can convert a `u8` to a `u64`
|
LL | id_u64(b8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:196:12
|
LL | id_u64(b16);
| ^^^
| |
| expected `u64`, found `u16`
| help: you can convert a `u16` to a `u64`: `b16.into()`
| ^^^ expected `u64`, found `u16`
|
help: you can convert a `u16` to a `u64`
|
LL | id_u64(b16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:199:12
|
LL | id_u64(b32);
| ^^^
| |
| expected `u64`, found `u32`
| help: you can convert a `u32` to a `u64`: `b32.into()`
| ^^^ expected `u64`, found `u32`
|
help: you can convert a `u32` to a `u64`
|
LL | id_u64(b32.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:203:12
@ -484,25 +524,29 @@ LL | id_u64(bsize);
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | id_u64(bsize.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:207:14
|
LL | id_usize(b8);
| ^^
| |
| expected `usize`, found `u8`
| help: you can convert a `u8` to a `usize`: `b8.into()`
| ^^ expected `usize`, found `u8`
|
help: you can convert a `u8` to a `usize`
|
LL | id_usize(b8.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:210:14
|
LL | id_usize(b16);
| ^^^
| |
| expected `usize`, found `u16`
| help: you can convert a `u16` to a `usize`: `b16.into()`
| ^^^ expected `usize`, found `u16`
|
help: you can convert a `u16` to a `usize`
|
LL | id_usize(b16.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:213:14
@ -513,7 +557,7 @@ LL | id_usize(b32);
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
|
LL | id_usize(b32.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:216:14
@ -524,7 +568,7 @@ LL | id_usize(b64);
help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
|
LL | id_usize(b64.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to 52 previous errors

View file

@ -7,7 +7,7 @@ LL | foo(1*(1 as isize));
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
LL | foo((1*(1 as isize)).try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| + +++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/issue-13359.rs:10:9
@ -18,7 +18,7 @@ LL | bar(1*(1 as usize));
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | bar((1*(1 as usize)).try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| + +++++++++++++++++++++
error: aborting due to 2 previous errors

View file

@ -9,7 +9,7 @@ LL | let x: u32 = 20i32;
help: change the type of the numeric literal from `i32` to `u32`
|
LL | let x: u32 = 20u32;
| ~~~~~
| ~~~
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | println!("{}", foo(10i32));
help: change the type of the numeric literal from `i32` to `u32`
|
LL | println!("{}", foo(10u32));
| ~~~~~
| ~~~
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | A = 1i64,
help: change the type of the numeric literal from `i64` to `isize`
|
LL | A = 1isize,
| ~~~~~~
| ~~~~~
error[E0308]: mismatched types
--> $DIR/issue-8761.rs:5:9
@ -18,7 +18,7 @@ LL | B = 2u8
help: change the type of the numeric literal from `u8` to `isize`
|
LL | B = 2isize
| ~~~~~~
| ~~~~~
error: aborting due to 2 previous errors

View file

@ -9,7 +9,7 @@ LL | let x: u32 = 22_usize;
help: change the type of the numeric literal from `usize` to `u32`
|
LL | let x: u32 = 22_u32;
| ~~~~~~
| ~~~
error: aborting due to previous error

View file

@ -9,7 +9,7 @@ LL | let x: u32 = 22_usize;
help: change the type of the numeric literal from `usize` to `u32`
|
LL | let x: u32 = 22_u32;
| ~~~~~~
| ~~~
error: aborting due to previous error

View file

@ -17,7 +17,7 @@ LL | let y: usize = x.foo();
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | let y: usize = x.foo().try_into().unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to 2 previous errors

View file

@ -11,7 +11,7 @@ LL | write!(hello);
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| + +++++++++++++++++++++
error[E0605]: non-primitive cast: `{integer}` as `()`
--> $DIR/issue-26480.rs:22:19

View file

@ -7,7 +7,7 @@ LL | foo(1u8);
help: change the type of the numeric literal from `u8` to `u16`
|
LL | foo(1u16);
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/numeric-literal-cast.rs:8:10
@ -18,7 +18,7 @@ LL | foo1(2f32);
help: change the type of the numeric literal from `f32` to `f64`
|
LL | foo1(2f64);
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/numeric-literal-cast.rs:10:10
@ -29,7 +29,7 @@ LL | foo2(3i16);
help: change the type of the numeric literal from `i16` to `i32`
|
LL | foo2(3i32);
| ~~~~
| ~~~
error: aborting due to 3 previous errors

View file

@ -7,7 +7,7 @@ LL | const C: i32 = 1i8;
help: change the type of the numeric literal from `i8` to `i32`
|
LL | const C: i32 = 1i32;
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/const-scope.rs:2:15
@ -26,7 +26,7 @@ LL | let c: i32 = 1i8;
help: change the type of the numeric literal from `i8` to `i32`
|
LL | let c: i32 = 1i32;
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/const-scope.rs:6:17
@ -47,7 +47,7 @@ LL | let c: i32 = 1i8;
help: change the type of the numeric literal from `i8` to `i32`
|
LL | let c: i32 = 1i32;
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/const-scope.rs:11:17
@ -60,7 +60,7 @@ LL | let d: i8 = c;
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | let d: i8 = c.try_into().unwrap();
| ~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to 6 previous errors

View file

@ -7,7 +7,7 @@ LL | test(array.len());
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | test(array.len().try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to previous error

View file

@ -9,27 +9,33 @@ LL | let x: u16 = foo();
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
LL | let x: u16 = foo().try_into().unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-2.rs:7:18
|
LL | let y: i64 = x + x;
| --- ^^^^^
| | |
| | expected `i64`, found `u16`
| | help: you can convert a `u16` to an `i64`: `(x + x).into()`
| --- ^^^^^ expected `i64`, found `u16`
| |
| expected due to this
|
help: you can convert a `u16` to an `i64`
|
LL | let y: i64 = (x + x).into();
| + ++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-2.rs:9:18
|
LL | let z: i32 = x + x;
| --- ^^^^^
| | |
| | expected `i32`, found `u16`
| | help: you can convert a `u16` to an `i32`: `(x + x).into()`
| --- ^^^^^ expected `i32`, found `u16`
| |
| expected due to this
|
help: you can convert a `u16` to an `i32`
|
LL | let z: i32 = (x + x).into();
| + ++++++++
error: aborting due to 3 previous errors

File diff suppressed because it is too large Load diff

View file

@ -47,7 +47,7 @@ LL | x_u8 > -1_isize;
help: you can convert `x_u8` from `u8` to `isize`, matching the type of `-1_isize`
|
LL | isize::from(x_u8) > -1_isize;
| ~~~~~~~~~~~~~~~~~
| ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:23:15
@ -74,7 +74,7 @@ LL | x_u64 > -1_i128;
help: you can convert `x_u64` from `u64` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u64) > -1_i128;
| ~~~~~~~~~~~~~~~~~
| +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:29:13
@ -85,7 +85,7 @@ LL | x_u32 > -1_i128;
help: you can convert `x_u32` from `u32` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u32) > -1_i128;
| ~~~~~~~~~~~~~~~~~
| +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:31:13
@ -96,7 +96,7 @@ LL | x_u16 > -1_i128;
help: you can convert `x_u16` from `u16` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u16) > -1_i128;
| ~~~~~~~~~~~~~~~~~
| +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:33:12
@ -107,7 +107,7 @@ LL | x_u8 > -1_i128;
help: you can convert `x_u8` from `u8` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u8) > -1_i128;
| ~~~~~~~~~~~~~~~~
| +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:36:15
@ -142,7 +142,7 @@ LL | x_u32 > -1_i64;
help: you can convert `x_u32` from `u32` to `i64`, matching the type of `-1_i64`
|
LL | i64::from(x_u32) > -1_i64;
| ~~~~~~~~~~~~~~~~
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:44:13
@ -153,7 +153,7 @@ LL | x_u16 > -1_i64;
help: you can convert `x_u16` from `u16` to `i64`, matching the type of `-1_i64`
|
LL | i64::from(x_u16) > -1_i64;
| ~~~~~~~~~~~~~~~~
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:46:12
@ -164,7 +164,7 @@ LL | x_u8 > -1_i64;
help: you can convert `x_u8` from `u8` to `i64`, matching the type of `-1_i64`
|
LL | i64::from(x_u8) > -1_i64;
| ~~~~~~~~~~~~~~~
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:49:15
@ -207,7 +207,7 @@ LL | x_u16 > -1_i32;
help: you can convert `x_u16` from `u16` to `i32`, matching the type of `-1_i32`
|
LL | i32::from(x_u16) > -1_i32;
| ~~~~~~~~~~~~~~~~
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:59:12
@ -218,7 +218,7 @@ LL | x_u8 > -1_i32;
help: you can convert `x_u8` from `u8` to `i32`, matching the type of `-1_i32`
|
LL | i32::from(x_u8) > -1_i32;
| ~~~~~~~~~~~~~~~
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:62:15
@ -269,7 +269,7 @@ LL | x_u8 > -1_i16;
help: you can convert `x_u8` from `u8` to `i16`, matching the type of `-1_i16`
|
LL | i16::from(x_u8) > -1_i16;
| ~~~~~~~~~~~~~~~
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:75:15

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -38,15 +38,15 @@ LL | fn fizz(i32) {}
help: if this is a `self` type, give it a parameter name
|
LL | fn fizz(self: i32) {}
| ~~~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | fn fizz(i32: TypeName) {}
| ~~~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn fizz(_: i32) {}
| ~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `S`
--> $DIR/inverted-parameters.rs:27:23

View file

@ -13,16 +13,16 @@ LL | fn test(&'a str) {
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this is a `self` type, give it a parameter name
|
LL | fn test(self: &str) {
| ~~~~~~~~~~
LL | fn test(self: &'a str) {
| +++++
help: if this is a parameter name, give it a type
|
LL | fn test(str: &TypeName) {
| ~~~~~~~~~~~~~~
help: if this is a type, explicitly ignore the parameter name
|
LL | fn test(_: &str) {
| ~~~~~~~
LL | fn test(_: &'a str) {
| ++
error: aborting due to 2 previous errors

View file

@ -8,15 +8,15 @@ LL | fn foo(x) {
help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: x) {
| ~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | fn foo(x: TypeName) {
| ~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(_: x) {
| ~~~~
| ++
error: aborting due to previous error

View file

@ -8,11 +8,11 @@ LL | fn a(B<) {}
help: if this is a `self` type, give it a parameter name
|
LL | fn a(self: B<) {}
| ~~~~~~~
| +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn a(_: B<) {}
| ~~~~
| ++
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | let_in(3u32, |i| { assert!(i == 3i32); });
help: change the type of the numeric literal from `i32` to `u32`
|
LL | let_in(3u32, |i| { assert!(i == 3u32); });
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/pptypedef.rs:8:37
@ -18,7 +18,7 @@ LL | let_in(3i32, |i| { assert!(i == 3u32); });
help: change the type of the numeric literal from `u32` to `i32`
|
LL | let_in(3i32, |i| { assert!(i == 3i32); });
| ~~~~
| ~~~
error: aborting due to 2 previous errors

View file

@ -18,7 +18,7 @@ LL | Some(x) => { return x },
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | Some(x) => { return x.try_into().unwrap() },
| ~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/span-preservation.rs:33:22

View file

@ -61,7 +61,7 @@ LL | let f = [0; 4u8];
help: change the type of the numeric literal from `u8` to `usize`
|
LL | let f = [0; 4usize];
| ~~~~~~
| ~~~~~
error: aborting due to 9 previous errors

View file

@ -8,15 +8,15 @@ LL | trait Trait2015 { fn foo(#[allow(C)] i32); }
help: if this is a `self` type, give it a parameter name
|
LL | trait Trait2015 { fn foo(#[allow(C)] self: i32); }
| ~~~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
| ~~~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | trait Trait2015 { fn foo(#[allow(C)] _: i32); }
| ~~~~~~
| ++
error: aborting due to previous error

View file

@ -33,7 +33,7 @@ LL | let _: i32 = 22_i64 >> 1_i32;
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | let _: i32 = (22_i64 >> 1_i32).try_into().unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| + +++++++++++++++++++++
error: aborting due to 4 previous errors

View file

@ -8,11 +8,11 @@ LL | fn foo(Option<i32>, String) {}
help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: Option<i32>, String) {}
| ~~~~~~~~~~~~
| +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(_: Option<i32>, String) {}
| ~~~~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `)`
--> $DIR/issue-34264.rs:1:27
@ -24,11 +24,11 @@ LL | fn foo(Option<i32>, String) {}
help: if this is a parameter name, give it a type
|
LL | fn foo(Option<i32>, String: TypeName) {}
| ~~~~~~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(Option<i32>, _: String) {}
| ~~~~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `,`
--> $DIR/issue-34264.rs:3:9
@ -40,15 +40,15 @@ LL | fn bar(x, y: usize) {}
help: if this is a `self` type, give it a parameter name
|
LL | fn bar(self: x, y: usize) {}
| ~~~~~~~
| +++++
help: if this is a parameter name, give it a type
|
LL | fn bar(x: TypeName, y: usize) {}
| ~~~~~~~~~~~
| ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar(_: x, y: usize) {}
| ~~~~
| ++
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/issue-34264.rs:7:5

View file

@ -8,11 +8,11 @@ LL | pub fn foo(Box<Self>) { }
help: if this is a `self` type, give it a parameter name
|
LL | pub fn foo(self: Box<Self>) { }
| ~~~~~~~~~
| +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | pub fn foo(_: Box<Self>) { }
| ~~~~~~
| ++
error: expected one of `:`, `@`, or `|`, found `<`
--> $DIR/issue-64252-self-type.rs:10:15
@ -24,11 +24,11 @@ LL | fn bar(Box<Self>) { }
help: if this is a `self` type, give it a parameter name
|
LL | fn bar(self: Box<Self>) { }
| ~~~~~~~~~
| +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar(_: Box<Self>) { }
| ~~~~~~
| ++
error: aborting due to 2 previous errors

View file

@ -2,19 +2,23 @@ error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:19
|
LL | let _ = RGB { r, g, c };
| ^
| |
| expected `f64`, found `f32`
| help: you can convert an `f32` to an `f64`: `r: r.into()`
| ^ expected `f64`, found `f32`
|
help: you can convert an `f32` to an `f64`
|
LL | let _ = RGB { r: r.into(), g, c };
| ++ +++++++
error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:22
|
LL | let _ = RGB { r, g, c };
| ^
| |
| expected `f64`, found `f32`
| help: you can convert an `f32` to an `f64`: `g: g.into()`
| ^ expected `f64`, found `f32`
|
help: you can convert an `f32` to an `f64`
|
LL | let _ = RGB { r, g: g.into(), c };
| ++ +++++++
error[E0560]: struct `RGB` has no field named `c`
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:25

View file

@ -2,28 +2,34 @@ error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
|
LL | let _ = RGB { r, g, b };
| ^
| |
| expected `f64`, found `f32`
| help: you can convert an `f32` to an `f64`: `r: r.into()`
| ^ expected `f64`, found `f32`
|
help: you can convert an `f32` to an `f64`
|
LL | let _ = RGB { r: r.into(), g, b };
| ++ +++++++
error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:22
|
LL | let _ = RGB { r, g, b };
| ^
| |
| expected `f64`, found `f32`
| help: you can convert an `f32` to an `f64`: `g: g.into()`
| ^ expected `f64`, found `f32`
|
help: you can convert an `f32` to an `f64`
|
LL | let _ = RGB { r, g: g.into(), b };
| ++ +++++++
error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:25
|
LL | let _ = RGB { r, g, b };
| ^
| |
| expected `f64`, found `f32`
| help: you can convert an `f32` to an `f64`: `b: b.into()`
| ^ expected `f64`, found `f32`
|
help: you can convert an `f32` to an `f64`
|
LL | let _ = RGB { r, g, b: b.into() };
| ++ +++++++
error: aborting due to 3 previous errors

View file

@ -9,7 +9,7 @@ LL | fn f() -> isize { return g(); }
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
LL | fn f() -> isize { return g().try_into().unwrap(); }
| ~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | test(22i32, 44i32);
help: change the type of the numeric literal from `i32` to `u32`
|
LL | test(22i32, 44u32);
| ~~~~~
| ~~~
error: aborting due to previous error

View file

@ -10,7 +10,7 @@ LL | B::get_x()
help: you can convert an `i32` to a `u8` and panic if the converted value doesn't fit
|
LL | B::get_x().try_into().unwrap()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to previous error

View file

@ -2,10 +2,12 @@ error[E0308]: mismatched types
--> $DIR/tutorial-suffix-inference-test.rs:9:18
|
LL | identity_u16(x);
| ^
| |
| expected `u16`, found `u8`
| help: you can convert a `u8` to a `u16`: `x.into()`
| ^ expected `u16`, found `u8`
|
help: you can convert a `u8` to a `u16`
|
LL | identity_u16(x.into());
| +++++++
error[E0308]: mismatched types
--> $DIR/tutorial-suffix-inference-test.rs:12:18
@ -16,7 +18,7 @@ LL | identity_u16(y);
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
LL | identity_u16(y.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/tutorial-suffix-inference-test.rs:21:18
@ -27,7 +29,7 @@ LL | identity_u16(a);
help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
|
LL | identity_u16(a.try_into().unwrap());
| ~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to 3 previous errors

View file

@ -15,7 +15,7 @@ LL | let b: typeof(a) = 1i8;
help: change the type of the numeric literal from `i8` to `u8`
|
LL | let b: typeof(a) = 1u8;
| ~~~
| ~~
error: aborting due to 2 previous errors

View file

@ -20,7 +20,7 @@ LL | <i32 as Add<i32>>::add(1u32, 2);
help: change the type of the numeric literal from `u32` to `i32`
|
LL | <i32 as Add<i32>>::add(1i32, 2);
| ~~~~
| ~~~
error[E0308]: mismatched types
--> $DIR/ufcs-qpath-self-mismatch.rs:8:31
@ -31,7 +31,7 @@ LL | <i32 as Add<i32>>::add(1, 2u32);
help: change the type of the numeric literal from `u32` to `i32`
|
LL | <i32 as Add<i32>>::add(1, 2i32);
| ~~~~
| ~~~
error: aborting due to 3 previous errors

View file

@ -7,7 +7,7 @@ LL | let z = f(1_usize, 2);
help: change the type of the numeric literal from `usize` to `isize`
|
LL | let z = f(1_isize, 2);
| ~~~~~~~
| ~~~~~
error: aborting due to previous error

View file

@ -9,7 +9,7 @@ LL | fn mk_int() -> usize { let i: isize = 3; return i; }
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); }
| ~~~~~~~~~~~~~~~~~~~~~
| ++++++++++++++++++++
error: aborting due to previous error