From 7d30cb6e7614052d8c0ea13b72b6c54bb6a1fba3 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 3 Sep 2019 18:25:56 +0900 Subject: [PATCH] Remove Allocation::bytes --- clippy_lints/src/consts.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index fe57c300a34..0e1c1e60178 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -490,9 +490,12 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option { }, ConstValue::Slice { data, start, end } => match result.ty.sty { ty::Ref(_, tam, _) => match tam.sty { - ty::Str => String::from_utf8(data.bytes[start..end].to_owned()) - .ok() - .map(Constant::Str), + ty::Str => String::from_utf8( + data.inspect_with_undef_and_ptr_outside_interpreter(start..end) + .to_owned(), + ) + .ok() + .map(Constant::Str), _ => None, }, _ => None,