Commit Graph

129700 Commits

Author SHA1 Message Date
Jacob Hughes
4b96049da2 BTreeMap: refactor Entry out of map.rs into its own file
btree/map.rs is approaching the 3000 line mark, splitting out the entry
code buys about 500 lines of headroom
2020-10-12 08:44:53 -04:00
Kornel
07637db883 Remove deprecated unstable Vec::resize_default 2020-10-12 13:36:19 +01:00
Guillaume Gomez
685444008b Extend test to ensure that items inherit lint level from the parent 2020-10-12 14:32:41 +02:00
Ethan Brierley
eec443681e
Make error help clearer
Co-authored-by: varkor <github@varkor.com>
2020-10-12 07:18:29 -05:00
bors
d6b5ffb5b4 Auto merge of #77821 - tmiasko:discriminant-value-is-safe, r=jonas-schievink
Remove unnecessary unsafe block around calls to discriminant_value

Since 63793 the discriminant_value intrinsic is safe to call. Remove
unnecessary unsafe block around calls to this intrinsic in built-in
derive macros.
2020-10-12 12:12:54 +00:00
Guillaume Gomez
5d20e1aa03 Improve lint level handling 2020-10-12 13:50:31 +02:00
Guillaume Gomez
22465b35a6 Apply same treatment to MISSING_DOC_CODE_EXAMPLES 2020-10-12 13:46:37 +02:00
Guillaume Gomez
b31f5d05b1 Inherit lint level from parents 2020-10-12 13:46:37 +02:00
Roman
02e6b861eb rustdoc: skip allow missing doc in cover. report
During the document coverage reporting with
```bash
rustdoc something.rs -Z unstable-options --show-coverage
```

the coverage report also includes parts of the code that are marked
with `#[allow(missing_docs)]`, which outputs lower numbers in the
coverage report even though these parts should be ignored for the
calculation.

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-12 13:46:37 +02:00
Igor Matuszewski
1852392120 Update RLS 2020-10-12 13:10:43 +02:00
bors
d9b931669b Auto merge of #75914 - arlosi:aarch64-ci, r=pietroalbini
Promote aarch64-pc-windows-msvc to Tier 2 Development Platform

Adds a GitHub Actions CI build for `aarch64-pc-windows-msvc` via cross-compilation on an x86_64 host.

This promotes `aarch64-pc-windows-msvc` from a Tier 2 Compilation Target (std) to a Tier 2 Development Platform (std+rustc+cargo+tools).

Fixes #72881

r? `@pietroalbini`
2020-10-12 10:17:48 +00:00
Guillaume Gomez
0faaa499cc Add test for compiler reexports removal 2020-10-12 11:26:01 +02:00
Guillaume Gomez
e3c3efe5ab Filter out imports added by the compiler 2020-10-12 11:26:01 +02:00
bjorn3
b620e49cca Remove dump_incremental_data 2020-10-12 10:34:30 +02:00
bors
a8d6da3f57 Auto merge of #77837 - Aaron1011:bump-miri-backtrace, r=RalfJung
Bump miri

Fixes https://github.com/rust-lang/rust/issues/77791

r? `@RalfJung`
2020-10-12 08:25:38 +00:00
bors
62cbe81b8a Auto merge of #75956 - jonas-schievink:lto-opt-sz, r=tmiasko
Fix -Clinker-plugin-lto with opt-levels s and z

Pass s and z as `-plugin-opt=O2` to the linker. This is what `-Os` and `-Oz` correspond to, apparently.

Fixes https://github.com/rust-lang/rust/issues/75940
2020-10-12 06:10:50 +00:00
bors
63962f0203 Auto merge of #77819 - mati865:crossbeam-ub, r=Mark-Simulacrum
Update crossbeam-channel to avoid UB

More info: https://github.com/RustSec/advisory-db/pull/425
2020-10-12 04:18:56 +00:00
James Gill
01ac5a97c9 Stabilize slice_select_nth_unstable
This stabilizes the functionality in slice_partition_at_index,
but under the names `select_nth_unstable*`.  The functions
`partition_at_index*` are left as deprecated, to be removed in
a later release.

Closes #55300
2020-10-12 00:07:41 -04:00
bors
1fe9b7f3fe Auto merge of #77790 - jyn514:undivided, r=ollie27
Show summary lines on cross-crate re-exports

See my write-up in https://github.com/rust-lang/rust/issues/77783#issuecomment-706551743 for what's going on here.

Fixes https://github.com/rust-lang/rust/issues/77783

r? `@ollie27`
2020-10-12 02:20:04 +00:00
Joshua Nelson
41878285e8 Remove unnecessary RefCell for doc_strings
This was there for `Divider` and is no longer necessary.
2020-10-11 20:31:00 -04:00
Nicholas-Baron
84878794ed Moved the functions starting with check to a separate file 2020-10-11 17:27:29 -07:00
Joshua Nelson
1772f2d2dc Show summary lines on cross-crate re-exports
This removes the unnecessary `DocFragmentKind::Divider` in favor of just
using the logic I actually want in `collapse_docs`.
2020-10-11 20:27:17 -04:00
Jonas Schievink
32cf035046 Use no-prefer-dynamic 2020-10-12 01:51:40 +02:00
Aaron Hill
5e34bddc1b
Bump miri 2020-10-11 19:45:15 -04:00
Jonas Schievink
4f5394199b Fix -Clinker-plugin-lto with opt-levels s and z 2020-10-12 01:45:00 +02:00
Nicholas-Baron
16d0205d5c Moved the functions starting with suggest to a separate file 2020-10-11 16:28:06 -07:00
bors
576e2277ac Auto merge of #75991 - shepmaster:silicon-ci, r=pietroalbini
Set up CI for aarch64-apple-darwin
2020-10-11 23:23:48 +00:00
Nicholas-Baron
48291cf1d7 Moved some short functions back into fn_ctxt.rs 2020-10-11 16:10:42 -07:00
Mateusz Mikuła
5aa661757a Update crossbeam-channel to avoid UB 2020-10-11 23:40:29 +02:00
bors
c71248b708 Auto merge of #76859 - Aaron1011:fix/llvm-cgu-reuse, r=davidtwco,nikic
Use llvm::computeLTOCacheKey to determine post-ThinLTO CGU reuse

During incremental ThinLTO compilation, we attempt to re-use the
optimized (post-ThinLTO) bitcode file for a module if it is 'safe' to do
so.

Up until now, 'safe' has meant that the set of modules that our current
modules imports from/exports to is unchanged from the previous
compilation session. See PR #67020 and PR #71131 for more details.

However, this turns out be insufficient to guarantee that it's safe
to reuse the post-LTO module (i.e. that optimizing the pre-LTO module
would produce the same result). When LLVM optimizes a module during
ThinLTO, it may look at other information from the 'module index', such
as whether a (non-imported!) global variable is used. If this
information changes between compilation runs, we may end up re-using an
optimized module that (for example) had dead-code elimination run on a
function that is now used by another module.

Fortunately, LLVM implements its own ThinLTO module cache, which is used
when ThinLTO is performed by a linker plugin (e.g. when clang is used to
compile a C proect). Using this cache directly would require extensive
refactoring of our code - but fortunately for us, LLVM provides a
function that does exactly what we need.

The function `llvm::computeLTOCacheKey` is used to compute a SHA-1 hash
from all data that might influence the result of ThinLTO on a module.
In addition to the module imports/exports that we manually track, it
also hashes information about global variables (e.g. their liveness)
which might be used during optimization. By using this function, we
shouldn't have to worry about new LLVM passes breaking our module re-use
behavior.

In LLVM, the output of this function forms part of the filename used to
store the post-ThinLTO module. To keep our current filename structure
intact, this PR just writes out the mapping 'CGU name -> Hash' to a
file. To determine if a post-LTO module should be reused, we compare
hashes from the previous session.

This should unblock PR #75199 - by sheer chance, it seems to have hit
this issue due to the particular CGU partitioning and optimization
decisions that end up getting made.
2020-10-11 20:50:02 +00:00
Winnie Xiao
d7494af551 Mostly print statements to see where things are
More print statementsstatements lol

Solved the basic case of eliminating check_version ifk_version if subcommand = setup

Finished v1

checking out old bootstrap.py

checked out old irrelevant files

fixed tidy

Moved VERSION from bin/main.rs to lib.rs

Fixed semicolon return issue

x.py fmt
2020-10-11 22:32:06 +02:00
LingMan
a56b0e96d0 Simplify using is_ascii_alphabetic and is_ascii_alphanumeric 2020-10-11 22:27:21 +02:00
LingMan
e533bb73bc Don't duplicate char::is_ascii_digit 2020-10-11 22:27:20 +02:00
George Burgess IV
ca5478a5df bootstrap: only use compiler-builtins-c if they exist
The assignment of `features` above was added in rust-lang#60981, but
never used. Presumably the intent was to replace the string literal here
with it.

While I'm in the area, `compiler_builtins_c_feature` doesn't need to be
a `String`.
2020-10-11 12:36:13 -07:00
Joshua Nelson
54bf8a681b Don't link to nightly primitives on stable channel
I am not sure how to test this.
2020-10-11 15:13:34 -04:00
bors
06a079c43e Auto merge of #77824 - Aaron1011:bump-backtrace-miri, r=RalfJung
Bump backtrace-rs

Fixes #77791

r? `@RalfJung`

cc `@alexcrichton`
2020-10-11 18:24:40 +00:00
Ethan Brierley
d7029cbd7e min_const_generics diagnostics improvements
2

3
2020-10-11 19:20:42 +01:00
Aaron Hill
44fdfd66ab
Bump backtrace-rs
Fixes #77791
2020-10-11 13:52:20 -04:00
Aaron Hill
9a6ea38647
Add hack to keep actix-web and actori-web compiling
This extends the existing `ident_name_compatibility_hack` to handle the
`tuple_from_req` macro defined in `actix-web` (and its fork
`actori-web`).
2020-10-11 13:20:26 -04:00
bors
8cc82ee340 Auto merge of #77793 - tmiasko:no-op-discriminant, r=ecstatic-morse
Recognize discriminant reads as no-ops in RemoveNoopLandingPads

The cleanup blocks often contain read of discriminants. Teach
RemoveNoopLandingPads to recognize them as no-ops to remove
additional no-op landing pads.
2020-10-11 16:33:47 +00:00
Aaron Hill
477ce31d37
Remove unused import 2020-10-11 12:09:48 -04:00
Aaron Hill
820953819c
Add relaxed_delim_match parameter 2020-10-11 12:09:48 -04:00
Aaron Hill
ea468f4270
Allow skipping extra paren insertion during AST pretty-printing
Fixes #74616
Makes progress towards #43081
Unblocks PR #76130

When pretty-printing an AST node, we may insert additional parenthesis
to ensure that precedence is properly preserved in code we output.
However, the proc macro implementation relies on comparing a
pretty-printed AST node to the captured `TokenStream`. Inserting extra
parenthesis changes the structure of the reparsed `TokenStream`, making
the comparison fail.

This PR refactors the AST pretty-printing code to allow skipping the
insertion of additional parenthesis. Several freestanding methods are
moved to trait methods on `PrintState`, which keep track of an internal
`insert_extra_parens` flag. This flag is normally `true`, but we expose
a public method which allows pretty-printing a nonterminal with
`insert_extra_parens = false`.

To avoid changing the public interface of `rustc_ast_pretty`, the
freestanding `_to_string` methods are changed to delegate to a
newly-crated `State`. The main pretty-printing code is moved to a new
`state` module to ensure that it does not accidentally call any of these
public helper functions (instead, the internal functions with the same
name should be used).
2020-10-11 12:09:48 -04:00
Aaron Hill
a20ae8901c
Move pprust code to a 'state' submodule 2020-10-11 12:09:48 -04:00
Joshua Nelson
83c790ffda Make some functions private that don't need to be public 2020-10-11 11:54:40 -04:00
Joshua Nelson
96b0446b53 Move PartialOrd impl out of rustc
Rustdoc's ordering requirements are probably not relevant to the rest of
the compiler.
2020-10-11 11:11:33 -04:00
Matthew Jasper
b8d2560dca Use tracing spans in rustc_trait_selection 2020-10-11 16:08:23 +01:00
bors
bc74dd711f Auto merge of #77727 - thomcc:mach-info-order, r=Amanieu
Avoid SeqCst or static mut in mach_timebase_info and QueryPerformanceFrequency caches

This patch went through a couple iterations but the end result is replacing a pattern where an `AtomicUsize` (updated with many SeqCst ops) guards a `static mut` with a single `AtomicU64` that is known to use 0 as a value indicating that it is not initialized.

The code in both places exists to cache values used in the conversion of Instants to Durations on macOS, iOS, and Windows.

I have no numbers to prove that this improves performance (It seems a little futile to benchmark something like this), but it's much simpler, safer, and in practice we'd expect it to be faster everywhere where Relaxed operations on AtomicU64 are cheaper than SeqCst operations on AtomicUsize, which is a lot of places.

Anyway, it also removes a bunch of unsafe code and greatly simplifies the logic, so IMO that alone would be worth it unless it was a regression.

If you want to take a look at the assembly output though, see https://godbolt.org/z/rbr6vn for x86_64, https://godbolt.org/z/cqcbqv for aarch64 (Note that this just the output of the mac side, but i'd expect the windows part to be the same and don't feel like doing another godbolt for it). There are several versions of this function in the godbolt:

- `info_new`: version in the current patch
- `info_less_new`: version in initial PR
- `info_original`: version currently in the tree
- `info_orig_but_better_orderings`: a version that just tries to change the original code's orderings from SeqCst to the (probably) minimal orderings required for soundness/correctness.

The biggest concern I have here is if we can use AtomicU64, or if there are targets that dont have it that this code supports. AFAICT: no. (If that changes in the future, it's easy enough to do something different for them)

r? `@Amanieu` because he caught a couple issues last time I tried to do a patch reducing orderings 😅

---

<details>
<summary>I rewrote this whole message so the original is inside here</summary>

I happened to notice the code we use for caching the result of mach_timebase_info uses SeqCst exclusively.

However, thinking a little more, it's actually pretty easy to avoid the static mut by packing the timebase info into an AtomicU64.

This entirely avoids needing to do the compare_exchange. The AtomicU64 can be read/written using Relaxed ops, which on current macos/ios platforms (x86_64/aarch64) have no overhead compared to direct loads/stores. This simplifies the code and makes it a lot safer too.

I have no numbers to prove that this improves performance (It seems a little futile to benchmark something like this), although it should do that on both targets it applies to.

That said, it also removes a bunch of unsafe code and simplifies the logic (arguably at least — there are only two states now, initialized or not), so I think it's a net win even without concrete numbers.

If you want to take a look at the assembly output though, see below. It has the new version, the original, and a version of the original with lower Orderings (which is still worse than the version in this PR)

- godbolt.org/z/obfqf9 x86_64-apple-darwin

- godbolt.org/z/Wz5cWc aarch64-unknown-linux-gnu (godbolt can't do aarch64-apple-ios but that doesn't matter here)

A different (and more efficient) option than this would be to just use the AtomicU64 and use the knowledge that after initialization the denominator should be nonzero... That felt like it's relying on too many things I'm not confident in, so I didn't want to do that.
</details>
2020-10-11 14:06:04 +00:00
Joshua Nelson
85c0479e17 Remove unnecessary Clean impl 2020-10-11 10:04:18 -04:00
Joshua Nelson
cc0d140bae Switch rustdoc from clean::Stability to rustc_attr::Stability
This gives greater type safety and is less work to maintain on the
rustdoc end.
2020-10-11 10:04:17 -04:00