Skip to content

Fat pointers with same data part, but different vtables #48795

Closed
@rom1v

Description

@rom1v

I did not manage to reproduce in a minimal sample, but in my application, I ended up with:

let x = …;
let y = …;
println!("{:p} == {:p} ? {}", x, y, ptr::eq(x, y));

printing:

0x7f87a8c3a618 == 0x7f87a8c3a618 ? false

After investigations (and discussion on freenode/##rust), it appeared that x and y were fat pointers having the same data part (the 64 first bits), but a different vtable (the last 64 bits).

I applied this patch to my application, which solves the reported issue: Genymobile/gnirehtet@c36fa4d

But I can't understand how two fat pointers for the same objects may have different vtables. Is it expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-trait-systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-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