Skip to content

LLVM assertion when calling std::mem::align_of() on recursive struct with fixed-size vec #19001

Closed
@michaelwoerister

Description

@michaelwoerister

Example program:

use std::mem;

struct AlignmentStruct {
    ptr: *mut [AlignmentStruct, ..1]
}

fn main() {
    println!("{}", ::std::mem::align_of::<AlignmentStruct>());
}

Error message:

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/llvm/lib/IR/DataLayout.cpp:636: unsigned int llvm::DataLayout::getAlignment(llvm::Type*, bool) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions