Skip to content

mem::replace don't actually mutate the destination on Android #49282

Description

@jdm

I have a branch of Servo which crashes when run on Android because a key use of mem::replace does not actually cause the destination to change values. When I add println!("{:?}", self.pending_line) before and after the mem::replace, on desktop the values are updated as expected, but on Android the original value remains.

When I use either of the following instead:

self.pending_line = Line::new(self.floats.writing_mode, &self.minimum_metrics);

or

let mut new_line = Line::new(self.floats.writing_mode, &self.minimum_metrics);
mem::swap(&mut self.pending_line, &mut new_line);

then self.pending is updated as expected and Servo does not crash on Android.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-SIMDArea: SIMD (Single Instruction Multiple Data)A-codegenArea: Code generationC-bugCategory: This is a bug.O-androidOperating system: AndroidT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions