Skip to content

Commit 0ff0669

Browse files
committed
replace old literal in expr
1 parent 1984079 commit 0ff0669

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc_typeck/check/demand.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
422422
let suffix_suggestion = format!(
423423
"{}{}{}{}",
424424
if needs_paren { "(" } else { "" },
425-
src,
425+
{
426+
// 42u8
427+
// ^^
428+
let lit_offset = src.len() - checked_ty.to_string().len();
429+
&src[..lit_offset]
430+
},
426431
expected_ty,
427432
if needs_paren { ")" } else { "" },
428433
);

0 commit comments

Comments
 (0)