Skip to content

Commit 2d7da04

Browse files
committed
Auto merge of #4493 - JohnTitor:fix-build-bytes, r=flip1995
Rustup to rust-lang/rust#63561 changelog: none
2 parents 1f99937 + 7d30cb6 commit 2d7da04

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clippy_lints/src/consts.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,12 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
490490
},
491491
ConstValue::Slice { data, start, end } => match result.ty.sty {
492492
ty::Ref(_, tam, _) => match tam.sty {
493-
ty::Str => String::from_utf8(data.bytes[start..end].to_owned())
494-
.ok()
495-
.map(Constant::Str),
493+
ty::Str => String::from_utf8(
494+
data.inspect_with_undef_and_ptr_outside_interpreter(start..end)
495+
.to_owned(),
496+
)
497+
.ok()
498+
.map(Constant::Str),
496499
_ => None,
497500
},
498501
_ => None,

0 commit comments

Comments
 (0)