about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-09-03 18:25:56 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2019-09-03 18:29:08 +0900
commit7d30cb6e7614052d8c0ea13b72b6c54bb6a1fba3 (patch)
treebc224599f8cd33373467af4dcffc7c68f40dd341
parenta3fcaee5620d458af22682097c4ffb64b57c3327 (diff)
downloadrust-7d30cb6e7614052d8c0ea13b72b6c54bb6a1fba3.tar.gz
rust-7d30cb6e7614052d8c0ea13b72b6c54bb6a1fba3.zip
Remove Allocation::bytes
-rw-r--r--clippy_lints/src/consts.rs9
1 files 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<Constant> {
         },
         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,