Skip to content
Permalink
master

Commits on Oct 2, 2020

  1. Auto merge of #77396 - wesleywiser:disable-simplifyarmidentity, r=oli…

    …-obk
    
    Disable the SimplifyArmIdentity mir-opt
    
    The optimization still has some bugs that need to be worked out
    such as #77359.
    
    We can try re-enabling this again after the known issues are resolved.
    
    r? `@oli-obk`
    bors committed Oct 2, 2020
  2. Auto merge of #77029 - ehuss:command-access, r=dtolnay

    Add accessors to Command.
    
    This adds some accessor methods to `Command` to provide a way to access the values set when building the `Command`. An example where this can be useful is to display the command to be executed. This is roughly based on the [`ProcessBuilder`](https://github.com/rust-lang/cargo/blob/13b73cdaf76b2d9182515c9cf26a8f68342d08ef/src/cargo/util/process_builder.rs#L105-L134) in Cargo.
    
    Possible concerns about the API:
    - Values with NULs on Unix will be returned as `"<string-with-nul>"`. I don't think it is practical to avoid this, since otherwise a whole separate copy of all the values would need to be kept in `Command`.
    - Does not handle `arg0` on Unix. This can be awkward to support in `get_args` and is rarely used. I figure if someone really wants it, it can be added to `CommandExt` as a separate method.
    - Does not offer a way to detect `env_clear`. I'm uncertain if it would be useful for anyone.
    - Does not offer a way to get an environment variable by name (`get_env`). I figure this can be added later if anyone really wants it. I think the motivation for this is weak, though. Also, the API could be a little awkward (return a `Option<Option<&OsStr>>`?).
    - `get_envs` could skip "cleared" entries and just return `&OsStr` values instead of `Option<&OsStr>`. I'm on the fence here. My use case is to display a shell command, and I only intend it to be roughly equivalent to the actual execution, and I probably won't display `None` entries. I erred on the side of providing extra information, but I suspect many situations will just filter out the `None`s.
    - Could implement more iterator stuff (like `DoubleEndedIterator`).
    
    I have not implemented new std items before, so I'm uncertain if the existing issue should be reused, or if a new tracking issue is needed.
    
    cc #44434
    bors committed Oct 2, 2020
  3. Auto merge of #77436 - JohnTitor:rollup-65dh7rp, r=JohnTitor

    Rollup of 11 pull requests
    
    Successful merges:
    
     - #76851 (Fix 'FIXME' about using NonZeroU32 instead of u32.)
     - #76979 (Improve std::sys::windows::compat)
     - #77111 (Stabilize slice_ptr_range.)
     - #77147 (Split sys_common::Mutex in StaticMutex and MovableMutex.)
     - #77312 (Remove outdated line from `publish_toolstate` hook)
     - #77362 (Fix is_absolute on WASI)
     - #77375 (rustc_metadata: Do not forget to encode inherent impls for foreign types)
     - #77385 (Improve the example for ptr::copy)
     - #77389 (Fix some clippy lints)
     - #77399 (BTreeMap: use Unique::from to avoid a cast where type information exists)
     - #77429 (Link `new` method in `DefautHasher`s doc)
    
    Failed merges:
    
    r? `@ghost`
    bors committed Oct 2, 2020
  4. Disable the SimplifyArmIdentity mir-opt

    The optimization still has some bugs that need to be worked out
    such as #77359.
    
    We can try re-enabling this again after the known issues are resolved.
    wesleywiser committed Oct 2, 2020

Commits on Oct 1, 2020

  1. Rollup merge of #77429 - WaffleLapkin:doc_link_default_hasher_new, r=…

    …jyn514
    
    Link `new` method in `DefautHasher`s doc
    
    FIXME referenced #56922 which was resolved
    
    r? @jyn514
    JohnTitor committed Oct 1, 2020
  2. Rollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

    BTreeMap: use Unique::from to avoid a cast where type information exists
    
    r? @Mark-Simulacrum
    JohnTitor committed Oct 1, 2020
  3. Rollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum

    Fix some clippy lints
    
    Found while working on #77351;
    these are just the ones that could be fixed automatically.
    JohnTitor committed Oct 1, 2020
  4. Rollup merge of #77385 - scottmcm:fix-77220, r=jyn514

    Improve the example for ptr::copy
    
    Fixes #77220
    JohnTitor committed Oct 1, 2020
  5. Rollup merge of #77375 - petrochenkov:inherext, r=oli-obk

    rustc_metadata: Do not forget to encode inherent impls for foreign types
    
    So I tried to move FFI interface for LLVM from `rustc_codegen_llvm` to `rustc_llvm` and immediately encountered this fascinating issue.
    
    Fixes #46665.
    JohnTitor committed Oct 1, 2020
  6. Rollup merge of #77362 - RReverser:patch-1, r=dtolnay

    Fix is_absolute on WASI
    
    WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes.
    
    Without this change, `is_absolute` for any paths, including `/some/path`, was returning `false`on a WASI target, which is obviously not true and undesirable.
    JohnTitor committed Oct 1, 2020
  7. Rollup merge of #77312 - LeSeulArtichaut:toolstate-msg, r=Mark-Simula…

    …crum
    
    Remove outdated line from `publish_toolstate` hook
    
    We no longer add `I-nominated` to toolstate failure issues since T-compiler changed its meeting preparation workflow.
    JohnTitor committed Oct 1, 2020
  8. Rollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dto…

    …lnay
    
    Split sys_common::Mutex in StaticMutex and MovableMutex.
    
    The (unsafe) `Mutex` from `sys_common` had a rather complicated interface. You were supposed to call `init()` manually, unless you could guarantee it was neither moved nor used reentrantly.
    
    Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if `destroy()` should only be called when `init()` was called.
    
    This allowed for a number of interesting (confusing?) different ways to use this `Mutex`, all captured in a single type.
    
    In practice, this type was only ever used in two ways:
    
    1. As a static variable. In this case, neither `init()` nor `destroy()` are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the `LockGuard`, never with `raw_lock`.
    
    2. As a `Box`ed variable. In this case, both `init()` and `destroy()` are called, it will be moved and possibly used reentrantly.
    
    No other combinations are used anywhere in `std`.
    
    This change simplifies things by splitting this `Mutex` type into two types matching the two use cases: `StaticMutex` and `MovableMutex`.
    
    The interface of both new types is now both safer and simpler. The first one does not call nor expose `init`/`destroy`, and the second one calls those automatically in its `new()` and `Drop` functions. Also, the locking functions of `MovableMutex` are no longer unsafe.
    
    ---
    
    This will also make it easier to conditionally box mutexes later, by moving that decision into sys/sys_common. Some of the mutex implementations (at least those of Wasm and 'sys/unsupported') are safe to move, so wouldn't need a box. ~~(But that's blocked on  #76932 for now.)~~ (See #77380.)
    JohnTitor committed Oct 1, 2020
  9. Rollup merge of #77111 - fusion-engineering-forks:stabilize-slice-ptr…

    …-range, r=dtolnay
    
    Stabilize slice_ptr_range.
    
    This has been unstable for almost a year now. Time to stabilize?
    
    Closes #65807.
    
    @rustbot modify labels: +T-libs +A-raw-pointers +A-slice +needs-fcp
    JohnTitor committed Oct 1, 2020
  10. Rollup merge of #76979 - fusion-engineering-forks:windows-fallback-ch…

    …eck, r=dtolnay
    
    Improve std::sys::windows::compat
    
    Improves the compat_fn macro in sys::windows, which is used for conditionally loading APIs that might not be available.
    
    - The module (dll) name can now be any string, not just an ident. (Not all Windows api modules are valid Rust identifiers. E.g. `WaitOnAddress` comes from `API-MS-Win-Core-Synch-l1-2-0.dll`.)
    - Adds `FuncName::is_available()` for checking if a function is really available without having to do a duplicate lookup.
    - Add comment explaining the lack of locking.
    - Use `$_:block` to simplify the macro_rules.
    - Apply `allow(unused_variables)` only to the fallback instead of everything.
    
    ---
    
    The second point (`is_available()`) simplifies code that needs to pick an implementation depening on what is available, like `sys/windows/mutex.rs`. Before this change, it'd do its own lookup and keep its own `AtomicUsize` to track the result. Now it can just use `c::AcquireSRWLockExclusive::is_available()` directly.
    
    This will also be useful when park/unpark/CondVar/etc. get improved implementations (e.g. from parking_lot or something else), as the best APIs for those are not available before Windows 8.
    JohnTitor committed Oct 1, 2020
  11. Rollup merge of #76851 - fusion-engineering-forks:fixme-nonzero, r=pe…

    …trochenkov
    
    Fix 'FIXME' about using NonZeroU32 instead of u32.
    
    It was blocked by #58732 (const fn NonZeroU32::new), which is fixed now.
    JohnTitor committed Oct 1, 2020
  12. Auto merge of #77412 - Mark-Simulacrum:rls-fix, r=Xanewok

    Update rls
    
    Includes rust-lang/rls#1700, just fixing compilation and test failures.
    
    Fixes #77311.
    bors committed Oct 1, 2020
  13. Link `new` method in `DefautHasher`s doc

    WaffleLapkin committed Oct 1, 2020
  14. Remove outdated line from `publish_toolstate` hook

    LeSeulArtichaut committed Oct 1, 2020
  15. Auto merge of #76971 - bugadani:issue-75659, r=Amanieu

    Refactor memchr to allow optimization
    
    Closes #75659
    
    The implementation already uses naive search if the slice if short enough, but the case is complicated enough to not be optimized away. This PR refactors memchr so that it exists early when the slice is short enough.
    
    Codegen-wise, as shown in #75659, memchr was not inlined previously so the only way I could find to test this is to check if there is no memchr call. Let me know if there is a more robust solution here.
    bors committed Oct 1, 2020
  16. Update rls

    Mark-Simulacrum committed Oct 1, 2020
  17. Auto merge of #76969 - withoutboats:rawfd-refexive-traits, r=dtolnay

    Make RawFd implement the RawFd traits
    
    This PR makes `RawFd` implement `AsRawFd`, `IntoRawFd` and `FromRawFd`, so it can be passed to interfaces that use one of those traits as a bound.
    bors committed Oct 1, 2020
  18. Add note about possible future improvement

    Co-authored-by: David Tolnay <[email protected]>
    m-ou-se and dtolnay committed Oct 1, 2020
  19. Formatting.

    m-ou-se committed Oct 1, 2020
  20. Improve std::sys::windows::compat.

    - Module name can now be any string, not just an ident.
      (Not all Windows api modules are valid Rust identifiers.)
    - Adds c::FuncName::is_available() for checking if a function is really
      available without having to do a duplicate lookup.
    - Add comment explaining the lack of locking.
    - Use `$_:block` to simplify the macro_rules.
    - Apply allow(unused_variables) only to the fallback instead of
      everything.
    m-ou-se committed Oct 1, 2020
  21. Only test on x86_64

    bugadani committed Oct 1, 2020
  22. Auto merge of #76919 - fusion-engineering-forks:thread-parker, r=dtolnay

    Use futex-based thread::park/unpark on Linux.
    
    This moves the parking/unparking logic out of `thread/mod.rs` into a module named `thread_parker` in `sys_common`. The current implementation is moved to `sys_common/thread_parker/generic.rs` and the new implementation using futexes is added in `sys_common/thread_parker/futex.rs`.
    bors committed Oct 1, 2020
  23. Auto merge of #74839 - alarsyo:multiple_return_terminators, r=oli-obk

    Implement multiple return terminator optimization
    
    Closes #72022
    bors committed Oct 1, 2020
  24. Bless mir-opt tests for 32 bit

    alarsyo committed Oct 1, 2020
  25. Add test for multiple terminator optimization

    alarsyo committed Oct 1, 2020
  26. Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=o…

    …li-obk
    
    Overhaul const-checking diagnostics
    
    The primary purpose of this PR was to remove `NonConstOp::STOPS_CONST_CHECKING`, which causes any additional errors found by the const-checker to be silenced. I used this flag to preserve diagnostic parity with `qualify_min_const_fn.rs`, which has since been removed.
    
    However, simply removing the flag caused a deluge of errors in some cases, since an error would be emitted any time a local or temporary had a wrong type. To remedy this, I added an alternative system (`DiagnosticImportance`) to silence additional error messages that were likely to distract the user from the underlying issue. When an error of the highest importance occurs, all less important errors are silenced. When no error of the highest importance occurs, all less important errors are emitted after checking is complete. Following the suggestions from the important error is usually enough to fix the less important errors, so this should lead to better UX most of the time.
    
    There's also some unrelated diagnostics improvements in this PR isolated in their own commits. Splitting them out would be possible, but a bit of a pain. This isn't as tidy as some of my other PRs, but it should *only* affect diagnostics, never whether or not something passes const-checking. Note that there are a few trivial exceptions to this, like banning `Yield` in all const-contexts, not just `const fn`.
    
    As always, meant to be reviewed commit-by-commit.
    
    r? `@oli-obk`
    bors committed Oct 1, 2020
Older
You can’t perform that action at this time.