Skip to content

#[rustc_allocator] documentation disagrees with implementation #79488

Open
@gparker42

Description

@gparker42

The documentation of #[rustc_allocator] seems to disagree with its implementation.

The documentation says it applies a returns-nonnull hint. The implementation instead only applies a returns-noalias hint.

    // compiler/rustc_middle/src/middle/codegen_fn_attrs.rs:49
    /// `#[rustc_allocator]`: a hint to LLVM that the pointer returned from this
    /// function is never null.
    const ALLOCATOR                 = 1 << 1;
    // compiler/rustc_codegen_llvm/src/attributes.rs:304
    if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR) {
        Attribute::NoAlias.apply_llfn(llvm::AttributePlace::ReturnValue, llfn);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.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