1
Fork 0

Avoid taking reference of &TyKind

This commit is contained in:
Michael Goulet 2024-08-25 16:02:11 -04:00
parent 89103466d7
commit 48f43fa0ed
14 changed files with 18 additions and 18 deletions

View file

@ -127,7 +127,7 @@ fn lit_to_mir_constant<'tcx>(
Ok(ConstValue::Scalar(Scalar::from_uint(result, width)))
};
let value = match (lit, &ty.kind()) {
let value = match (lit, ty.kind()) {
(ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => {
let s = s.as_str();
let allocation = Allocation::from_bytes_byte_aligned_immutable(s.as_bytes());

View file

@ -29,7 +29,7 @@ pub(crate) fn lit_to_const<'tcx>(
.unwrap_or_else(|| bug!("expected to create ScalarInt from uint {:?}", result)))
};
let valtree = match (lit, &ty.kind()) {
let valtree = match (lit, ty.kind()) {
(ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => {
let str_bytes = s.as_str().as_bytes();
ty::ValTree::from_raw_bytes(tcx, str_bytes)