Skip to content

Release build fails in assert_eq_size! with Rust nightly ≥ 2023-06-09 #5263

@andersk

Description

@andersk
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> crates/ruff_formatter/src/format_element.rs:449:5
    |
449 |     assert_eq_size!(crate::format_element::Tag, [u8; 16]);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: source type: `Tag` (192 bits)
    = note: target type: `[u8; 16]` (128 bits)
    = note: this error originates in the macro `assert_eq_size` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> crates/ruff_formatter/src/format_element.rs:452:5
    |
452 |     assert_eq_size!(crate::FormatElement, [u8; 24]);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: source type: `format_element::FormatElement` (256 bits)
    = note: target type: `[u8; 24]` (192 bits)
    = note: this error originates in the macro `assert_eq_size` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0512`.
error: could not compile `ruff_formatter` (lib) due to 2 previous errors

This is because Rust inflated TypeId from 64 bits to 128 bits (rust-lang/rust#109953).

The affected format_element::tag::LabelId struct is currently never constructed and its id: TypeId field is never used. I don’t know what you plan to use this for, but does it need the extensibility of TypeId, or would a simple enum suffice?

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