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 16 pull requests #58664

Closed
wants to merge 65 commits into from
Closed

Rollup of 16 pull requests #58664

wants to merge 65 commits into from

Commits on Feb 3, 2019

  1. RangeInclusive internal iteration performance improvement.

    Specialize Iterator::try_fold and DoubleEndedIterator::try_rfold to
    improve code generation in all internal iteration scenarios.
    
    This changes brings the performance of internal iteration with
    RangeInclusive on par with the performance of iteration with Range:
    
     - Single conditional jump in hot loop,
     - Unrolling and vectorization,
     - And even Closed Form substitution.
    
    Unfortunately, it only applies to internal iteration. Despite various
    attempts at stream-lining the implementation of next and next_back,
    LLVM has stubbornly refused to optimize external iteration
    appropriately, leaving me with a choice between:
    
     - The current implementation, for which Closed Form substitution is
       performed, but which uses 2 conditional jumps in the hot loop when
       optimization fail.
     - An implementation using a "is_done" boolean, which uses 1
       conditional jump in the hot loop when optimization fail, allowing
       unrolling and vectorization, but for which Closed Form substitution
       fails.
    
    In the absence of any conclusive evidence as to which usecase matters
    most, and with no assurance that the lack of Closed Form substitution
    is not indicative of other optimizations being foiled, there is no way
    to pick one implementation over the other, and thus I defer to the
    statu quo as far as next and next_back are concerned.
    matthieu-m committed Feb 3, 2019
    Configuration menu
    Copy the full SHA
    eb5b096 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2019

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

Commits on Feb 6, 2019

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

Commits on Feb 9, 2019

  1. Configuration menu
    Copy the full SHA
    bc9bfc7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4fed67f View commit details
    Browse the repository at this point in the history
  3. Correct error message

    gnzlbg committed Feb 9, 2019
    Configuration menu
    Copy the full SHA
    19ee98f View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2019

  1. Configuration menu
    Copy the full SHA
    bf2c5d3 View commit details
    Browse the repository at this point in the history
  2. Fix attribute check

    gnzlbg committed Feb 10, 2019
    Configuration menu
    Copy the full SHA
    d0fddd3 View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2019

  1. Configuration menu
    Copy the full SHA
    4e5eda3 View commit details
    Browse the repository at this point in the history
  2. check if used_place and moved_place are equal when determining if…

    … the move was partial
    clintfred committed Feb 13, 2019
    Configuration menu
    Copy the full SHA
    96fd218 View commit details
    Browse the repository at this point in the history
  3. simplified conditional

    clintfred committed Feb 13, 2019
    Configuration menu
    Copy the full SHA
    755b320 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    283ffcf View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2019

  1. SGX target: fix panic = abort

    Jethro Beekman committed Feb 14, 2019
    Configuration menu
    Copy the full SHA
    347a42e View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2019

  1. Fix SECURITY_SQOS_PRESENT missing

    if security_qos_flags(SECURITY_ANONYMOUS) is set
    pitdicker committed Feb 15, 2019
    Configuration menu
    Copy the full SHA
    503e74e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9295f49 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2019

  1. Configuration menu
    Copy the full SHA
    235a6b7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bd18cc5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b2bf37a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f7c4931 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7db96a3 View commit details
    Browse the repository at this point in the history
  6. Update src/librustc_mir/interpret/operand.rs

    Co-Authored-By: oli-obk <[email protected]>
    RalfJung and oli-obk authored Feb 16, 2019
    Configuration menu
    Copy the full SHA
    bee3c67 View commit details
    Browse the repository at this point in the history
  7. 3 Configuration menu
    Copy the full SHA
    525983a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    27e438a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4fdeb2d View commit details
    Browse the repository at this point in the history
  10. 2 Configuration menu
    Copy the full SHA
    4b08533 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    1fe7eb0 View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2019

  1. Change Token::interpolated_to_tokenstream().

    It is currently a method of `Token`, but it only is valid to call if
    `self` is a `Token::Interpolated`. This commit eliminates the
    possibility of misuse by changing it to an associated function that
    takes a `Nonterminal`, which also simplifies the call sites.
    
    This requires splitting out a new function, `nonterminal_to_string`.
    nnethercote committed Feb 17, 2019
    Configuration menu
    Copy the full SHA
    d26bf74 View commit details
    Browse the repository at this point in the history
  2. Remove LazyTokenStream.

    It's present within `Token::Interpolated` as an optimization, so that if
    a nonterminal is converted to a `TokenStream` multiple times, the
    first-computed value is saved and reused.
    
    But in practice it's not needed. `interpolated_to_tokenstream()` is a
    cold function: it's only called a few dozen times while compiling rustc
    itself, and a few hundred times across the entire `rustc-perf` suite.
    Furthermore, when it is called, it is almost always the first
    conversion, so no benefit is gained from it.
    
    So this commit removes `LazyTokenStream`, along with the now-unnecessary
    `Token::interpolated()`.
    
    As well as a significant simplification, the removal speeds things up
    slightly, mostly due to not having to `drop` the `LazyTokenStream`
    instances.
    nnethercote committed Feb 17, 2019
    Configuration menu
    Copy the full SHA
    f8801f3 View commit details
    Browse the repository at this point in the history
  3. Avoid a clone() in transcribe().

    The current code (expensively) clones the value within an `Rc`. This
    commit changes things so that the `Rc` itself is (cheaply) cloned
    instead, avoid some allocations.
    
    This requires converting a few `Rc` instances to `Lrc`.
    nnethercote committed Feb 17, 2019
    Configuration menu
    Copy the full SHA
    f0d8fbd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    82ad4f1 View commit details
    Browse the repository at this point in the history
  5. Remove some unnecessary into() calls.

    These are probably leftovers from recent `TokenStream` simplifications.
    nnethercote committed Feb 17, 2019
    Configuration menu
    Copy the full SHA
    895a794 View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2019

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

Commits on Feb 20, 2019

  1. Configuration menu
    Copy the full SHA
    0651157 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cc20ed6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f411852 View commit details
    Browse the repository at this point in the history
  4. Turn duration consts into associated consts

    Stjepan Glavina committed Feb 20, 2019
    Configuration menu
    Copy the full SHA
    8e219e7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    02fe6a7 View commit details
    Browse the repository at this point in the history
  6. Address review comments

    pitdicker committed Feb 20, 2019
    Configuration menu
    Copy the full SHA
    b09803e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6464e32 View commit details
    Browse the repository at this point in the history
  8. Add examples for duration constants

    Stjepan Glavina committed Feb 20, 2019
    Configuration menu
    Copy the full SHA
    f223c03 View commit details
    Browse the repository at this point in the history
  9. Allow Self::Module to be mutated.

    `codegen_allocator` and `write_metadata` mutate the underlying LLVM module. As
    such, it makes sense for these two functions to receive a mutable reference to
    the module (as opposed to an immutable one).
    gabi-250 committed Feb 20, 2019
    Configuration menu
    Copy the full SHA
    36f18f2 View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2019

  1. Enable feature duration_constants in examples

    Stjepan Glavina committed Feb 21, 2019
    Configuration menu
    Copy the full SHA
    c6d24cd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e5d1fa5 View commit details
    Browse the repository at this point in the history
  3. Optimise vec![false; N] to zero-alloc

    Nowadays booleans have a well-defined representation, so there is no reason not to optimise their allocation.
    RReverser committed Feb 21, 2019
    Configuration menu
    Copy the full SHA
    9f58c5f View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2019

  1. Configuration menu
    Copy the full SHA
    bba0ea2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b5ae4d5 View commit details
    Browse the repository at this point in the history
  3. Make target pointer-width specific variants of (very old) huge-array-…

    …simple.rs test.
    
    (and now unignore the test since it shouldn't break tests of
    cross-compiles anymore.)
    pnkfelix committed Feb 22, 2019
    Configuration menu
    Copy the full SHA
    e555854 View commit details
    Browse the repository at this point in the history
  4. Switch from error patterns to //~ ERROR markers.

    AFAICT, we do not have the same const-eval issues that we used to when
    rust-lang#23926 was filed. (Probably because of the switch to
    miri for const-evaluation.)
    pnkfelix committed Feb 22, 2019
    Configuration menu
    Copy the full SHA
    b72ba05 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cc1cd83 View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2019

  1. Rollup merge of rust-lang#58122 - matthieu-m:range_incl_perf, r=dtolnay

    RangeInclusive internal iteration performance improvement.
    
    Specialize `Iterator::try_fold` and `DoubleEndedIterator::try_rfold` to improve code generation in all internal iteration scenarios.
    
    This changes brings the performance of internal iteration with `RangeInclusive` on par with the performance of iteration with `Range`:
    
     - Single conditional jump in hot loop,
     - Unrolling and vectorization,
     - And even Closed Form substitution.
    
    Unfortunately, it only applies to internal iteration. Despite various attempts at stream-lining the implementation of `next` and `next_back`, LLVM has stubbornly refused to optimize external iteration appropriately, leaving me with a choice between:
    
     - The current implementation, for which Closed Form substitution is performed, but which uses 2 conditional jumps in the hot loop when optimization fail.
     - An implementation using a `is_done` boolean, which uses 1 conditional jump in the hot loop when optimization fail, allowing unrolling and vectorization, but for which Closed Form substitution fails.
    
    In the absence of any conclusive evidence as to which usecase matters most, and with no assurance that the lack of Closed Form substitution is not indicative of other optimizations being foiled, there is no way
    to pick one implementation over the other, and thus I defer to the statu quo as far as `next` and `next_back` are concerned.
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    b4c8dc0 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#58199 - clintfred:partial-move-err-msg, r=e…

    …stebank
    
    Add better error message for partial move
    
    closes rust-lang#56657
    
    r? @davidtwco
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    a34730d View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#58216 - pitdicker:sqos_flags, r=alexcrichton

     Set secure flags when opening a named pipe on Windows
    
    Fixes rust-lang#42036, see also the previous attempt in rust-lang#44556.
    
    Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible.
    
    Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    8c66221 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#58315 - gnzlbg:returns_twice, r=alexcrichton

    Implement unstable ffi_return_twice attribute
    
    This PR implements [RFC2633](rust-lang/rfcs#2633)
    
    r? @eddyb
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    63be1a6 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#58353 - matthewjasper:typeck-pattern-consta…

    …nts, r=arielb1
    
    Check the Self-type of inherent associated constants
    
    r? @arielb1
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    decd787 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#58453 - jethrogb:jb/sgx-panic-abort, r=nagisa

    SGX target: fix panic = abort
    
    What is the difference between `no_mangle` and `rustc_std_internal_symbol`?
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    949ff12 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#58454 - pitdicker:windows_stdio, r=alexcric…

    …hton
    
    Refactor Windows stdio and remove stdin double buffering
    
    I was looking for something nice and small to work on, tried to tackle a few FIXME's in Windows stdio, and things grew from there.
    
    This part of the standard library contains some tricky code, and has changed over the years to handle more corner cases. It could use some refactoring and extra comments.
    
    Changes/fixes:
    - Made `StderrRaw` `pub(crate)`, to remove the `Write` implementations on `sys::Stderr` (used unsynchronised for panic output).
    - Remove the unused `Read` implementation on `sys::windows::stdin`
    - The `windows::stdio::Output` enum made sense when we cached the handles, but we can use simple functions like `is_console` now that we get the handle on every read/write
    - `write` can now calculate the number of written bytes as UTF-8 when we can't write all `u16`s.
    - If `write` could only write one half of a surrogate pair, attempt another write for the other because user code can't reslice in any way that would allow us to write it otherwise.
    - Removed the double buffering on stdin. Documentation on the unexposed `StdinRaw` says: 'This handle is not synchronized or buffered in any fashion'; which is now true.
    - `sys::windows::Stdin` now always only partially fills its buffer, so we can guarantee any arbitrary UTF-16 can be re-encoded without losing any data.
    - `sys::windows::STDIN_BUF_SIZE` is slightly larger to compensate. There should be no real change in the number of syscalls the buffered `Stdin` does. This buffer is a little larger, while the extra buffer on Stdin is gone.
    - `sys::windows::Stdin` now attempts to handle unpaired surrogates at its buffer boundary.
    - `sys::windows::Stdin` no langer allocates for its buffer, but the UTF-16 decoding still does.
    
    ### Testing
    I did some manual testing of reading and writing to console. The console does support UTF-16 in some sense, but doesn't supporting displaying characters outside the BMP.
    - compile stage 1 stdlib with a tiny value for `MAX_BUFFER_SIZE` to make it easier to catch corner cases
    - run a simple test program that reads on stdin, and echo's to stdout
    - write some lines with plenty of ASCII and emoji in a text editor
    - copy and paste in console to stdin
    - return with `\r\n\` or CTRL-Z
    - copy and paste in text editor
    - check it round-trips
    
    -----
    
    Fixes rust-lang#23344. All but one of the suggestions in that issue are now implemented. the missing one is:
    
    > * When reading data, we require the entire set of input to be valid UTF-16. We should instead attempt to read as much of the input as possible as valid UTF-16, only returning an error for the actual invalid elements. For example if we read 10 elements, 5 of which are valid UTF-16, the 6th is bad, and then the remaining are all valid UTF-16, we should probably return the first 5 on a call to `read`, then return an error, then return the remaining on the next call to `read`.
    
    Stdin in Console mode is dealing with text directly input by a user. In my opinion getting an unpaired surrogate is quite unlikely in that case, and a valid reason to error on the entire line of input (which is probably short). Dealing with it is incompatible with an unbuffered stdin, which seems the more interesting guarantee to me.
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    1000776 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#58476 - nnethercote:rm-LazyTokenStream, r=p…

    …etrochenkov
    
    Remove `LazyTokenStream`.
    
    `LazyTokenStream` was added in rust-lang#40939. Perhaps it was an effective optimization then, but no longer. This PR removes it, making the code both simpler and faster.
    
    r? @alexcrichton
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    b440487 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#58511 - oli-obk:const_to_op, r=RalfJung

    Const to op simplification
    
    r? @RalfJung
    
    alternative to rust-lang#58486
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    89c4253 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#58595 - stjepang:make-duration-consts-assoc…

    …iated, r=oli-obk
    
    Turn duration consts into associated consts
    
    As suggested in rust-lang#57391 (comment), I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block.
    
    cc @frewsxcv @SimonSapin
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    70f97c9 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#58609 - gabi-250:mutable-refs, r=oli-obk

    Allow Self::Module to be mutated.
    
    This only changes `&Self::Module` to `&mut Self::Module` in a couple of places.
    
    `codegen_allocator` and `write_metadata` from `ExtraBackendMethods` mutate the underlying LLVM module. As such, it makes sense for these two functions to receive a mutable reference to the module (as opposed to an immutable one).
    
    I am trying to implement `codegen_allocator` for my backend, and I need to be able to mutate `Self::Module`:
    https://github.com/rust-lang/rust/blob/f66e4697ae286985ddefc53c3a047614568458bb/src/librustc_codegen_ssa/traits/backend.rs#L41
    Modifying the module in `codegen_allocator`/`write_metadata` is not a problem for the LLVM backend, because [ModuleLlvm](https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/lib.rs#L357) contains a raw pointer to the underlying LLVM module, so it can easily be mutated through FFI calls.
    
    I am trying to avoid interior mutability and `unsafe` as much as I can. What do you think? Does this change make sense, or is there a reason why this should stay the way it is?
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    f4b182d View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#58628 - RReverser:optimise-vec-false, r=oli…

    …-obk
    
    Optimise vec![false; N] to zero-alloc
    
    Nowadays booleans have a well-defined representation, so there is no reason not to optimise their allocation.
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    89ac6cc View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#58642 - tspiteri:intra-rustdoc-prim-method,…

    … r=GuillaumeGomez
    
    rustdoc: support methods on primitives in intra-doc links
    
    Fixes rust-lang#58598.
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    c85de5c View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#58643 - GuillaumeGomez:extra-variables, r=M…

    …anishearth
    
    Don't generate minification variables if minification disabled
    
    If the minification is disabled, there is no sense having those variables.
    
    r? @QuietMisdreavus
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    80ab575 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#58648 - pnkfelix:issue-23926-update-tests, …

    …r=nikomatsakis
    
    Update tests to account for cross-platform testing and miri.
    
    Fix rust-lang#23926
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    b019549 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#58654 - estebank:underflow, r=nikomatsakis

    Do not underflow after resetting unmatched braces count
    
    Fix rust-lang#58638.
    
    r? @oli-obk
    Centril authored Feb 23, 2019
    Configuration menu
    Copy the full SHA
    de703e7 View commit details
    Browse the repository at this point in the history