mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Merge pull request #20779 from rust-lang/rustc-pull
minor: Rustc pull update
This commit is contained in:
commit
9d347b0cc7
5 changed files with 9 additions and 11 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()
|
||||
|
|
@ -2136,9 +2136,7 @@ impl<'db> Evaluator<'db> {
|
|||
return Ok(Some((0, 1)));
|
||||
}
|
||||
let layout = layout?;
|
||||
Ok(layout
|
||||
.is_sized()
|
||||
.then(|| (layout.size.bytes_usize(), layout.align.abi.bytes() as usize)))
|
||||
Ok(layout.is_sized().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 +2839,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