Skip to content

transmuting between size can vary #37157

Closed
@SimonSapin

Description

@SimonSapin

rustc 1.14.0-nightly (a3bc191 2016-10-10)

pub trait TypeConstructor<'a> {
    type T;
}

unsafe fn transmute_lifetime<'a, 'b, C>(x: <C as TypeConstructor<'a>>::T)
                                        -> <C as TypeConstructor<'b>>::T
where for<'z> C: TypeConstructor<'z> {
    ::std::mem::transmute(x)
}
error[E0512]: transmute called with differently sized types: <C as TypeConstructor<'a>>::T (size can vary because of <C as TypeConstructor>::T) to <C as TypeConstructor<'b>>::T (size can vary because of <C as TypeConstructor>::T)
  --> src/lib.rs:47:5
   |
47 |     ::std::mem::transmute(x)
   |     ^^^^^^^^^^^^^^^^^^^^^ transmuting between size can vary because of <C as TypeConstructor>::T and size can vary because of <C as TypeConstructor>::T

The error message near ^^^^^^ doesn’t seem grammatically correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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