]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #76867 - poliorcetics:intra-doc-core-iter, r=jyn514
Ralf Jung [Mon, 21 Sep 2020 08:40:32 +0000 (10:40 +0200)]
Rollup merge of #76867 - poliorcetics:intra-doc-core-iter, r=jyn514

Use intra-doc links in core/src/iter when possible

Helps with #75080.

I also updated lots of links to use `fn()` instead of `fn` when possible.

@rustbot modify labels: T-doc A-intra-doc-links

r? @jyn514

3 years agoRollup merge of #76846 - botika:master, r=davidtwco
Ralf Jung [Mon, 21 Sep 2020 08:40:30 +0000 (10:40 +0200)]
Rollup merge of #76846 - botika:master, r=davidtwco

Avoiding unnecesary allocations at rustc_errors

Simplify the code avoiding allocations with easy alternative

3 years agoRollup merge of #76628 - jyn514:default-config-files, r=Mark-Simulacrum
Ralf Jung [Mon, 21 Sep 2020 08:40:28 +0000 (10:40 +0200)]
Rollup merge of #76628 - jyn514:default-config-files, r=Mark-Simulacrum

Add sample defaults for config.toml

- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`.
- Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set.
- Combine config files using the `merge` dependency.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.

Closes #76619

3 years agoRollup merge of #76135 - CDirkx:const-option, r=dtolnay,oli-obk
Ralf Jung [Mon, 21 Sep 2020 08:40:26 +0000 (10:40 +0200)]
Rollup merge of #76135 - CDirkx:const-option, r=dtolnay,oli-obk

Stabilize some Option methods as const

Stabilize the following methods of `Option` as const:
 - `is_some`
 - `is_none`
 - `as_ref`

These methods are currently const under the unstable feature `const_option` (tracking issue: #67441).
I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also:  [PR#75463](https://github.com/rust-lang/rust/pull/75463).

Related: #76225

3 years agoAuto merge of #75974 - SkiFire13:peekmut-opt-sift, r=LukasKalbertodt
bors [Mon, 21 Sep 2020 05:31:01 +0000 (05:31 +0000)]
Auto merge of #75974 - SkiFire13:peekmut-opt-sift, r=LukasKalbertodt

Avoid useless sift_down when std::collections::binary_heap::PeekMut is never mutably dereferenced

If `deref_mut` is never called then it's not possible for the element to be mutated without internal mutability, meaning there's no need to call `sift_down`.

This could be a little improvement in cases where you want to mutate the biggest element of the heap only if it satisfies a certain predicate that needs only read access to the element.

3 years agoAuto merge of #76806 - jethrogb:jb/update-llvm, r=cuviper
bors [Mon, 21 Sep 2020 03:32:01 +0000 (03:32 +0000)]
Auto merge of #76806 - jethrogb:jb/update-llvm, r=cuviper

Update LLVM

This (partially?) addresses rust-lang/rust#74632

r? `@cuviper`

3 years agoAuto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obk
bors [Mon, 21 Sep 2020 00:43:26 +0000 (00:43 +0000)]
Auto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obk

Remove MMX from Rust

Follow-up to https://github.com/rust-lang/stdarch/pull/890
This removes most of MMX from Rust (tests pass with small changes), keeping stable `is_x86_feature_detected!("mmx")` working.

3 years agoAuto merge of #76544 - Mark-Simulacrum:less-python, r=alexcrichton
bors [Sun, 20 Sep 2020 22:00:36 +0000 (22:00 +0000)]
Auto merge of #76544 - Mark-Simulacrum:less-python, r=alexcrichton

De-couple Python and bootstrap slightly

This revises rustbuild's entry points from Python to rely less on magic environment variables, preferring to use Cargo-provided environment variables where feasible.

Notably, BUILD_DIR and BOOTSTRAP_CONFIG are *not* moved, because both more-or-less have some non-trivial discovery logic and replicating it in rustbuild seems unfortunate; if it moved to Cargo that would be a different story.

Best reviewed by-commit.

3 years agoRemove `can_suggest` from Clippy.
Christiaan Dirkx [Sun, 20 Sep 2020 22:00:33 +0000 (00:00 +0200)]
Remove `can_suggest` from Clippy.

Removes `can_suggest` from as it is no longer used.
Reverts rust-clippy#5724.

3 years agoUpdate Clippy testcases
Christiaan Dirkx [Sun, 20 Sep 2020 21:59:34 +0000 (23:59 +0200)]
Update Clippy testcases

Update the test `redundant_pattern_matching`: check if `is_some` and `is_none` are suggested within const contexts.

3 years agoMove const tests for `Option` to `library\core`
Christiaan Dirkx [Thu, 3 Sep 2020 22:13:25 +0000 (00:13 +0200)]
Move const tests for `Option` to `library\core`

Part of #76268

3 years agoStabilize some Option methods as const
CDirkx [Mon, 31 Aug 2020 00:11:48 +0000 (02:11 +0200)]
Stabilize some Option methods as const

Stabilize the following methods of `Option` as const:
 - `is_some`
 - `is_none`
 - `as_ref`

Possible because of stabilization of #49146 (Allow if and match in constants).

3 years agoSpecify output directory for bootstrap tests
Mark Rousskov [Thu, 10 Sep 2020 14:52:27 +0000 (10:52 -0400)]
Specify output directory for bootstrap tests

3 years agoProvide bootstrap tools with RUSTC in environment
Mark Rousskov [Thu, 10 Sep 2020 14:17:32 +0000 (10:17 -0400)]
Provide bootstrap tools with RUSTC in environment

3 years agoAdd sample defaults for config.toml
Joshua Nelson [Sat, 12 Sep 2020 04:42:52 +0000 (00:42 -0400)]
Add sample defaults for config.toml

- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`
- Add default config files
- Combine config files using the merge dependency.
- Add comments to default config files
- Add a README asking to open an issue if the defaults are bad
- Give a loud error if trying to merge `.target`, since it's not
  currently supported
- Use an exhaustive match
- Use `<none>` in config.toml.example to avoid confusion
- Fix bugs in `Merge` derives

Previously, it would completely ignore the profile defaults if there
were any settings in `config.toml`. I sent an email to the `merge` maintainer
asking them to make the behavior in this commit the default.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.

3 years agoDiscover Rust toolchain without Python
Mark Rousskov [Mon, 7 Sep 2020 16:02:50 +0000 (12:02 -0400)]
Discover Rust toolchain without Python

3 years agoRemove support for different src directory
Mark Rousskov [Mon, 7 Sep 2020 01:32:55 +0000 (21:32 -0400)]
Remove support for different src directory

This requires that bootstrap is run from the same worktree as the sources it'll
build, but this is basically required for the build to work anyway. You can
still run it from a different directory, just that the files it builds must be
beside it.

3 years agoSet BUILD_TRIPLE via build script
Mark Rousskov [Sun, 6 Sep 2020 23:57:07 +0000 (19:57 -0400)]
Set BUILD_TRIPLE via build script

This moves build triple discovery for rustbuild from bootstrap.py into a build
script, meaning it will "just work" if building rustbuild via Cargo rather than
Python.

3 years agoAuto merge of #76848 - RalfJung:miri, r=RalfJung
bors [Sun, 20 Sep 2020 20:00:17 +0000 (20:00 +0000)]
Auto merge of #76848 - RalfJung:miri, r=RalfJung

update Miri

Let's get https://github.com/rust-lang/miri/pull/1540 shipped.
Fixes https://github.com/rust-lang/rust/issues/76968.
Cc `@rust-lang/miri` r? `@ghost`

3 years agoAuto merge of #75119 - simonvandel:early-otherwise, r=oli-obk
bors [Sun, 20 Sep 2020 17:54:44 +0000 (17:54 +0000)]
Auto merge of #75119 - simonvandel:early-otherwise, r=oli-obk

New MIR optimization pass to reduce branches on match of tuples of enums

Fixes #68867 by adding a new pass that turns something like
```rust
let x: Option<()>;
let y: Option<()>;
match (x,y) {
    (Some(_), Some(_)) => {0},
    _ => {1}
}
```
into something like
```rust
let x: Option<()>;
let y: Option<()>;
let discriminant_x = // get discriminant of x
let discriminant_y = // get discriminant of x
if discriminant_x != discriminant_y {1} else {0}
```

The opt-diffs still have the old basic blocks like
```
bb3: {
          _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30
          switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30
      }

      bb4: {
          _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34
          switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34
      }

      bb5: {
          _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34
          switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34
      }
```

These do get removed on later passes. I'm not sure if I should include those passes in the test to make it clear?

3 years agouse iter:: before free functions
Alexis Bourget [Sun, 20 Sep 2020 16:04:12 +0000 (18:04 +0200)]
use iter:: before free functions

3 years agoAuto merge of #76975 - RalfJung:rollup-s2wiuqr, r=RalfJung
bors [Sun, 20 Sep 2020 15:12:40 +0000 (15:12 +0000)]
Auto merge of #76975 - RalfJung:rollup-s2wiuqr, r=RalfJung

Rollup of 15 pull requests

Successful merges:

 - #76732 (Add docs for `BasicBlock`)
 - #76832 (Let backends define custom targets)
 - #76866 (Remove unused feature gates from library/ crates)
 - #76875 (Move to intra-doc links in library/alloc/src/collections/binary_heap.rs)
 - #76876 (Move to intra-doc links in collections/btree/map.rs and collections/linked_list.rs)
 - #76877 (Move to intra-doc links in collections/vec_deque.rs and collections/vec_deque/drain.rs)
 - #76878 (Move the version number to a plaintext file)
 - #76883 (README.md: Remove prompts from code blocks)
 - #76887 (Add missing examples on HashSet iter types)
 - #76890 (use matches!() macro for simple if let conditions)
 - #76891 (don't take `TyCtxt` by reference)
 - #76910 (transmute: use diagnostic item)
 - #76924 (Add tracking issue for feature(unix_socket_peek))
 - #76926 (BTreeMap: code readability tweaks)
 - #76940 (Don't allow implementing trait directly on type-alias-impl-trait)

Failed merges:

r? `@ghost`

3 years agoupdate Miri
Ralf Jung [Thu, 17 Sep 2020 18:04:20 +0000 (20:04 +0200)]
update Miri

3 years agoemit diff after SimplifyBranches-after-copy-prop
Simon Vandel Sillesen [Sun, 20 Sep 2020 12:45:08 +0000 (14:45 +0200)]
emit diff after SimplifyBranches-after-copy-prop

3 years agoRollup merge of #76940 - Aaron1011:fix/trait-on-tait, r=oli-obk
Ralf Jung [Sun, 20 Sep 2020 13:52:09 +0000 (15:52 +0200)]
Rollup merge of #76940 - Aaron1011:fix/trait-on-tait, r=oli-obk

Don't allow implementing trait directly on type-alias-impl-trait

This is specifically disallowed by the RFC, but we never added a check
for it.

Fixes #76202

3 years agoRollup merge of #76926 - ssomers:btree_cleanup_1, r=Mark-Simulacrum
Ralf Jung [Sun, 20 Sep 2020 13:52:07 +0000 (15:52 +0200)]
Rollup merge of #76926 - ssomers:btree_cleanup_1, r=Mark-Simulacrum

BTreeMap: code readability tweaks

Gathered over the past months

r? @Mark-Simulacrum

3 years agoRollup merge of #76924 - rijenkii:patch-1, r=oli-obk
Ralf Jung [Sun, 20 Sep 2020 13:52:06 +0000 (15:52 +0200)]
Rollup merge of #76924 - rijenkii:patch-1, r=oli-obk

Add tracking issue for feature(unix_socket_peek)

Feature was added in #73761

3 years agoRollup merge of #76910 - lcnr:foreign-item-like, r=oli-obk
Ralf Jung [Sun, 20 Sep 2020 13:52:04 +0000 (15:52 +0200)]
Rollup merge of #76910 - lcnr:foreign-item-like, r=oli-obk

transmute: use diagnostic item

closes #66075, we now have no remaining uses of `match_def_path`  in the compiler while some uses still remain in `clippy`.

cc @RalfJung

3 years agoRollup merge of #76891 - lcnr:less-ref, r=ecstatic-morse
Ralf Jung [Sun, 20 Sep 2020 13:52:03 +0000 (15:52 +0200)]
Rollup merge of #76891 - lcnr:less-ref, r=ecstatic-morse

don't take `TyCtxt` by reference

small cleanup

3 years agoRollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr
Ralf Jung [Sun, 20 Sep 2020 13:52:01 +0000 (15:52 +0200)]
Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr

use matches!() macro for simple if let conditions

3 years agoRollup merge of #76887 - GuillaumeGomez:hashset-iter-types-examples, r=Dylan-DPC
Ralf Jung [Sun, 20 Sep 2020 13:51:59 +0000 (15:51 +0200)]
Rollup merge of #76887 - GuillaumeGomez:hashset-iter-types-examples, r=Dylan-DPC

Add missing examples on HashSet iter types

3 years agoRollup merge of #76883 - qlcom:master, r=Mark-Simulacrum
Ralf Jung [Sun, 20 Sep 2020 13:51:58 +0000 (15:51 +0200)]
Rollup merge of #76883 - qlcom:master, r=Mark-Simulacrum

README.md: Remove prompts from code blocks

https://github.com/rust-lang/rust/issues/76863

3 years agoRollup merge of #76878 - pietroalbini:version, r=Mark-Simulacrum
Ralf Jung [Sun, 20 Sep 2020 13:51:56 +0000 (15:51 +0200)]
Rollup merge of #76878 - pietroalbini:version, r=Mark-Simulacrum

Move the version number to a plaintext file

The Rust version number is currently embedded in bootstrap's source code, which makes it hard to update it automatically or access it outside of ./x.py (as you'd have to parse the source code).

This PR moves the version number to a standalone plaintext file, which makes accessing or updating it trivial.

r? @Mark-Simulacrum

3 years agoRollup merge of #76877 - denisvasilik:intra-doc-links-alloc-vec-deque, r=jyn514
Ralf Jung [Sun, 20 Sep 2020 13:51:54 +0000 (15:51 +0200)]
Rollup merge of #76877 - denisvasilik:intra-doc-links-alloc-vec-deque, r=jyn514

Move to intra-doc links in collections/vec_deque.rs and collections/vec_deque/drain.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links

3 years agoRollup merge of #76876 - denisvasilik:intra-doc-links-alloc, r=jyn514
Ralf Jung [Sun, 20 Sep 2020 13:51:53 +0000 (15:51 +0200)]
Rollup merge of #76876 - denisvasilik:intra-doc-links-alloc, r=jyn514

Move to intra-doc links in collections/btree/map.rs and collections/linked_list.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links

3 years agoRollup merge of #76875 - denisvasilik:intra-doc-links-alloc-binary-heap, r=jyn514
Ralf Jung [Sun, 20 Sep 2020 13:51:51 +0000 (15:51 +0200)]
Rollup merge of #76875 - denisvasilik:intra-doc-links-alloc-binary-heap, r=jyn514

Move to intra-doc links in library/alloc/src/collections/binary_heap.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links

3 years agoRollup merge of #76866 - est31:master, r=lcnr
Ralf Jung [Sun, 20 Sep 2020 13:51:50 +0000 (15:51 +0200)]
Rollup merge of #76866 - est31:master, r=lcnr

Remove unused feature gates from library/ crates

Removes some unused feature gates from library crates. It's likely not a complete list as I only tested a subset for which it's more likely that it is unused.

3 years agoRollup merge of #76832 - khyperia:backend_target_override, r=eddyb
Ralf Jung [Sun, 20 Sep 2020 13:51:48 +0000 (15:51 +0200)]
Rollup merge of #76832 - khyperia:backend_target_override, r=eddyb

Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.

3 years agoRollup merge of #76732 - camelid:mir-basic-block-docs, r=RalfJung
Ralf Jung [Sun, 20 Sep 2020 13:51:46 +0000 (15:51 +0200)]
Rollup merge of #76732 - camelid:mir-basic-block-docs, r=RalfJung

Add docs for `BasicBlock`

Fixes #76715.

---

@rustbot modify labels: A-mir T-doc C-enhancement

3 years agoRemove MMX from Rust
Mateusz Mikuła [Thu, 3 Sep 2020 18:14:15 +0000 (20:14 +0200)]
Remove MMX from Rust

3 years agoAuto merge of #76136 - CDirkx:const-result, r=dtolnay
bors [Sun, 20 Sep 2020 13:07:11 +0000 (13:07 +0000)]
Auto merge of #76136 - CDirkx:const-result, r=dtolnay

Stabilize some Result methods as const

Stabilize the following methods of Result as const:
 - `is_ok`
 - `is_err`
 - `as_ref`

A test is also included, analogous to the test for `const_option`.

These methods are currently const under the unstable feature `const_result` (tracking issue: #67520).
I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463) and [PR#76135](https://github.com/rust-lang/rust/pull/76135).

Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature.

Related: #76225

3 years agoenable on mir-opt-level=1 to test perf
Simon Vandel Sillesen [Sat, 19 Sep 2020 23:40:58 +0000 (01:40 +0200)]
enable on mir-opt-level=1 to test perf

3 years agoadd cleanup of cfg
Simon Vandel Sillesen [Sat, 19 Sep 2020 23:18:05 +0000 (01:18 +0200)]
add cleanup of cfg

3 years agoinsert storageDead for not equal temp
Simon Vandel Sillesen [Sat, 19 Sep 2020 23:09:18 +0000 (01:09 +0200)]
insert storageDead for not equal temp

3 years agocorrect comment
Simon Vandel Sillesen [Sat, 19 Sep 2020 21:53:18 +0000 (23:53 +0200)]
correct comment

3 years agobless
Simon Vandel Sillesen [Sat, 19 Sep 2020 21:50:51 +0000 (23:50 +0200)]
bless

3 years agoreplace usize with u32 to make it easier to bless
Simon Vandel Sillesen [Sat, 19 Sep 2020 21:38:54 +0000 (23:38 +0200)]
replace usize with u32 to make it easier to bless

3 years agoUpdate src/librustc_mir/transform/early_otherwise_branch.rs
Simon Vandel Sillesen [Sat, 19 Sep 2020 21:27:20 +0000 (23:27 +0200)]
Update src/librustc_mir/transform/early_otherwise_branch.rs

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
3 years agoNew MIR optimization pass to reduce branches on match of tuples of enums
Simon Vandel Sillesen [Sat, 1 Aug 2020 23:47:52 +0000 (01:47 +0200)]
New MIR optimization pass to reduce branches on match of tuples of enums

3 years agoAuto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJung
bors [Sun, 20 Sep 2020 11:02:36 +0000 (11:02 +0000)]
Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJung

Rollup of 15 pull requests

Successful merges:

 - #76722 (Test and fix Send and Sync traits of BTreeMap artefacts)
 - #76766 (Extract some intrinsics out of rustc_codegen_llvm)
 - #76800 (Don't generate bootstrap usage unless it's needed)
 - #76809 (simplfy condition in ItemLowerer::with_trait_impl_ref())
 - #76815 (Fix wording in mir doc)
 - #76818 (Don't compile regex at every function call.)
 - #76821 (Remove redundant nightly features)
 - #76823 (black_box: silence unused_mut warning when building with cfg(miri))
 - #76825 (use `array_windows` instead of `windows` in the compiler)
 - #76827 (fix array_windows docs)
 - #76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip))
 - #76840 (Move to intra doc links in core/src/future)
 - #76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map})
 - #76853 (Use intra-doc links in library/core/src/task/wake.rs)
 - #76871 (support panic=abort in Miri)

Failed merges:

r? `@ghost`

3 years agoUpdate src/tools/clippy/clippy_lints/src/matches.rs
CDirkx [Sun, 20 Sep 2020 10:21:23 +0000 (12:21 +0200)]
Update src/tools/clippy/clippy_lints/src/matches.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoRollup merge of #76871 - RalfJung:miri-panic-abort, r=dtolnay
Ralf Jung [Sun, 20 Sep 2020 10:08:36 +0000 (12:08 +0200)]
Rollup merge of #76871 - RalfJung:miri-panic-abort, r=dtolnay

support panic=abort in Miri

This is needed for https://github.com/rust-lang/miri/issues/1058 on Windows: we cannot run the inline-assembly versions of `abort`, so fall back to the intrinsic (which Miri supports).

3 years agoRollup merge of #76853 - denisvasilik:intra-doc-links-core-wake, r=jyn514
Ralf Jung [Sun, 20 Sep 2020 10:08:34 +0000 (12:08 +0200)]
Rollup merge of #76853 - denisvasilik:intra-doc-links-core-wake, r=jyn514

Use intra-doc links in library/core/src/task/wake.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links

3 years agoRollup merge of #76845 - Amjad50:fix-intra-docs-links, r=jyn514
Ralf Jung [Sun, 20 Sep 2020 10:08:33 +0000 (12:08 +0200)]
Rollup merge of #76845 - Amjad50:fix-intra-docs-links, r=jyn514

Use intra docs links in core::{ascii, option, str, pattern, hash::map}

Partial fix for #75080

@rustbot modify labels: T-doc A-intra-doc-links

r? @jyn514

3 years agoRollup merge of #76840 - poliorcetics:intra-doc-core-sync-and-future, r=jyn514
Ralf Jung [Sun, 20 Sep 2020 10:08:31 +0000 (12:08 +0200)]
Rollup merge of #76840 - poliorcetics:intra-doc-core-sync-and-future, r=jyn514

Move to intra doc links in core/src/future

Helps with #75080.

@rustbot modify labels: T-doc A-intra-doc-links

r? @jyn514

3 years agoRollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
Ralf Jung [Sun, 20 Sep 2020 10:08:29 +0000 (12:08 +0200)]
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr

use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)

3 years agoRollup merge of #76827 - lcnr:array_windows-docs, r=jonas-schievink
Ralf Jung [Sun, 20 Sep 2020 10:08:27 +0000 (12:08 +0200)]
Rollup merge of #76827 - lcnr:array_windows-docs, r=jonas-schievink

fix array_windows docs

r? @Dylan-DPC

3 years agoRollup merge of #76825 - lcnr:array-windows-apply, r=varkor
Ralf Jung [Sun, 20 Sep 2020 10:08:26 +0000 (12:08 +0200)]
Rollup merge of #76825 - lcnr:array-windows-apply, r=varkor

use `array_windows` instead of `windows` in the compiler

I do think these changes are beautiful, but do have to admit that using type inference for the window length
can easily be confusing. This seems like a general issue with const generics, where inferring constants adds an additional
complexity which users have to learn and keep in mind.

3 years agoRollup merge of #76823 - RalfJung:black-box-warn, r=joshtriplett
Ralf Jung [Sun, 20 Sep 2020 10:08:24 +0000 (12:08 +0200)]
Rollup merge of #76823 - RalfJung:black-box-warn, r=joshtriplett

black_box: silence unused_mut warning when building with cfg(miri)

3 years agoRollup merge of #76821 - est31:remove_redundant_nightly_features, r=oli-obk,Mark...
Ralf Jung [Sun, 20 Sep 2020 10:08:22 +0000 (12:08 +0200)]
Rollup merge of #76821 - est31:remove_redundant_nightly_features, r=oli-obk,Mark-Simulacrum

Remove redundant nightly features

Removes a bunch of redundant/outdated nightly features. The first commit removes a `core_intrinsics` use for which a stable wrapper has been provided since. The second commit replaces the `const_generics` feature with `min_const_generics` which might get stabilized this year. The third commit is the result of a trial/error run of removing every single feature and then adding it back if compile failed. A bunch of unused features are the result that the third commit removes.

3 years agoRollup merge of #76818 - hbina:dont_compile_regex_all_the_time, r=ecstatic-morse
Ralf Jung [Sun, 20 Sep 2020 10:08:20 +0000 (12:08 +0200)]
Rollup merge of #76818 - hbina:dont_compile_regex_all_the_time, r=ecstatic-morse

Don't compile regex at every function call.

Use `SyncOnceCell` to only compile it once.
I believe this still adds some kind of locking mechanism?

Related issue: https://github.com/rust-lang/rust/issues/76817

3 years agoRollup merge of #76815 - pickfire:patch-6, r=jonas-schievink
Ralf Jung [Sun, 20 Sep 2020 10:08:19 +0000 (12:08 +0200)]
Rollup merge of #76815 - pickfire:patch-6, r=jonas-schievink

Fix wording in mir doc

3 years agoRollup merge of #76809 - matthiaskrgr:simplify_cond, r=varkor
Ralf Jung [Sun, 20 Sep 2020 10:08:17 +0000 (12:08 +0200)]
Rollup merge of #76809 - matthiaskrgr:simplify_cond, r=varkor

simplfy condition in ItemLowerer::with_trait_impl_ref()

3 years agoRollup merge of #76800 - jyn514:usage, r=Mark-Simulacrum
Ralf Jung [Sun, 20 Sep 2020 10:08:15 +0000 (12:08 +0200)]
Rollup merge of #76800 - jyn514:usage, r=Mark-Simulacrum

Don't generate bootstrap usage unless it's needed

Previously, `x.py` would unconditionally run `x.py build` to get the
help message. After https://github.com/rust-lang/rust/issues/76165,
when checking the CI stage was moved into `Config`, that would cause an
assertion failure (but only only in CI!):

```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`', src/bootstrap/config.rs:619:49
```

This changes bootstrap to only generate a help message when it needs
to (when someone passes `--help`).

r? @Mark-Simulacrum
This should fix the CI failures in https://github.com/rust-lang/rust/pull/76797 and https://github.com/rust-lang/rust/pull/75991.

3 years agoRollup merge of #76766 - khyperia:generic_intrinsics, r=eddyb
Ralf Jung [Sun, 20 Sep 2020 10:08:13 +0000 (12:08 +0200)]
Rollup merge of #76766 - khyperia:generic_intrinsics, r=eddyb

Extract some intrinsics out of rustc_codegen_llvm

A significant amount of intrinsics do not actually need backend-specific behaviors to be implemented, instead relying on methods already in rustc_codegen_ssa. So, extract those methods out to rustc_codegen_ssa, so that each backend doesn't need to reimplement the same code.

Almost everything should be a pretty direct translation. A notable not-direct-translation is `add_with_overflow` and friends being changed to `bx.checked_binop`, but it's pretty simple.

I could have been a lot more aggressive here and pulled out way more methods, and add a few new methods in the rustc_codegen_ssa "API". However, because this is my second rustc PR, I thought that moving those to a follow-up PR and doing more incremental changes here would be better (and I guess ask if this work is even desired in the first place). I'm hoping to eventually remove the mess of intrinsic handling in the backend entirely, which would be hecking fantastic :sparkles:

3 years agoRollup merge of #76722 - ssomers:btree_send_sync, r=Mark-Simulacrum
Ralf Jung [Sun, 20 Sep 2020 10:08:12 +0000 (12:08 +0200)]
Rollup merge of #76722 - ssomers:btree_send_sync, r=Mark-Simulacrum

Test and fix Send and Sync traits of BTreeMap artefacts

Fixes #76686.

I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs,  maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable.

r? @Mark-Simulacrum

3 years agoAuto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJung
bors [Sun, 20 Sep 2020 08:58:32 +0000 (08:58 +0000)]
Auto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJung

Validate constants during `const_eval_raw`

This PR implements the groundwork for https://github.com/rust-lang/rust/issues/72396

* constants are now validated during `const_eval_raw`
* to prevent cycle errors, we do not validate references to statics anymore beyond the fact that they are not dangling
* the `const_eval` query ICEs if used on `static` items
* as a side effect promoteds are now evaluated to `ConstValue::Scalar` again (since they are just a reference to the actual promoted allocation in most cases).

3 years agoRemove `can_suggest` check for `is_ok` and `is_err`.
Christiaan Dirkx [Sun, 20 Sep 2020 08:46:30 +0000 (10:46 +0200)]
Remove `can_suggest` check for `is_ok` and `is_err`.

`is_ok` and `is_err` are stabilized as const and can thus always be suggested.

3 years agoMake codegen test bitwidth-independent
Oliver Scherer [Sun, 20 Sep 2020 07:09:56 +0000 (09:09 +0200)]
Make codegen test bitwidth-independent

3 years agoAuto merge of #76411 - RalfJung:promote-in-const-fn, r=ecstatic-morse
bors [Sun, 20 Sep 2020 06:20:16 +0000 (06:20 +0000)]
Auto merge of #76411 - RalfJung:promote-in-const-fn, r=ecstatic-morse

Some promotion cleanup

Based on top of both https://github.com/rust-lang/rust/pull/75502 and https://github.com/rust-lang/rust/pull/75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes https://github.com/rust-lang/rust/issues/75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from `@rust-lang/wg-const-eval` .

3 years agoarray pattern
Bastian Kauschke [Thu, 17 Sep 2020 08:01:24 +0000 (10:01 +0200)]
array pattern

3 years agouse `array_windows` instead of `windows` in the compiler
Bastian Kauschke [Thu, 17 Sep 2020 07:28:14 +0000 (09:28 +0200)]
use `array_windows` instead of `windows` in the compiler

3 years agoAuto merge of #75346 - davidtwco:issue-69925-polymorphic-instancedef-fnptrshim, r...
bors [Sun, 20 Sep 2020 04:15:43 +0000 (04:15 +0000)]
Auto merge of #75346 - davidtwco:issue-69925-polymorphic-instancedef-fnptrshim, r=nikomatsakis

shim: monomorphic `FnPtrShim`s during construction

Fixes #69925.

This PR adjusts MIR shim construction so that substitutions are applied to function pointer shims during construction, rather than during codegen (as determined by `substs_for_mir_body`).

r? `@eddyb`

3 years agoRemove some unused features from alloc core and std
est31 [Fri, 18 Sep 2020 07:35:37 +0000 (09:35 +0200)]
Remove some unused features from alloc core and std

3 years agoAuto merge of #72632 - jonas-schievink:dest-prop, r=oli-obk
bors [Sun, 20 Sep 2020 01:38:26 +0000 (01:38 +0000)]
Auto merge of #72632 - jonas-schievink:dest-prop, r=oli-obk

Implement a generic Destination Propagation optimization on MIR

This takes the work that was originally started by `@eddyb` in https://github.com/rust-lang/rust/pull/47954, and then explored by me in https://github.com/rust-lang/rust/pull/71003, and implements it in a general (ie. not limited to acyclic CFGs) and dataflow-driven way (so that no additional infrastructure in rustc is needed).

The pass is configured to run at `mir-opt-level=2` and higher only. To enable it by default, some followup work on it is still needed:
* Performance needs to be evaluated. I did some light optimization work and tested against `tuple-stress`, which caused trouble in my last attempt, but didn't go much in depth here.
  * We can also enable the pass only at `opt-level=2` and higher, if it is too slow to run in debug mode, but fine when optimizations run anyways.
* Debuginfo needs to be fixed after locals are merged. I did not look into what is required for this.
* Live ranges of locals (aka `StorageLive` and `StorageDead`) are currently deleted. We either need to decide that this is fine, or if not, merge the variable's live ranges (or remove these statements entirely – https://github.com/rust-lang/rust/issues/68622).

Some benchmarks of the pass were done in https://github.com/rust-lang/rust/pull/72635.

3 years agoUpdate Clippy testcases
Christiaan Dirkx [Sun, 20 Sep 2020 01:32:36 +0000 (03:32 +0200)]
Update Clippy testcases

Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts.
Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.

3 years agoFix time complexity in BinaryHeap::peek_mut docs
Giacomo Stevanato [Sat, 19 Sep 2020 23:07:34 +0000 (01:07 +0200)]
Fix time complexity in BinaryHeap::peek_mut docs

3 years agoSet sift=true only when PeekMut yields a mutable reference
Giacomo Stevanato [Wed, 26 Aug 2020 21:52:20 +0000 (23:52 +0200)]
Set sift=true only when PeekMut yields a mutable reference

3 years agoAdded benchmarks for BinaryHeap
Giacomo Stevanato [Sat, 5 Sep 2020 21:16:56 +0000 (23:16 +0200)]
Added benchmarks for BinaryHeap

3 years agoUse intra-doc links
Denis Vasilik [Fri, 18 Sep 2020 09:05:26 +0000 (11:05 +0200)]
Use intra-doc links

3 years agoDon't allow implementing trait directly on type-alias-impl-trait
Aaron Hill [Sat, 19 Sep 2020 20:25:50 +0000 (16:25 -0400)]
Don't allow implementing trait directly on type-alias-impl-trait

This is specifically disallowed by the RFC, but we never added a check
for it.

Fixes #76202

3 years agofix some comments
Ralf Jung [Wed, 9 Sep 2020 10:57:36 +0000 (12:57 +0200)]
fix some comments

3 years agonever promote non-const operations; revert STATIC promotion change
Ralf Jung [Wed, 9 Sep 2020 08:00:23 +0000 (10:00 +0200)]
never promote non-const operations; revert STATIC promotion change

3 years agofix doc comment
Ralf Jung [Mon, 7 Sep 2020 11:22:59 +0000 (13:22 +0200)]
fix doc comment

3 years agocleanup promotion const_kind checks
Ralf Jung [Sun, 6 Sep 2020 14:06:39 +0000 (16:06 +0200)]
cleanup promotion const_kind checks

in particular allow a few more promotions for consistency when they were already allowed in other contexts

3 years agoAuto merge of #76929 - ssomers:btree_cleanup_2, r=Mark-Simulacrum
bors [Sat, 19 Sep 2020 19:15:06 +0000 (19:15 +0000)]
Auto merge of #76929 - ssomers:btree_cleanup_2, r=Mark-Simulacrum

BTreeMap: wrap node's raw parent pointer in NonNull

Now that the other `*const` (root) is gone, seemed like a small step forward.

r? `@Mark-Simulacrum`

3 years agoBTreeMap: wrap node's raw parent pointer in NonNull
Stein Somers [Sat, 19 Sep 2020 14:47:03 +0000 (16:47 +0200)]
BTreeMap: wrap node's raw parent pointer in NonNull

3 years agoAuto merge of #76327 - lzutao:split-core-num, r=SimonSapin
bors [Sat, 19 Sep 2020 16:13:26 +0000 (16:13 +0000)]
Auto merge of #76327 - lzutao:split-core-num, r=SimonSapin

Split `core/num/mod.rs` to smaller mods

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/num/mod.rs` to these modules:

* `error`: For error structs like `ParseIntError`.
* blanket `shells` dir: For dummy number type modules: std::i32, std::f32, and the likes. Why? See below.
* `int_macros` and `uint_macros`: Real implementation of all integer types via `int_impl` and `uint_impl`
* `nonzero`: For `NonZero*` types and their implementations.
* `wrapping`: For `Wrapping<T>` types.

3 years agoBTreeMap: code readability tweaks
Stein Somers [Sun, 16 Aug 2020 20:39:01 +0000 (22:39 +0200)]
BTreeMap: code readability tweaks

3 years agoRemove outdated ignored tidy comment
Lzu Tao [Fri, 4 Sep 2020 15:31:23 +0000 (15:31 +0000)]
Remove outdated ignored tidy comment

3 years agoMove (u)int_impl macros to their own files
Lzu Tao [Fri, 4 Sep 2020 14:20:01 +0000 (14:20 +0000)]
Move (u)int_impl macros to their own files

3 years agoAdd tracking issue for feature(unix_socket_peek)
rijenkii [Sat, 19 Sep 2020 14:55:01 +0000 (21:55 +0700)]
Add tracking issue for feature(unix_socket_peek)

3 years agoMove dummy integer modules (like core::u32) to shells dir
Lzu Tao [Fri, 4 Sep 2020 14:00:38 +0000 (14:00 +0000)]
Move dummy integer modules (like core::u32) to shells dir

3 years agoMove error structs to new mod
Lzu Tao [Fri, 4 Sep 2020 13:37:15 +0000 (13:37 +0000)]
Move error structs to new mod

3 years agoMove Wrapping<T> definition to wrapping mod
Lzu Tao [Fri, 4 Sep 2020 13:14:39 +0000 (13:14 +0000)]
Move Wrapping<T> definition to wrapping mod

3 years agoMove NonZero* to its file
Lzu Tao [Fri, 4 Sep 2020 13:07:03 +0000 (13:07 +0000)]
Move NonZero* to its file

3 years agoupdate docs
Bastian Kauschke [Sat, 19 Sep 2020 13:36:53 +0000 (15:36 +0200)]
update docs

3 years agoAuto merge of #76880 - shepmaster:cc-rs, r=Mark-Simulacrum
bors [Sat, 19 Sep 2020 13:31:23 +0000 (13:31 +0000)]
Auto merge of #76880 - shepmaster:cc-rs, r=Mark-Simulacrum

Update cc crate to 1.0.60 to understand aarch64-apple-darwin with clang

r? `@Mark-Simulacrum`

/cc `@alexcrichton`

3 years agoAuto merge of #76912 - RalfJung:rollup-q9ur56h, r=RalfJung
bors [Sat, 19 Sep 2020 11:29:00 +0000 (11:29 +0000)]
Auto merge of #76912 - RalfJung:rollup-q9ur56h, r=RalfJung

Rollup of 14 pull requests

Successful merges:

 - #73963 (deny(unsafe_op_in_unsafe_fn) in libstd/path.rs)
 - #75099 (lint/ty: move fns to avoid abstraction violation)
 - #75502 (Use implicit (not explicit) rules for promotability by default in `const fn`)
 - #75580 (Add test for checking duplicated branch or-patterns)
 - #76310 (Add `[T; N]: TryFrom<Vec<T>>` (insta-stable))
 - #76400 (Clean up vec benches bench_in_place style)
 - #76434 (do not inline black_box when building for Miri)
 - #76492 (Add associated constant `BITS` to all integer types)
 - #76525 (Add as_str() to string::Drain.)
 - #76636 (assert ScalarMaybeUninit size)
 - #76749 (give *even better* suggestion when matching a const range)
 - #76757 (don't convert types to the same type with try_into (clippy::useless_conversion))
 - #76796 (Give a better error message when x.py uses the wrong stage for CI)
 - #76798 (Build fixes for RISC-V 32-bit Linux support)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #76798 - alistair23:alistair/rv32-linux, r=jyn514
Ralf Jung [Sat, 19 Sep 2020 09:47:56 +0000 (11:47 +0200)]
Rollup merge of #76798 - alistair23:alistair/rv32-linux, r=jyn514

Build fixes for RISC-V 32-bit Linux support

This fixes build issues with the 32-bit RISC-V port.