Skip to content

destructuring_assignment fails to optimize code as well as mem::swap #90699

Open
@veber-alex

Description

@veber-alex

Opening a new bug as requested in #90521 (comment)

I wanted to check how (a,b) = (b,a) compares to mem::swap, it looks like mem::swap applies optimizations when T is 32 bytes or bigger but destructuring_assignment doesn't.

I tried this code:
https://godbolt.org/z/czfTv3nzW

I expected to see this happen:
Both function should generate the same (optimal) code

Instead, this happened:
mem::swap applies optimizations while destructuring_assignment doesn't

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-destructuring_assignment`#![feature(destructuring_assignment)]`I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions