mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 12:07:40 +00:00
![]() Optimize DST field access For struct X<T: ?Sized>(T) struct Y<T: ?Sized>(u8, T) the offset of the unsized field is 0 mem::align_of_val(&self.1) respectively. This patch changes the expression used to compute these offsets so that the optimizer can perform this optimization. Consider ```rust fn f(x: &X<dyn Any>) -> &dyn Any { &x.0 } ``` Before: ```asm test: movq %rsi, %rdx movq 16(%rsi), %rax leaq -1(%rax), %rcx negq %rax andq %rcx, %rax addq %rdi, %rax retq ``` After: ```asm test: movq %rsi, %rdx movq %rdi, %rax retq ``` |
||
---|---|---|
.. | ||
back | ||
coverageinfo | ||
debuginfo | ||
mir | ||
traits | ||
base.rs | ||
common.rs | ||
glue.rs | ||
lib.rs | ||
meth.rs | ||
mono_item.rs | ||
target_features.rs |