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

Rollup of 5 pull requests #60672

Merged
merged 10 commits into from
May 9, 2019
Merged

Rollup of 5 pull requests #60672

merged 10 commits into from
May 9, 2019

Commits on May 7, 2019

  1. Add a cast method to raw pointers.

    This is similar to `NonNull::cast`.
    
    Compared to the `as` operator (which has a wide range of meanings
    depending on the input and output types), a call to this method:
    
    * Can only go from a raw pointer to a raw pointer
    * Cannot change the pointer’s `const`ness
    
    … even when the pointed types are inferred based on context.
    SimonSapin committed May 7, 2019
    Configuration menu
    Copy the full SHA
    d5e8190 View commit details
    Browse the repository at this point in the history

Commits on May 8, 2019

  1. Configuration menu
    Copy the full SHA
    cf0f2b0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ee6d315 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2019

  1. Inline some Cursor calls for slices

    (Partially) brings back rust-lang#33921
    petertodd committed May 9, 2019
    Configuration menu
    Copy the full SHA
    b9c4301 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    028e78d View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#60601 - SimonSapin:cast, r=Kimundi

    Add a `cast` method to raw pointers.
    
    This is similar to `NonNull::cast`.
    
    Compared to the `as` operator (which has a wide range of meanings depending on the input and output types), a call to this method:
    
    * Can only go from a raw pointer to a raw pointer
    * Cannot change the pointer’s `const`ness
    
    … even when the pointed types are inferred based on context.
    Centril authored May 9, 2019
    Configuration menu
    Copy the full SHA
    8fd5587 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#60638 - RalfJung:pin, r=sanxiyn

    pin: make the to-module link more visible
    
    Cc @gnzlbg
    Centril authored May 9, 2019
    Configuration menu
    Copy the full SHA
    a74313b View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#60647 - petrochenkov:nospace, r=michaelwoer…

    …ister
    
    cleanup: Remove `DefIndexAddressSpace`
    
    The scheme with two address spaces for `DefIndex` was needed in the past, but apparently not needed anymore (after removing `DefId`s from locals and `HirId`-ification).
    Centril authored May 9, 2019
    Configuration menu
    Copy the full SHA
    26a7544 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#60656 - petertodd:2019-inline-cursor-over-s…

    …lice, r=sfackler
    
    Inline some Cursor calls for slices
    
    (Partially) brings back rust-lang#33921
    
    I've noticed in some serialization code I was writing that writes to slices produce much, much, worse code than you'd expect even with optimizations turned on. For example, you'd expect something like this to be zero cost:
    
    ```
    use std::io::{self, Cursor, Write};
    
    pub fn serialize((a, b): (u64, u64)) -> [u8;8+8] {
        let mut r = [0u8;16];
        {
            let mut w = Cursor::new(&mut r[..]);
    
            w.write(&a.to_le_bytes()).unwrap();
            w.write(&b.to_le_bytes()).unwrap();
        }
        r
    }
    ```
    
    ...but it compiles down to [dozens of instructions](https://rust.godbolt.org/z/bdwDzb) because the `slice_write()` calls aren't inlined, which in turn means `unwrap()` can't be optimized away, and so on.
    
    To be clear, this pull-req isn't sufficient by itself: if we want to go down that path we also need to add `#[inline]`'s to the default implementations for functions like `write_all()` in the `Write` trait and so on, or implement them separately in the `Cursor` impls. But I figured I'd start a conversation about what tradeoffs we're expecting here.
    Centril authored May 9, 2019
    Configuration menu
    Copy the full SHA
    671dd09 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#60657 - JohnTitor:stabilize-array, r=SimonS…

    …apin
    
    Stabilize and re-export core::array in std
    
    Fixes rust-lang#60014
    Centril authored May 9, 2019
    Configuration menu
    Copy the full SHA
    e40f9a6 View commit details
    Browse the repository at this point in the history