We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1f99937 + 7d30cb6 commit 2d7da04Copy full SHA for 2d7da04
clippy_lints/src/consts.rs
@@ -490,9 +490,12 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
490
},
491
ConstValue::Slice { data, start, end } => match result.ty.sty {
492
ty::Ref(_, tam, _) => match tam.sty {
493
- ty::Str => String::from_utf8(data.bytes[start..end].to_owned())
494
- .ok()
495
- .map(Constant::Str),
+ ty::Str => String::from_utf8(
+ data.inspect_with_undef_and_ptr_outside_interpreter(start..end)
+ .to_owned(),
496
+ )
497
+ .ok()
498
+ .map(Constant::Str),
499
_ => None,
500
501
0 commit comments