mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-22 00:01:53 +00:00
Merge ref '3369e82c6bc0' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 3369e82c6bc03c5cdb66f730dba6f738b74c8e1d Filtered ref:abf6c425d3
Upstream diff:f957826bff...3369e82c6b
This merge was created using https://github.com/rust-lang/josh-sync.
This commit is contained in:
commit
ab424b7205
4 changed files with 8 additions and 8 deletions
|
@ -146,7 +146,7 @@ fn check_size_and_align(
|
|||
) {
|
||||
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]
|
||||
|
@ -158,7 +158,7 @@ fn check_size_and_align_expr(
|
|||
) {
|
||||
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]
|
||||
|
|
|
@ -2119,7 +2119,7 @@ impl<'db> Evaluator<'db> {
|
|||
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()
|
||||
|
@ -2138,7 +2138,7 @@ impl<'db> Evaluator<'db> {
|
|||
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
|
||||
|
@ -2841,7 +2841,7 @@ impl<'db> Evaluator<'db> {
|
|||
)?;
|
||||
// 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 }
|
||||
};
|
||||
|
|
|
@ -771,7 +771,7 @@ impl<'db> Evaluator<'db> {
|
|||
"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" => {
|
||||
|
@ -1434,7 +1434,7 @@ impl<'db> Evaluator<'db> {
|
|||
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;
|
||||
|
|
|
@ -6205,7 +6205,7 @@ impl Layout {
|
|||
}
|
||||
|
||||
pub fn align(&self) -> u64 {
|
||||
self.0.align.abi.bytes()
|
||||
self.0.align.bytes()
|
||||
}
|
||||
|
||||
pub fn niches(&self) -> Option<u128> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue