Commit Graph

127438 Commits

Author SHA1 Message Date
bors
f4e4485a05 Auto merge of #76771 - Dylan-DPC:rollup-qj4j3ma, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #73955 (deny(unsafe_op_in_unsafe_fn) in libstd/process.rs)
 - #75146 (Detect overflow in proc_macro_server subspan)
 - #75304 (Note when a a move/borrow error is caused by a deref coercion)
 - #75749 (Consolidate some duplicate code in the sys modules.)
 - #75882 (Use translated variable for test string)
 - #75886 (Test that bounds checks are elided for [..index] after .position())
 - #76048 (Initial support for riscv32gc_unknown_linux_gnu)
 - #76198 (Make some Ordering methods const)
 - #76689 (Upgrade to pulldown-cmark 0.8.0)
 - #76763 (Update cargo)

Failed merges:

r? `@ghost`
2020-09-16 00:56:12 +00:00
Dylan DPC
2e1f0121e8
Rollup merge of #76763 - ehuss:update-cargo, r=ehuss
Update cargo

6 commits in 875e0123259b0b6299903fe4aea0a12ecde9324f..8777a6b1e8834899f51b7e09cc9b8d85b2417110
2020-09-08 20:17:21 +0000 to 2020-09-15 19:11:03 +0000
- updated yank error message (rust-lang/cargo#8697)
- Fix non-determinism with new feature resolver. (rust-lang/cargo#8701)
- Display formatted output for JSON diffing in tests. (rust-lang/cargo#8692)
- Add --name suggestion for cargo new (rust-lang/cargo#8675)
- Sweep unrelated message from unnecessary workspace infromation (rust-lang/cargo#8681)
- Docs: Make it more clear we have two types of workspaces (rust-lang/cargo#8666)
2020-09-16 01:30:45 +02:00
Dylan DPC
1fd22fc34e
Rollup merge of #76689 - jyn514:update-pulldown, r=GuillaumeGomez
Upgrade to pulldown-cmark 0.8.0

Thanks to marcusklaas' hard work in https://github.com/raphlinus/pulldown-cmark/pull/469, this fixes a lot of rustdoc bugs!

- Get rid of unnecessary `RefCell`
- Fix duplicate warnings for broken implicit reference link
- Remove unnecessary copy of links

Closes https://github.com/rust-lang/rust/issues/73264, closes https://github.com/rust-lang/rust/issues/76687.
r? @euclio

I'm not sure if the switch away from `locate` fixes any open bugs - euclio mentioned some in https://github.com/raphlinus/pulldown-cmark/issues/165, but I didn't see any related issues open for rustdoc. Let me know if I missed one.
2020-09-16 01:30:44 +02:00
Dylan DPC
69ac07608e
Rollup merge of #76198 - CDirkx:const-ordering, r=dtolnay
Make some Ordering methods const

Resubmission of [PR#75463](https://github.com/rust-lang/rust/pull/75463) as per [PR#76172](https://github.com/rust-lang/rust/pull/76172).

Constify the following methods of `core::cmp::Ordering`:
 - `reverse`
 - `then`

Insta-stabilizes these methods as const under the `const_ordering` feature, as their implementation is a trivial match and the recent stabilization of #49146 (Allow `if` and `match` in constants).
Note: the `const_ordering` feature has never actually been used as these methods have not been `#[rustc_const_unstable]`.

Tracking issue:  #76113
2020-09-16 01:30:42 +02:00
Dylan DPC
db228987ac
Rollup merge of #76048 - alistair23:alistair/rv32-linux, r=Amanieu
Initial support for riscv32gc_unknown_linux_gnu

Now that RISC-V 32-bit (RV32) support is in upstream glibc let's add support for userspace Rust.
2020-09-16 01:30:40 +02:00
Dylan DPC
056c7b09ff
Rollup merge of #75886 - erikdesjardins:index, r=nikic
Test that bounds checks are elided for [..index] after .position()

Closes #73396.

This was fixed by the LLVM 11 update in #73526.
2020-09-16 01:30:38 +02:00
Dylan DPC
c9105185de
Rollup merge of #75882 - pickfire:patch-6, r=jyn514
Use translated variable for test string

Test should be educative, added english translation and pronounciation.
2020-09-16 01:30:36 +02:00
Dylan DPC
034af08e14
Rollup merge of #75749 - ehuss:consolidate-sys, r=alexcrichton
Consolidate some duplicate code in the sys modules.

This consolidates some modules which were duplicated throughout the sys module. The intent is to make it easier to update and maintain this code. This mainly affects the wasi, sgx, and "unsupported" targets.

I explicitly skipped hermit, cloudabi, and vxworks. These tier-3 targets have copied large sections of the sys tree. I don't think they should have, but I don't want to put effort into changing them. It also doesn't help that there aren't any scripts or instructions for building them.

There are still sections of duplicate code here and there, but this PR covers the easy parts where entire modules are the same.
2020-09-16 01:30:34 +02:00
Dylan DPC
fa4cfeb597
Rollup merge of #75304 - Aaron1011:feature/diag-deref-move-out, r=estebank
Note when a a move/borrow error is caused by a deref coercion

Fixes #73268

When a deref coercion occurs, we may end up with a move error if the
base value has been partially moved out of. However, we do not indicate
anywhere that a deref coercion is occuring, resulting in an error
message with a confusing span.

This PR adds an explicit note to move errors when a deref coercion is
involved. We mention the name of the type that the deref-coercion
resolved to, as well as the `Deref::Target` associated type being used.
2020-09-16 01:30:32 +02:00
Dylan DPC
fb9bb2b5ca
Rollup merge of #75146 - tmiasko:range-overflow, r=Mark-Simulacrum
Detect overflow in proc_macro_server subspan

* Detect overflow in proc_macro_server subspan
* Add tests for overflow in Vec::drain
* Add tests for overflow in String / VecDeque operations using ranges
2020-09-16 01:30:30 +02:00
Dylan DPC
4f0c245429
Rollup merge of #73955 - hellow554:unsafe_process, r=Mark-Simulacrum
deny(unsafe_op_in_unsafe_fn) in libstd/process.rs

The libstd/process.rs part of #73904 . Wraps the two calls to an unsafe fn Initializer::nop() in an unsafe block.

Will have to wait for #73909 to be merged, because of the feature in the libstd/lib.rs
2020-09-16 01:30:28 +02:00
Stein Somers
378b64392f BTreeMap: avoid slices even more 2020-09-16 01:10:44 +02:00
bors
9f04c90657 Auto merge of #76755 - pietroalbini:gha-macos, r=Mark-Simulacrum
Gate macOS on both Azure and GHA

As discussed in the previous infrastructure team meeting, this PR gates macOS builds on both GHA and Azure. Once this is merged we'll wait a week or two to see if there is a troublesome rate of spurious failures, and if not we'll remove the builds on the Azure side.

r? `@Mark-Simulacrum`
cc #71988
2020-09-15 22:51:44 +00:00
Eric Huss
e0c1621a3f Update books 2020-09-15 14:55:50 -07:00
Eric Huss
f95d7ba7d3 Update cargo 2020-09-15 14:52:18 -07:00
Ralf Jung
7d67546a6a hopefully fix rustdoc links 2020-09-15 23:46:26 +02:00
Matthias Krüger
fd9be8f7aa don't lazily evaulate some trivial values for Option::None replacements (clippy::unnecessary_lazy_evaluations) 2020-09-15 23:17:51 +02:00
Ralf Jung
c528d24196 fix slice::check_range aliasing problems 2020-09-15 23:14:41 +02:00
Yoshua Wuyts
143e4e975b Fix stabilization marker for future_readiness_fns
Moved it from 1.47.0 -> 1.48.0, which is the correct release for this to stabilize in
2020-09-15 23:12:08 +02:00
Ralf Jung
d888725fba reduce size of test_from_iter_specialization_with_iterator_adapters test in Miri 2020-09-15 23:03:07 +02:00
bors
6af1bdda54 Auto merge of #73595 - SNCPlay42:lifetime-after-mut, r=Mark-Simulacrum
improve diagnostics for lifetime after `&mut`

If, when parsing a borrow pointee type, we see a lifetime after `mut`, suggest placing the lifetime before `mut` and eat the lifetime to avoid a large number of unhelpful diagnostics.

There are some subtleties to avoid false positives in cases like `&mut 'a + Trait`, where `&mut ('a + Trait)` is a better suggestion.

fixes #73568
2020-09-15 21:01:30 +00:00
Adam Lesinski
fafb2e9de7 [fuchsia] Propagate the userspace UTC clock
On Fuchsia, spawning a subprocess does not automatically
clone all of the parent process' capabilities. UTC time on
Fuchsia is managed by a top-level userspace clock capability
that is cloned and passed to subprocesses.

This change ensures that any Rust subprocess gets access to the
UTC clock, if the parent had access to it. This is critical for
tests, which on Fuchsia, use panic=abort and spawn subprocesses
per test.
2020-09-15 13:54:46 -07:00
Matthias Krüger
73d4171ea6 fix a couple of stylistic clippy warnings
namely:

clippy::redundant_pattern_matching
clippy::redundant_pattern
clippy::search_is_some
clippy::filter_next
clippy::into_iter_on_ref
clippy::clone_on_copy
clippy::needless_return
2020-09-15 22:44:54 +02:00
Pietro Albini
9bf1f27f58
ci: gate macOS on GHA too 2020-09-15 21:56:07 +02:00
bors
07ece44a42 Auto merge of #73166 - jethrogb:stdarch, r=Amanieu
Update stdarch

This PR **changes the public signature** of the following functions in `core::arch::{x86, x86_64}`:
```patch
-pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i8
+pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i32
-pub unsafe fn _mm256_extract_epi16(a: __m256i, imm8: i32) -> i16
+pub unsafe fn _mm256_extract_epi16(a: __m256i, imm8: i32) -> i32
```

This change is desired so that these signatures
* are similar to those of the 128-bit versions `_mm_extract_epi8` and `_mm_extract_epi16`
* match the Intel definitions for the intrinsics
  * [RFC 2325](https://github.com/rust-lang/rfcs/blob/master/text/2325-stable-simd.md) specifies that the exact vendor function signatures should be used

A [crater run](https://github.com/rust-lang/rust/pull/73166#issuecomment-667230319) revealed only a single breakage. The [vektor crate](https://github.com/AdamNiederer/vektor/blob/master/src/x86/avx2.rs#L2436-L2472) copied the incorrect signatures in `core` exactly to their own crate. The functions don't seem to be used by anyone anywhere.

Actual breakage is not expected, since due to the nature of the functions, users would generally write `_mm256_extract_epi8(...) as u8` or `_mm256_extract_epi16(...) as u16`.

See https://github.com/rust-lang/stdarch/pull/868/. Note that the changes from that stdarch PR have already partially landed in core after https://github.com/rust-lang/stdarch/pull/878/. This PR is now only about the remaining changes.
2020-09-15 19:04:40 +00:00
bors
a874956d94 Auto merge of #75148 - joechrisellis:master, r=Amanieu
Implementation of peer credentials for Unix sockets

The code in `ucred.rs` is based on the work done in [PR 13](https://github.com/tokio-rs/tokio-uds/pull/13) in the tokio-uds repository on GitHub.

This commit is effectively a port to the stdlib, so credit to Martin Habovštiak (`@Kixunil)` and contributors for the meat of this work. 🥇

Happy to make changes as needed. 🙂
2020-09-15 17:05:57 +00:00
Guillaume Gomez
2a5a6b42ec Add missing code examples in libcore 2020-09-15 18:18:04 +02:00
Niclas Schwarzlose
81161bed41
Adjust spelling
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-15 18:10:41 +02:00
Jethro Beekman
0122e08dae Update stdarch 2020-09-15 17:26:20 +02:00
Joshua Nelson
328c61c157 Make the default stage for x.py configurable
This allows configuring the default stage for each sub-command individually.

- Normalize the stage as early as possible, so there's no confusion
  about which to use.
- Don't add an explicit `stage` option in config.toml

  This offers no more flexibility than `*_stage` and makes it confusing
  which takes precedence.

- Always give `--stage N` precedence over config.toml
- Fix bootstrap tests

  This changes the tests to go through `Config::parse` so that they test
  the actual defaults, not the dummy ones provided by `default_opts`.  To
  make this workable (and independent of the environment), it does not
  read `config.toml` for tests.
2020-09-15 11:19:55 -04:00
Alistair Francis
e968f86f71 doc: platform-support.md: Move to tier 3
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-15 08:13:01 -07:00
bors
27a45d0aab Auto merge of #76708 - Mark-Simulacrum:lld-macos, r=alexcrichton
Always try to promote shared LLVM to the sysroot

Even when LLVM is not generally participating in a shared link with rustc, we
will likely still link to the shared dylib from rust-lld, so we still need to
promote it.

This reverts part of #76349; my expectation that the link-shared rule was sufficient was likely wrong.

Hopefully fixes #76698.

r? `@alexcrichton`
2020-09-15 15:06:59 +00:00
Alistair Francis
cbda1546b1 doc: platform-support.md: Document port
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-15 07:58:33 -07:00
SNCPlay42
4de9a53d98 improve diagnostics for lifetime after &mut 2020-09-15 10:36:06 -04:00
Mark Rousskov
f001a0c8dd Enable shared linking to LLVM on non-Windows
Windows doesn't quite support dynamic linking to LLVM yet, but on other
platforms we do. In #76708, it was discovered that we dynamically link to LLVM
from the LLVM tools (e.g., rust-lld), so we need the shared LLVM library to link
against. That means that if we do not have a shared link to LLVM, and want LLVM
tools to work, we'd be shipping two copies of LLVM on all of these platforms:
one in librustc_driver and one in libLLVM.

Also introduce an error into rustbuild if we do end up configured for shared
linking on Windows.
2020-09-15 10:22:02 -04:00
Eric Huss
25cca07ea0 Consolidate wasi::process and unsupported::process 2020-09-15 07:01:13 -07:00
Eric Huss
cfb955da6f Consolidate wasi alloc with unix alloc. 2020-09-15 07:01:13 -07:00
Eric Huss
5a4098ed0f Consolidate byte-identical modules. 2020-09-15 07:01:07 -07:00
Mark Rousskov
5f3145febd Avoid printing dry run timings 2020-09-15 08:59:34 -04:00
Joshua Nelson
b93a8315f2 Add a comment why rustdoc loads crates from the sysroot 2020-09-15 08:40:10 -04:00
bors
4c1966f97e Auto merge of #76311 - lzutao:split_core-slice, r=lcnr
Split `core::slice` to smaller mods

Unfortunately the `#[lang = "slice"]` is too big (3003 lines), I cannot split it further.

Note for reviewer:
* I split to multiple commits for easier reviewing, but I could git squash them all to one if requested.
* Recommend pulling this change locally and using advanced git diff viewer or this command:
  ```
  git show --reverse --color-moved=dimmed-zebra master..
  ```

---

I split core/slice/mod.rs to these modules:

* `ascii`: For operations on `[u8]`.
* `cmp`: For comparison operations on `[T]`, like PartialEq and SliceContains impl.
* `index`: For indexing operations like Index/IndexMut and SliceIndex.
* `iter`: For Iterator definitions and implementation on `[T]`.
  - `macros`: For iterator! and forward_iterator! macros.
* `raw`: For free function to create `&[T]` or `&mut [T]` from pointer + length or a reference.

The heapsort wrapper in mod.rs is removed in favor of reexport from `sort::heapsort`.
2020-09-15 12:15:59 +00:00
Lzu Tao
c65050d537 Fix clippy hard-code slice::Iter path 2020-09-15 10:21:40 +00:00
bors
90b1f5ae59 Auto merge of #76171 - estebank:turbofish-the-revenge, r=davidtwco
Detect turbofish with multiple type params missing leading `::`

Fix #76072.
2020-09-15 10:14:52 +00:00
Hameer Abbasi
5f0b775390
Remove redundant &format!.
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-09-15 11:11:18 +02:00
Hameer Abbasi
7d5db239e7 This commit introduces the following changes:
* Change error message for type param in a const expression when using
min_const_generics
* Change ParamInNonTrivialAnonConst to contain an extra bool used for
distinguishing whether the passed-in symbol is a type or a value.
2020-09-15 10:27:19 +02:00
bors
c1589cc819 Auto merge of #76684 - jyn514:refactor-intra-links, r=manishearth
Refactor intra doc link code

I got tired of `fold_item` being 500 lines long.
This is best reviewed one commit at a time with whitespace changes hidden.
There are no logic changes other than the last commit making a parameter checked by the caller instead of the callee.

r? `@Manishearth`
2020-09-15 07:42:13 +00:00
Ivan Tham
1f572b0349
Vec doc use elision as code rather than comment 2020-09-15 14:41:43 +08:00
bors
6cae28165f Auto merge of #76682 - richkadel:vec-take, r=Mark-Simulacrum
Optimize behavior of vec.split_off(0) (take all)

Optimization improvement to `split_off()` so the performance meets the
intuitively expected behavior when `at == 0`, avoiding the current behavior
of copying the entire vector.

The change honors documented behavior that the original vector's
"previous capacity unchanged".

This improvement better supports the pattern for building and flushing a
buffer of elements, such as the following:

```rust
    let mut vec = Vec::new();
    loop {
        vec.push(something);
        if condition_is_met {
            process(vec.split_off(0));
        }
    }
```

`Option` wrapping is the first alternative I thought of, but is much
less obvious and more verbose:

```rust
    let mut capacity = 1;
    let mut vec: Option<Vec<Stuff>> = None;
    loop {
        vec.get_or_insert_with(|| Vec::with_capacity(capacity)).push(something);
        if condition_is_met {
            capacity = vec.capacity();
            process(vec.take().unwrap());
        }
    }
```

Directly using `mem::replace()` (instead of  calling`split_off()`) could work,
but `mem::replace()` is a more advanced tool for Rust developers, and in
this case, I believe developers would assume the standard library should
be sufficient for the purpose described here.

The benefit of the approach to this change is it does not change the
existing API contract, but improves the peformance of `split_off(0)` for
`Vec`, `String` (which delegates `split_off()` to `Vec`), and any other
existing use cases.

This change adds tests to validate the behavior of `split_off()` with
regard to capacity, as originally documented, and confirm that behavior
still holds, when `at == 0`.

The change is an implementation detail, and does not require a
documentation change, but documenting the new behavior as part of its
API contract may benefit future users.

(Let me know if I should make that documentation update.)

Note, for future consideration:

I think it would be helpful to introduce an additional method to `Vec`
(if not also to `String`):

```
    pub fn take_all(&mut self) -> Self {
        self.split_off(0)
    }
```

This would make it more clear how `Vec` supports the pattern, and make
it easier to find, since the behavior is similar to other `take()`
methods in the Rust standard library.

r? `@wesleywiser`
FYI: `@tmandry`
2020-09-15 05:01:17 +00:00
Erik Desjardins
0f1d25e556 Test that bounds checks are elided for indexing after .[r]position() 2020-09-14 22:19:48 -04:00
bors
715e9340a1 Auto merge of #74532 - fusion-engineering-forks:atomic-from-mut, r=KodrAus
Add Atomic*::from_mut.

The atomic equivalent of [`Cell::from_mut`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.from_mut).
2020-09-15 02:09:34 +00:00