Skip to content

Commit

Permalink
Add article after "to"
Browse files Browse the repository at this point in the history
Also added missing backtick in "you can cast" message.
  • Loading branch information
camelid committed Sep 29, 2020
1 parent 549f861 commit 094f14c
Show file tree
Hide file tree
Showing 21 changed files with 304 additions and 302 deletions.
10 changes: 6 additions & 4 deletions compiler/rustc_typeck/src/check/demand.rs
Expand Up @@ -753,16 +753,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

let msg = format!(
"you can convert {} `{}` to `{}`",
"you can convert {} `{}` to {} `{}`",
checked_ty.kind().article(),
checked_ty,
expected_ty
expected_ty.kind().article(),
expected_ty,
);
let cast_msg = format!(
"you can cast {} `{} to `{}`",
"you can cast {} `{}` to {} `{}`",
checked_ty.kind().article(),
checked_ty,
expected_ty
expected_ty.kind().article(),
expected_ty,
);
let lit_msg = format!(
"change the type of the numeric literal from `{}` to `{}`",
Expand Down
Expand Up @@ -47,7 +47,7 @@ LL | let _: i32 = f2(2i32);
| |
| expected due to this
|
help: you can convert a `u32` to `i32` and panic if the converted value wouldn't fit
help: you can convert a `u32` to an `i32` and panic if the converted value wouldn't fit
|
LL | let _: i32 = f2(2i32).try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/indexing-requires-a-uint.stderr
Expand Up @@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | bar::<isize>(i); // i should not be re-coerced back to an isize
| ^ expected `isize`, found `usize`
|
help: you can convert a `usize` to `isize` and panic if the converted value wouldn't fit
help: you can convert a `usize` to an `isize` and panic if the converted value wouldn't fit
|
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
| ^^^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit 094f14c

Please sign in to comment.