Auto merge of #147143 - estebank:verbose-ret-type, r=fee1-dead
Make replacement suggestion `_` in type verbose
```
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/in-signature.rs:6:21
|
LL | fn arr_fn() -> [u8; _] {
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn arr_fn() -> [u8; _] {
LL + fn arr_fn() -> [u8; 3] {
|
```
diff --git a/crates/hir-ty/src/layout/tests.rs b/crates/hir-ty/src/layout/tests.rs
index 523ddad..8be5eac 100644
--- a/crates/hir-ty/src/layout/tests.rs
+++ b/crates/hir-ty/src/layout/tests.rs
@@ -150,7 +150,7 @@
) {
let l = eval_goal(ra_fixture, minicore).unwrap();
assert_eq!(l.size.bytes(), size, "size mismatch");
- assert_eq!(l.align.abi.bytes(), align, "align mismatch");
+ assert_eq!(l.align.bytes(), align, "align mismatch");
}
#[track_caller]
@@ -162,7 +162,7 @@
) {
let l = eval_expr(ra_fixture, minicore).unwrap();
assert_eq!(l.size.bytes(), size, "size mismatch");
- assert_eq!(l.align.abi.bytes(), align, "align mismatch");
+ assert_eq!(l.align.bytes(), align, "align mismatch");
}
#[track_caller]
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index 3e658cb..fc7d97f 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/crates/hir-ty/src/mir/eval.rs
@@ -2085,7 +2085,7 @@
if let Some(layout) = self.layout_cache.borrow().get(&ty.to_nextsolver(interner)) {
return Ok(layout
.is_sized()
- .then(|| (layout.size.bytes_usize(), layout.align.abi.bytes() as usize)));
+ .then(|| (layout.size.bytes_usize(), layout.align.bytes() as usize)));
}
if let DefWithBodyId::VariantId(f) = locals.body.owner
&& let Some((AdtId::EnumId(e), _)) = ty.as_adt()
@@ -2104,7 +2104,7 @@
let layout = layout?;
Ok(layout
.is_sized()
- .then(|| (layout.size.bytes_usize(), layout.align.abi.bytes() as usize)))
+ .then(|| (layout.size.bytes_usize(), layout.align.bytes() as usize)))
}
/// A version of `self.size_of` which returns error if the type is unsized. `what` argument should
@@ -2797,7 +2797,7 @@
)?;
// FIXME: there is some leak here
let size = layout.size.bytes_usize();
- let addr = self.heap_allocate(size, layout.align.abi.bytes() as usize)?;
+ let addr = self.heap_allocate(size, layout.align.bytes() as usize)?;
self.write_memory(addr, &result)?;
IntervalAndTy { interval: Interval { addr, size }, ty }
};
diff --git a/crates/hir-ty/src/mir/eval/shim.rs b/crates/hir-ty/src/mir/eval/shim.rs
index f67778b..3848049 100644
--- a/crates/hir-ty/src/mir/eval/shim.rs
+++ b/crates/hir-ty/src/mir/eval/shim.rs
@@ -767,7 +767,7 @@
"align_of generic arg is not provided".into(),
));
};
- let align = self.layout(ty.to_nextsolver(interner))?.align.abi.bytes();
+ let align = self.layout(ty.to_nextsolver(interner))?.align.bytes();
destination.write_from_bytes(self, &align.to_le_bytes()[0..destination.size])
}
"size_of_val" => {
@@ -1431,7 +1431,7 @@
field_types.iter().next_back().unwrap().1.clone().substitute(Interner, subst);
let sized_part_size =
layout.fields.offset(field_types.iter().count() - 1).bytes_usize();
- let sized_part_align = layout.align.abi.bytes() as usize;
+ let sized_part_align = layout.align.bytes() as usize;
let (unsized_part_size, unsized_part_align) =
self.size_align_of_unsized(&last_field_ty, metadata, locals)?;
let align = sized_part_align.max(unsized_part_align) as isize;
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 027a386..1776795 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -6094,7 +6094,7 @@
}
pub fn align(&self) -> u64 {
- self.0.align.abi.bytes()
+ self.0.align.bytes()
}
pub fn niches(&self) -> Option<u128> {