woboq / qmetaobject-rs

Integrate Qml and Rust by building the QMetaObject at compile time.
MIT License
620 stars 89 forks source link

Compilation fails with Rust 1.72 #299

Closed direc85 closed 10 months ago

direc85 commented 10 months ago
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> qmetaobject/src/scenegraph.rs:158:32
    |
158 |             raw = cpp!(unsafe [type_id as "quint64", len as "std::size_t"] -> *mut c_void as "QSGNode*" {
    |                                ^^^^^^^
    |
    = note: source type: `TypeId` (128 bits)
    = note: target type: `[u8; 8]` (64 bits)
    = note: this error originates in the macro `__cpp_closure_impl` which comes from the expansion of the macro `cpp` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> qmetaobject/src/scenegraph.rs:163:58
    |
163 |             mask = cpp!(unsafe [raw as "ContainerNode*", type_id as "quint64", len as "std::size_t"] -> u64 as "quint64" {
    |                                                          ^^^^^^^
    |
    = note: source type: `TypeId` (128 bits)
    = note: target type: `[u8; 8]` (64 bits)
    = note: this error originates in the macro `__cpp_closure_impl` which comes from the expansion of the macro `cpp` (in Nightly builds, run with -Z macro-backtrace for more info)
(...)

This is caused by Rust 1.72 change Use 128 bits for TypeId hash

ogoffart commented 10 months ago

This is strange. I thought commit 947a73b4d87b5000a8e5719ad28efc0eea68bff1 which is included in the version 0.2.9 of the crate would have fixed that already

direc85 commented 10 months ago

Ah, indeed it does. I'm trying to compile Whisperfish, which is stuck around 0.2.5, so this bug is irrelevant - and so is the merge request.