Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace str's transmute() calls with pointer casts #44657

Merged
merged 2 commits into from
Sep 18, 2017
Merged

Commits on Sep 17, 2017

  1. Replace str's transmute() calls with pointer casts

    After the following conversation in #rust-lang:
    ```
    [14:43:50] <Ixrec> TIL the implementation of from_utf_unchecked is literally just "mem::transmute(x)"
    [14:43:59] <Ixrec> no wonder people keep saying transmute is overpowered
    [15:15:30] <eddyb> Ixrec: it should be a pointer cast lol
    [15:15:46] <eddyb> unless it doesn't let you
    [16:50:34] <Ixrec> https://play.rust-lang.org/?gist=d1e6b629ad9ec1baf64ce261c63845e6&version=stable seems like it does let me
    [16:52:35] <eddyb> Ixrec: yeah that's the preferred impl
    [16:52:46] <eddyb> Ixrec: it just wasn't in 1.0
    [16:52:50] <eddyb> IIRC
    [16:53:00] <eddyb> (something something fat pointers)
    ```
    Since I already wrote half of the preferred impls in the playground, might as well make an actual PR.
    Ixrec authored Sep 17, 2017
    Configuration menu
    Copy the full SHA
    2633b85 View commit details
    Browse the repository at this point in the history
  2. missed a 'mut'

    Ixrec authored Sep 17, 2017
    Configuration menu
    Copy the full SHA
    38fa340 View commit details
    Browse the repository at this point in the history