Commit Graph

135555 Commits

Author SHA1 Message Date
Rich Kadel
ae288df51f Convenience funcs for some_option.unwrap_or(...)
This ensures consistent handling of default values for options that are
None if not specified on the command line.
2020-12-14 17:27:27 -08:00
Rich Kadel
36c639a2ce Convenience funcs for some_option.unwrap_or(...)
This ensures consistent handling of default values for options that are
None if not specified on the command line.
2020-12-14 17:27:27 -08:00
Wesley Wiser
0b18ed833c Disable the constant debuginfo promotion pass by default
It doesn't work correctly on *-pc-windows-gnu
2020-12-14 19:56:10 -05:00
Tomasz Miąsko
a9ff4bd838 Always run intrinsics lowering pass
Move intrinsics lowering pass from the optimization phase (where it
would not run if -Zmir-opt-level=0), to the drop lowering phase where it
runs unconditionally.

The implementation of those intrinsics in code generation and
interpreter is unnecessary. Remove it.
2020-12-15 00:00:00 +00:00
LeSeulArtichaut
a72b739bf0 Remove unused TyEncoder::tcx required method 2020-12-14 23:33:47 +01:00
bors
8b3ee82eb6 Auto merge of - tmiasko:stdarch, r=Amanieu
Update stdarch submodule

Changes included:

* Use a bootstrap guard for modules with new target features
* Avoid calling intrinsics with invalid const arguments
* Avx512bw
* Avx512cd
* Add AVX512BITALG
* Add GFNI Intrinsics
* Add AVX512VPOPCNTDQ Intrinsics
* Add VPCLMULQDQ Intrinsics
* Avx512bw
* Reimplement `_xgetbv` with LLVM intrinsics
* Avx512bw
* Add reamained vmax and vmin via auto-generated code
* Add VAES intrinsics

Fixes .
2020-12-14 22:16:47 +00:00
Chayim Refael Friedman
777ca999a9 Optimization for bool's PartialOrd impl 2020-12-14 23:32:52 +02:00
Rich Kadel
3043a7b5d9 Improve warnings on incompatible options involving -Zinstrument-coverage
Adds checks for:

* `no_core` attribute
* explicitly-enabled `legacy` symbol mangling
* mir_opt_level > 1 (which enables inlining)

I removed code from the `Inline` MIR pass that forcibly disabled
inlining if `-Zinstrument-coverage` was set. The default `mir_opt_level`
does not enable inlining anyway. But if the level is explicitly set and
is greater than 1, I issue a warning.

The new warnings show up in tests, which is much better for diagnosing
potential option conflicts in these cases.
2020-12-14 12:55:46 -08:00
Rich Kadel
4f550f1f93 Improve warnings on incompatible options involving -Zinstrument-coverage
Adds checks for:

* `no_core` attribute
* explicitly-enabled `legacy` symbol mangling
* mir_opt_level > 1 (which enables inlining)

I removed code from the `Inline` MIR pass that forcibly disabled
inlining if `-Zinstrument-coverage` was set. The default `mir_opt_level`
does not enable inlining anyway. But if the level is explicitly set and
is greater than 1, I issue a warning.

The new warnings show up in tests, which is much better for diagnosing
potential option conflicts in these cases.
2020-12-14 12:55:46 -08:00
Jack Huey
01c2520081 Add explanation for skip_binder in relate 2020-12-14 12:47:11 -05:00
bors
6c83e5684d Auto merge of - matthiaskrgr:bump_nightly, r=flip1995
bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14

This should hopefully fix incremental compilation ICEs in rustc that I have encountered multiple times while working with the previously pinned nightly.

changelog: none
2020-12-14 17:23:51 +00:00
Matthias Krüger
8b1e9ed85b bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14
This should hopefully fix incremental compilation ICEs from rustc that I have been encountering multiple times while working with the previous nightly.
2020-12-14 17:47:05 +01:00
bors
fa41639427 Auto merge of - fusion-engineering-forks:windows-parker, r=Amanieu
Add fast futex-based thread parker for Windows.

This adds a fast futex-based thread parker for Windows. It either uses WaitOnAddress+WakeByAddressSingle or NT Keyed Events (NtWaitForKeyedEvent+NtReleaseKeyedEvent), depending on which is available. Together, this makes this thread parker work for Windows XP and up. Before this change, park()/unpark() did not work on Windows XP: it needs condition variables, which only exist since Windows Vista.

---

Unfortunately, NT Keyed Events are an undocumented Windows API. However:
- This API is relatively simple with obvious behaviour, and there are several (unofficial) articles documenting the details. [1]
- parking_lot has been using this API for years (on Windows versions before Windows 8). [2] Many big projects extensively use parking_lot, such as servo and the Rust compiler itself.
- It is the underlying API used by Windows SRW locks and Windows critical sections. [3] [4]
- The source code of the implementations of Wine, ReactOs, and Windows XP are available and match the expected behaviour.
- The main risk with an undocumented API is that it might change in the future. But since we only use it for older versions of Windows, that's not a problem.
- Even if these functions do not block or wake as we expect (which is unlikely, see all previous points), this implementation would still be memory safe. The NT Keyed Events API is only used to sleep/block in the right place.

[1]\: http://www.locklessinc.com/articles/keyed_events/
[2]\: https://github.com/Amanieu/parking_lot/commit/43abbc964e
[3]\: https://docs.microsoft.com/en-us/archive/msdn-magazine/2012/november/windows-with-c-the-evolution-of-synchronization-in-windows-and-c
[4]\: Windows Internals, Part 1, ISBN 9780735671300

---

The choice of fallback API is inspired by parking_lot(_core), but the implementation of this thread parker is different. While parking_lot has no use for a fast path (park() directly returning if unpark() was already called), this implementation has a fast path that returns without even checking which waiting/waking API to use, as the same atomic variable with compatible states is used in all cases.
2020-12-14 16:41:14 +00:00
Yuki Okushi
357565dc19 expand-yaml-anchors: Make the output directory separator-insensitive 2020-12-14 23:33:20 +09:00
Yuki Okushi
becd0e8896 Replace some println! with tidy_error! to simplify 2020-12-14 23:10:15 +09:00
bors
1f7762b4fc Auto merge of - GuillaumeGomez:rollup-rqd46ko, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 -  (doc(array,vec): add notes about side effects when empty-initializing)
 -  (Fix item name display on mobile)
 -  (Refactor test_lang_string_parse to make it clearer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-12-14 13:45:38 +00:00
Guillaume Gomez
2169094ab8
Rollup merge of - poliorcetics:rustdoc-test-refactor, r=jyn514
Refactor test_lang_string_parse to make it clearer

Follows https://github.com/rust-lang/rust/pull/79454#discussion_r540190949

A small PR made to refactor a test in rustdoc that was becoming unwieldy.

``@rustbot`` label T-rustdoc
r? ``@jyn514``
2020-12-14 14:43:47 +01:00
Guillaume Gomez
63e86a7f72
Rollup merge of - GuillaumeGomez:mobile-fix-item-name, r=Nemo157,jyn514
Fix item name display on mobile

Fixes https://github.com/rust-lang/docs.rs/issues/1200

![Screenshot_20201211-200931](https://user-images.githubusercontent.com/3050060/101944457-0c06eb00-3bed-11eb-8f63-a4d4fd3cbb56.jpg)
![Screenshot_20201211-195846](https://user-images.githubusercontent.com/3050060/101944459-0d381800-3bed-11eb-91ff-815a2af7ca72.jpg)

cc `@jyn514`

r? `@Nemo157`
2020-12-14 14:43:45 +01:00
Guillaume Gomez
5d8b2a5bf1
Rollup merge of - woodruffw-forks:ww/doc-initializer-side-effects, r=dtolnay
doc(array,vec): add notes about side effects when empty-initializing

Copying some context from a conversation in the Rust discord:

* Both `vec![T; 0]` and `[T; 0]` are syntactically valid, and produce empty containers of their respective types

* Both *also* have side effects:

```rust
fn side_effect() -> String {
    println!("side effect!");

    "foo".into()
}

fn main() {
    println!("before!");

    let x = vec![side_effect(); 0];

    let y = [side_effect(); 0];

    println!("{:?}, {:?}", x, y);
}
```

produces:

```
before!
side effect!
side effect!
[], []
```

This PR just adds two small notes to each's documentation, warning users that side effects can occur.

I've also submitted a clippy proposal: https://github.com/rust-lang/rust-clippy/issues/6439
2020-12-14 14:43:44 +01:00
bjorn3
44b331047d Also emit vcode when emitting clif ir while using new style backends 2020-12-14 12:54:18 +01:00
Stein Somers
6c7835e441 BTreeSet: simplify implementation of pop_first/pop_last 2020-12-14 11:25:34 +01:00
Dániel Buga
fa64c272c8 Add test case for Self:: links 2020-12-14 11:00:54 +01:00
Dániel Buga
cc31b992b1 Review suggestions 2020-12-14 11:00:53 +01:00
Dániel Buga
850437b6f9 Cache link resolution results in current module
Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2020-12-14 11:00:53 +01:00
bors
3c45bff23d Auto merge of - JohnTitor:tidy-entries, r=petrochenkov
Check the number of entries in UI test on tidy

This helps  to be resolved.

r? `@petrochenkov`
2020-12-14 09:25:00 +00:00
bors
331e74014a Auto merge of - sivadeilra:syms_proc_macro_testing, r=petrochenkov
Improve error handling in `symbols` proc-macro

This improves how the `symbols` proc-macro handles errors.
If it finds an error in its input, the macro does not panic.
Instead, it still produces an output token stream. That token
stream will contain `compile_error!(...)` macro invocations.
This will still cause compilation to fail (which is what we want),
but it will prevent meaningless errors caused by the output not
containing symbols that the macro normally generates.

This solves a small (but annoying) problem. When you're editing
rustc_span/src/symbol.rs, and you get something wrong (dup
symbol name, misordered symbol), you want to get only the errors
that are relevant, not a burst of errors that are irrelevant.
This change also uses the correct Span when reporting errors,
so you get errors that point to the correct place in
rustc_span/src/symbol.rs where something is wrong.

This also adds several unit tests which test the `symbols` proc-macro.

This commit also makes it easy to run the `symbols` proc-macro
as an ordinary Cargo test. Just run `cargo test`. This makes it
easier to do development on the macro itself, such as running it
under a debugger.

This commit also uses the `Punctuated` type in `syn` for parsing
comma-separated lists, rather than doing it manually.

The output of the macro is not changed at all by this commit,
so rustc should be completely unchanged. This just improves
quality of life during development.
2020-12-14 07:03:52 +00:00
bors
5b038341fb Auto merge of - giraffate:update_contributing_md, r=llogiq
Fix links in CONTRIBUTING.md

Links is broken.

<img width="1219" alt="スクリーンショット 2020-12-14 11 58 19" src="https://user-images.githubusercontent.com/17407489/102035564-fc152400-3e03-11eb-91a7-6c04e120d72f.png">

changelog: none
2020-12-14 06:13:44 +00:00
Takayuki Nakata
426aba2ef4 Fix links in CONTRIBUTING.md 2020-12-14 11:57:35 +09:00
Yuki Okushi
adda964bb5 Check the number of entries in UI test 2020-12-14 09:59:12 +09:00
bors
7feab000b2 Auto merge of - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BTreeMap: declare clear_parent_link directly on the root it needs

r? `@Mark-Simulacrum`
2020-12-13 22:13:02 +00:00
Arlie Davis
1a5b9b037e ./x.py fmt 2020-12-13 13:36:01 -08:00
bors
d9241640e8 Auto merge of - xFrednet:5552-false-positive-match-single-binding, r=ebroto
Fixing a false positive for the `match_single_binding` lint 

This is a fix for a false positive in the `match_single_binding` lint when using `#[cfg()]` on a branch. It is sadly a bit hacky but maybe the best solution as rust removes the other branch from the AST before we can even validate it. This fix looks at the code snippet itself and returns if it includes another thick arrow `=>` besides the one matching arm we found. This can again cause false negatives if someone has the following code:
```rust
match x {
    // => <-- Causes a false negative
    _ => 1,
}
```

I thought about making the code more complex and maybe validating against other things like the `#[cfg()]` macro but I believe that this is the best solution. This has basically switched the issue from a false positive to a false negative in a very specific case.

I'm happy to make some changes if you have any suggestions 🙃.

---
Fixes 

changelog: Fixed a false positive in the `match_single_binding` lint with `#[cfg()]` macro
2020-12-13 21:28:38 +00:00
xFrednet
a37af06fea Removing false positive for the match_single_binding lint
* Applying suggested changes from the PR
2020-12-13 20:49:39 +00:00
Joshua Nelson
4c1addfcb7 Use imports instead of rewriting the type signature of stable
This was an adventure; see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/'higher.20ranked.20subtype.20error'
2020-12-13 15:13:41 -05:00
bors
803c60218f Auto merge of - Aaron1011:fix/capture-broken-token, r=petrochenkov
Properly capture trailing 'unglued' token

If we try to capture the `Vec<u8>` in `Option<Vec<u8>>`, we'll
need to capture a `>` token which was 'unglued' from a `>>` token.
The processing of unglueing a token for parsing purposes bypasses the
usual capturing infrastructure, so we currently lose the trailing `>`.
As a result, we fall back to the reparsed `TokenStream`, causing us to
lose spans.

This commit makes token capturing keep track of a trailing 'unglued'
token. Note that we don't need to care about unglueing except at the end
of the captured tokens - if we capture both the first and second unglued
tokens, then we'll end up capturing the full 'glued' token, which
already works correctly.
2020-12-13 19:31:06 +00:00
bors
a642b42a46 Auto merge of - matthiaskrgr:dont_format_local_repo, r=ebroto
cargo dev fmt: don't format entire rustc repo if we ran ra_setup previously

It turns out that rustfmt sees a rustc repo that we pulled in as path dependency via `cargo dev ra-setup` as part of the tree and would try to format it :D

Of course we don't want this, so skip formatting if we see that we ran `ra-setup` previously.

changelog: none
2020-12-13 18:07:57 +00:00
Matthias Krüger
27dc565d28 cargo dev: rename ra-setup to ra_setup to be in line with the other commands 2020-12-13 18:52:46 +01:00
Matthias Krüger
91fa25c9de clippy dev fmt: don't format if we have a local rustc repo enabled as path dependency via cargo dev ra-setup.
rustfmt would try to format the entire rustc repo, probably because it sees it as a local dependency.
2020-12-13 18:52:44 +01:00
Matthias Krüger
404c50f562 NFC: clippy cargo dev: move generation of clap config into a function 2020-12-13 18:52:24 +01:00
bors
69ff39ee32 Auto merge of - ssomers:btree_cleanup_4, r=Mark-Simulacrum
BTreeMap: detect bulk_steal's count-1 underflow in release builds too

r? `@Mark-Simulacrum`
2020-12-13 17:09:41 +00:00
bors
6b2b3576eb Auto merge of - matthiaskrgr:needless_borrow_ty, r=ebroto
needless_borrow: print the type in the lint message

changelog: needless_borrow: print type in lint message
2020-12-13 16:59:02 +00:00
Alexis Bourget
ec0f1d70c9 Refactor test_lang_string_parse to make it clearer 2020-12-13 17:47:46 +01:00
bors
1df2e38219 Auto merge of - matthiaskrgr:clone_on_copy_type, r=ebroto
clone_on_copy: show the type in the lint message

changelog: clone_on_copy: show the type in the lint message
2020-12-13 16:47:33 +00:00
bors
684f17e565 Auto merge of - ebroto:use_rustflags, r=flip1995
Pass Clippy args also trough RUSTFLAGS

This removes a hack (\_\_CLIPPY_HACKERY\_\_) to add another one :)

It allows this workflow to work:
```terminal
cargo clippy                             # warning: empty `loop {}` wastes CPU cycles
cargo clippy -- -A clippy::empty_loop    # no warnings emitted
```

Before this change the new flag was not taken into consideration in cargo's fingerprint and the warning was emitted again. I guess that ideally we could add a specific env var for compiler wrapper arguments, but in the meantime this should do the job.

changelog: Pass clippy arguments through RUSTFLAGS so that changing them will trigger a rebuild

r? `@flip1995`
cc `@ehuss` (I think this may count as another step towards stabilizing `RUSTC_WORKSPACE_WRAPPER` 😄)

Fixes  and avoids frustration for users unfamiliar with the issue
2020-12-13 16:37:31 +00:00
Eduardo Broto
f93d9654d2 Address comments from PR review
Also: enable tests for cargo-clippy
2020-12-13 17:21:53 +01:00
Eduardo Broto
cc9695543e Pass Clippy args also trough RUSTFLAGS 2020-12-13 15:43:20 +01:00
bors
cbab347e68 Auto merge of - ssomers:btree_choose_parent_kv, r=Mark-Simulacrum
BTreeMap: clarify comments and panics around choose_parent_kv

Fixes a lie in recent code: `unreachable!("empty non-root node")` should shout "empty internal node", but it might as well be good and keep quiet

r? `@Mark-Simulacrum`
2020-12-13 14:42:37 +00:00
Matthias Krüger
cd2a62cb0c needless_borrow: print the type in the lint message
changelog: needless_borrow: print type in lint message
2020-12-13 15:29:18 +01:00
Justus K
09d528ec15
fix typo 2020-12-13 15:18:38 +01:00
EFanZh
7662626f77
Fix cargo-binutils link 2020-12-13 19:23:16 +08:00