Skip to content

Potential error in exception-safety #359

Open
@Arthur-Milchior

Description

@Arthur-Milchior

In https://doc.rust-lang.org/nomicon/exception-safety.html I suspect that self.ptr().add(i).write(x.clone()); is wrong. i is the position of x in to_push. We don't want to put x at position i as it would overwrite an already existing value. Instead we want it at position i+initial_length.
At least I assume. I don't understand how to find the documentation of ptr(), I don't see it in https://doc.rust-lang.org/stable/std/vec/struct.Vec.html . But I can't figure out a semantic off "add" where it makes sens to take "i"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions