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 12 pull requests #62882

Closed
wants to merge 46 commits into from
Closed

Commits on Jul 9, 2019

  1. Configuration menu
    Copy the full SHA
    5397dfc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    01d93bf View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    283f676 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b62a77b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    50840ee View commit details
    Browse the repository at this point in the history
  6. Regression test.

    pnkfelix committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    837fe7b View commit details
    Browse the repository at this point in the history
  7. Update src/liballoc/slice.rs

    Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
    SimonSapin and Centril committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    d0635ee View commit details
    Browse the repository at this point in the history
  8. Update src/liballoc/slice.rs

    Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
    SimonSapin and Centril committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    bbc9366 View commit details
    Browse the repository at this point in the history
  9. Update src/liballoc/str.rs

    Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
    SimonSapin and Centril committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    5f7768a View commit details
    Browse the repository at this point in the history

Commits on Jul 13, 2019

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

Commits on Jul 14, 2019

  1. better comments

    RalfJung committed Jul 14, 2019
    Configuration menu
    Copy the full SHA
    3f77f2c View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2019

  1. Configuration menu
    Copy the full SHA
    469b7a9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c6735a6 View commit details
    Browse the repository at this point in the history
  3. Revert "Disable stack probing for gnux32."

    This reverts commit 42d652e.
    crlf0710 committed Jul 19, 2019
    Configuration menu
    Copy the full SHA
    10d4159 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b361864 View commit details
    Browse the repository at this point in the history
  5. rustc: Compile the fmt_macros crate as an rlib

    I think this was left out by accident from the "convert everything to
    rlibs" commit, there's no need for this to be a dylib just as everything
    else doesn't need to be a dylib!
    alexcrichton committed Jul 19, 2019
    Configuration menu
    Copy the full SHA
    c1b4d62 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c6e027d View commit details
    Browse the repository at this point in the history
  7. Use sharded maps for interning

    Zoxc committed Jul 19, 2019
    Configuration menu
    Copy the full SHA
    0e73386 View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2019

  1. Configuration menu
    Copy the full SHA
    2641bed View commit details
    Browse the repository at this point in the history
  2. Break dependencies between syntax_ext and some other crates

    Move `source_uitil` macros into `syntax_ext`
    Cleanup dependencies of `rustc_driver`
    petrochenkov committed Jul 20, 2019
    Configuration menu
    Copy the full SHA
    97e8d67 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    995429d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1196dfe View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b93d2ac View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    188330b View commit details
    Browse the repository at this point in the history
  7. syntax_ext: proc_macro_decls -> proc_macro_harness

    Few other minor renamings for consistency.
    Remove one unused dependency from `rustc_passes`.
    Fix libsyntax tests.
    Fix rebase.
    petrochenkov committed Jul 20, 2019
    Configuration menu
    Copy the full SHA
    ec5f089 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    21b502b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2e6b13a View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2019

  1. Add tests for issue-58887

    JohnTitor committed Jul 21, 2019
    Configuration menu
    Copy the full SHA
    18dceab View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f502bf7 View commit details
    Browse the repository at this point in the history
  3. apply feedback

    RalfJung committed Jul 21, 2019
    Configuration menu
    Copy the full SHA
    4081222 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e75ae15 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    795d96d View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2019

  1. weasle, weasle

    RalfJung committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    a7b9246 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9196781 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#61779 - Zoxc:sharded, r=oli-obk

    Use sharded maps for interning
    
    Cuts down runtime from 5.5s to 3.8s for non-incremental `syntex_syntax` check builds with 16 threads / 8 cores.
    
    r? @eddyb
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    c3aa3d8 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#62523 - pnkfelix:delay-bug-to-resolve-issue…

    …-62203-ice, r=varkor
    
    Delay bug to resolve HRTB ICE
    
    Fix rust-lang#62203
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    723fd5d View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#62528 - SimonSapin:concat, r=alexcrichton

    Add joining slices of slices with a slice separator, not just a single item
    
    rust-lang#27747 (comment)
    > It's kinda annoying to be able to join strings with a str (which can have multiple chars), but joining a slice of slices, you can only join with a single element.
    
    This turns out to be fixable, with some possible inference regressions.
    
    # TL;DR
    
    Related trait(s) are unstable and tracked at rust-lang#27747, but the `[T]::join` method that is being extended here is already stable.
    
    Example use of the new insta-stable functionality:
    
    ```rust
    let nested: Vec<Vec<Foo>> = /* … */;
    let separator: &[Foo] = /* … */;  // Previously: could only be a single &Foo
    nested.join(separator)
    ```
    
    Complete API affected by this PR, after changes:
    
    ```rust
    impl<T> [T] {
        pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
            where Self: Concat<Item>
        {
            Concat::concat(self)
        }
        pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
            where Self: Join<Separator>
        {
            Join::join(self, sep)
        }
    }
    
    // The `Item` parameter is only useful for the the slice-of-slices impl.
    pub trait Concat<Item: ?Sized> {
        type Output;
        fn concat(slice: &Self) -> Self::Output;
    }
    
    pub trait Join<Separator> {
        type Output;
        fn join(slice: &Self, sep: Separator) -> Self::Output;
    }
    
    impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] {
        type Output = Vec<T>;
    }
    
    impl<T: Clone, V: Borrow<[T]>> Join<&'_ T> for [V] {
        type Output = Vec<T>;
    }
    
    // New functionality here!
    impl<T: Clone, V: Borrow<[T]>> Join<&'_ [T]> for [V] {
        type Output = Vec<T>;
    }
    
    impl<S: Borrow<str>> Concat<str> for [S] {
        type Output = String;
    }
    
    impl<S: Borrow<str>> Join<&'_ str> for [S] {
        type Output = String;
    }
    ```
    
    # Details
    
    After rust-lang#62403 but before this PR, the API is:
    
    ```rust
    impl<T> [T] {
        pub fn concat<Separator: ?Sized>(&self) -> T::Output
            where T: SliceConcat<Separator>
        {
            SliceConcat::concat(self)
        }
    
        pub fn join<Separator: ?Sized>(&self, sep: &Separator) -> T::Output
            where T: SliceConcat<Separator>
        {
            SliceConcat::join(self, sep)
        }
    }
    
    pub trait SliceConcat<Separator: ?Sized>: Sized {
        type Output;
        fn concat(slice: &[Self]) -> Self::Output;
        fn join(slice: &[Self], sep: &Separator) -> Self::Output;
    }
    
    impl<T: Clone, V: Borrow<[T]>> SliceConcat<T> for V {
        type Output = Vec<T>;
    }
    
    impl<S: Borrow<str>> SliceConcat<str> for S {
        type Output = String;
    }
    ```
    
    By adding a trait impl we should be able to accept a slice of `T` as the separator, as an alternative to a single `T` value.
    
    In a `some_slice.join(some_separator)` call, trait resolution will pick an impl or the other based on the type of `some_separator`. In `some_slice.concat()` however there is no separator, so this call would become ambiguous. Some regression in type inference or trait resolution may be acceptable on principle, but requiring a turbofish for every single call to `concat` isn’t great.
    
    The solution to that is splitting the `SliceConcat` trait into two `Concat` and `Join` traits, one for each eponymous method. Only `Join` would gain a new impl, so that `some_slice.concat()` would not become ambiguous.
    
    Now, at the trait level the `Concat` trait does not need a `Separator` parameter anymore. However, simply removing it causes one of the impls not to be accepted anymore:
    
    ```rust
    error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
      --> src/liballoc/slice.rs:608:6
        |
    608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
        |      ^ unconstrained type parameter
    ```
    
    This makes sense: if `[V]::concat` is a method that is itself not generic, then its return type (which is the `Concat::Output` associated type) needs to be determined based on solely `V`. And although there is no such type in the standard library, there is nothing stopping another crate from defining a `V` type that implements both `Borrow<[Foo]>` and `Borrow<[Bar]>`. It might not be a good idea, but it’s possible. Both would apply here, and there would be no way to determine `T`.
    
    This could be a warning sign that this API is too generic. Perhaps we’d be better off having one less type variable, and only implement `Concat for [&'_ [T]]` and `Concat for [Vec<T>]` etc. However this aspect of `[V]::concat` is already stable, so we’re stuck with it.
    
    The solution is to keep a dummy type parameter on the `Concat` trait. That way, if a type has multiple `Borrow<[_]>` impls, it’ll end up with multiple corresponding `Concat<_>` impls.
    
    In `impl<S: Borrow<str>> Concat<str> for [S]`, the second occurrence of `str` is not meaningful. It could be any type. As long as there is only once such type with an applicable impl, trait resolution will be appeased without demanding turbofishes.
    
    # Joining strings with `char`
    
    For symmetry I also tried adding this impl (because why not):
    
    ```rust
    impl<S: Borrow<str>> Join<char> for [S] {
        type Output = String;
    }
    ```
    
    This immediately caused an inference regression in a dependency of rustc:
    
    ```rust
    error[E0277]: the trait bound `std::string::String: std::borrow::Borrow<[std::string::String]>` is not satisfied
       --> /home/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/getopts-0.2.19/src/lib.rs:595:37
        |
    595 |             row.push_str(&desc_rows.join(&desc_sep));
        |                                     ^^^^ the trait `std::borrow::Borrow<[std::string::String]>` is not implemented for `std::string::String`
        |
        = help: the following implementations were found:
                  <std::string::String as std::borrow::Borrow<str>>
        = note: required because of the requirements on the impl of `std::slice::Join<&std::string::String>` for `[std::string::String]`
    ```
    
    In the context of this code, two facts are known:
    
    * `desc_rows` is a `Vec<String>`
    * `desc_sep` is a `String`
    
    Previously the first fact alone reduces the resolution of `join` to only one solution, where its argument it expected to be `&str`. Then, `&String` is coerced to `&str`.
    
    With the new `Join` impl, the first fact leavs two applicable impls where the separator can be either `&str` or `char`. But `&String` is neither of these things. It appears that possible coercions are not accounted for, in the search for a solution in trait resolution.
    
    I have not included this new impl in this PR. It’s still possible to add later, but the `getopts` breakage does not need to block the rest of the PR. And the functionality easy for end-user to duplicate: `slice_of_strings.join(&*char_separator.encode_utf8(&mut [0_u8, 4]))`
    
    The `&*` part of that last code snippet is another case of the same issue: `encode_utf8` returns `&mut str` which can be coerced to `&str`, but isn’t when trait resolution is ambiguous.
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    9785008 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#62656 - RalfJung:contains-no-own, r=Dylan-DPC

    explain how to search in slice without owned data
    
    Cc rust-lang#62367
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    966ba8d View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#62771 - petrochenkov:depext, r=eddyb

    Break dependencies between `syntax_ext` and other crates
    
    Move `source_util` macros into `syntax_ext`.
    Move other early code generation facilities like standard library injection into `syntax_ext`.
    
    The only crate that depends on `syntax_ext` now is `rustc_interface` which is one of the "final" crates that depend on everything.
    
    Minor: Cleanup dependencies of `rustc_driver`, many of them are no longer used after introduction of `rustc_interface`.
    
    r? @eddyb
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    8fad976 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#62804 - lundibundi:help-infer-const-static,…

    … r=eddyb
    
    rustc_typeck: improve diagnostics for _ const/static declarations
    
    This continues rust-lang#62694 and adds type suggestions to const/static declarations with `_` type.
    
    r? @eddyb
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    823d575 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#62808 - crlf0710:gnux32_stack_probe, r=nikic

    Revert "Disable stack probing for gnux32."
    
    This reverts commit 42d652e. (rust-lang#59686)
    
    Closes rust-lang#59674.
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    8311f71 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#62813 - alexcrichton:less-dylib, r=Mark-Sim…

    …ulacrum
    
    rustc: Compile the `fmt_macros` crate as an rlib
    
    I think this was left out by accident from the "convert everything to
    rlibs" commit, there's no need for this to be a dylib just as everything
    else doesn't need to be a dylib!
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    b704be5 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#62817 - estebank:variant-sp, r=matthewjasper

    Tweak span for variant not found error
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    cb1b6c9 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#62822 - RalfJung:pointers, r=Centril

    Improve some pointer-related documentation
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    1d5ea88 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#62842 - JohnTitor:test-for-58887, r=alexreg

    Add tests for issue-58887
    
    Closes rust-lang#58887
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    f7621c5 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#62859 - spastorino:rename-to-as-ref, r=Centril

    Place::as_place_ref is now Place::as_ref
    
    r? @oli-obk
    Centril committed Jul 22, 2019
    Configuration menu
    Copy the full SHA
    80aa34d View commit details
    Browse the repository at this point in the history