Skip to content

Vec::as_ptr for empty vectors is undocumented #39625

Closed
@nbaksalyar

Description

@nbaksalyar

Vec::as_ptr returns a pointer to address 0x1 for empty vectors. As it seems, this is an internal implementation detail for RawVec and allocation.

This behavior is unexpected and not documented. In certain scenarios it might cause a segmentation fault (e.g. due to failed checks for a null pointer when dealing with FFI).

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsP-mediumMedium priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions