Commit Graph

129486 Commits

Author SHA1 Message Date
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
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
bors c38f001db5 Auto merge of #77743 - bugadani:idl-cleanup, r=bugadani
Clean up in intra-doc link collector

This PR makes the following changes in intra-doc links:
 - clean up hard to follow closure-based logic in `check_full_res`
 - fix a FIXME comment by figuring out that `true` and `false` need to be resolved separately
 - refactor path resolution by extracting common code to a helper method and trying to reduce the number of unnecessary early returns
 - primitive types are now defined by their symbols, not their name strings
 - re-enables a commented-out test case

Closes #77267 (cc `@Stupremee)`

r? `@jyn514`
2020-10-11 09:50:19 +00:00
bors c6bebc14a1 Auto merge of #77769 - camelid:regression-untriaged, r=jyn514
Auto-prioritize issues with `regression-untriaged`

This auto-prioritizes issues with the `regression-untriaged` label. (I just added it per <https://github.com/rust-lang/rust/pull/77725#discussion_r502135703>.)

Cc #77725

r? `@Mark-Simulacrum`
2020-10-11 07:55:20 +00:00
Aman Arora 3c46fd67f8 traits diagnostics: Don't print closure/generator upvar_tys tuple
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-10-11 03:33:27 -04:00
Aman Arora 08d1ab0bf1 Always return tupled_upvar_tys for Closure/Generator consituent tys
Depending on if upvar_tys inferred or not, we were returning either an
inference variable which later resolves to a tuple or else the upvar tys
themselves

Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-10-11 03:32:35 -04:00
Roxane dc183702da Replace tuple of infer vars for upvar_tys with single infer var
This commit allows us to decide the number of captures required after
completing capture ananysis, which is required as part of implementing
RFC-2229.

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com>
2020-10-11 03:32:35 -04:00
bors fb27a7db50 Auto merge of #77565 - khyperia:codegen-backend-dep, r=ecstatic-morse
Add -Z codegen-backend dylib to deps

When the codegen-backend dylib changes, the program should be rebuilt.

---

Unfortunately I was unable to test this works locally due to running into a TLS issue when running the custom backend, `thread 'rustc' panicked at 'no ImplicitCtxt stored in tls', compiler/rustc_middle/src/ty/context.rs:1750:54`, which seems similar to https://github.com/rust-lang/rust/issues/62717 but has a completely different cause and backtrace.

`@eddyb` said to ping `@Mark-Simulacrum` about what they think about this, so, ping!
2020-10-11 06:03:23 +00:00
bors 9a8ca69602 Auto merge of #77774 - petrochenkov:floatuple, r=estebank
rustc_parse: More precise spans for `tuple.0.0`

This should help with https://github.com/rust-lang/rustfmt/issues/4355, but I haven't verified, cc `@calebcartwright.`
2020-10-11 03:54:26 +00:00
bors 25d2d09da7 Auto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper
Replace run_compiler with RunCompiler builder pattern

Fixes #77286. Replaces rustc_driver:run_compiler with RunCompiler builder pattern.
2020-10-11 01:26:06 +00:00
Nicholas-Baron 21751fa93b Moved the main `impl` for FnCtxt to its own file.
This is a solution to the file length being over 3000, something Clippy has a problem with.

The other solution to the file length is
1. to change the API of this struct by
2. encapulating certain fields of the struct into other structs.
2020-10-10 17:45:17 -07:00
Tomasz Miąsko 50da126557 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-11 00:00:00 +00:00
Vadim Petrochenkov dee704930d rustc_parse: More precise spans for `tuple.0.0` 2020-10-11 02:33:49 +03:00
bors 08764ad163 Auto merge of #77087 - estebank:issue-45817, r=matthewjasper
Provide structured suggestions when finding structs when expecting a trait

When finding an ADT in a trait object definition provide some solutions. Fix #45817.
Given `<Param as Trait>::Assoc: Ty` suggest `Param: Trait<Assoc = Ty>`. Fix #75829.
2020-10-10 23:27:28 +00:00
Jonas Schievink 9a47f74bfe Use SmallVec in SwitchTargets
This allows building common SwitchTargets (eg. for `if`s) without
allocation.
2020-10-11 01:14:12 +02:00
bors b1af43bc63 Auto merge of #76934 - camelid:rustdoc-allow-generic-params, r=jyn514
Allow generic parameters in intra-doc links

Fixes #62834.

---

The contents of the generics will be mostly ignored (except for warning
if fully-qualified syntax is used, which is currently unsupported in
intra-doc links - see issue #74563).

* Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>`
* Allow links like `Vec::<T>::new()`
* Warn on
  * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`)
  * Missing type to apply generics to (`<T>` or `<Box<T>>`)
  * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`)
  * Invalid path separator (`Vec:<T>:new`)
  * Too many angle brackets (`Vec<<T>>`)
  * Empty angle brackets (`Vec<>`)

Note that this implementation *does* allow some constructs that aren't
valid in the actual Rust syntax, for example `Box::<T>new()`. That may
not be supported in rustdoc in the future; it is an implementation
detail.
2020-10-10 21:19:50 +00:00
Dániel Buga 0a2a68edae Use range instead of tuple of ints 2020-10-10 22:33:22 +02:00
Camelid e2424a2c1f Fix query docs
They were not formatted correctly, so rustdoc was interpreting some
parts as code. Also cleaned up some other query docs that weren't
causing issues, but were formatted incorrectly.
2020-10-10 12:49:31 -07:00
bors 790d19cd25 Auto merge of #77798 - JohnTitor:rollup-82u711m, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #77195 (Link to documentation-specific guidelines.)
 - #77629 (Cleanup of `eat_while()` in lexer)
 - #77709 (Link Vec leak doc to Box)
 - #77738 (fix __rust_alloc_error_handler comment)
 - #77748 (Dead code cleanup in windows-gnu std)
 - #77754 (Add TraitDef::find_map_relevant_impl)
 - #77766 (Clarify the debug-related values should take boolean)
 - #77777 (doc: disambiguate stat in MetadataExt::as_raw_stat)
 - #77782 (Fix typo in error code description)
 - #77787 (Update `changelog-seen` in config.toml.example)

Failed merges:

r? `@ghost`
2020-10-10 19:26:13 +00:00
Yuki Okushi c98b3e86c0
Rollup merge of #77787 - jyn514:consistent-versions, r=spastorino
Update `changelog-seen` in config.toml.example

This got out of sync when the version was bumped last time in #77133

Long-term we may want to find an easier way to maintain this that
doesn't require bumping the version in three different places. Off the
top of my head I can't think of anything, though. It _is_ documented in src/bootstrap/README.md, although I don't know how many people read that.

r? @Mark-Simulacrum
cc @spastorino
2020-10-11 03:19:21 +09:00
Yuki Okushi 612fe9fe78
Rollup merge of #77782 - nhayama:fix-typo, r=jonas-schievink
Fix typo in error code description

s/abitrary/arbitrary/
2020-10-11 03:19:19 +09:00
Yuki Okushi 82c538c619
Rollup merge of #77777 - cuviper:doc-stat, r=jonas-schievink
doc: disambiguate stat in MetadataExt::as_raw_stat

A few architectures in `os::linux::raw` import `libc::stat`, rather than
defining that type directly. However, that also imports the _function_
called `stat`, which makes this doc link ambiguous:

    error: `crate::os::linux::raw::stat` is both a struct and a function
      --> library/std/src/os/linux/fs.rs:21:19
       |
    21 |     /// [`stat`]: crate::os::linux::raw::stat
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous link
       |
       = note: `-D broken-intra-doc-links` implied by `-D warnings`
    help: to link to the struct, prefix with the item type
       |
    21 |     /// [`stat`]: struct@crate::os::linux::raw::stat
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    help: to link to the function, add parentheses
       |
    21 |     /// [`stat`]: crate::os::linux::raw::stat()
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We want the `struct`, so it's now prefixed accordingly.
2020-10-11 03:19:18 +09:00