]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRemove unused import
Aaron Hill [Tue, 29 Sep 2020 04:31:13 +0000 (00:31 -0400)]
Remove unused import

3 years agoAdd `relaxed_delim_match` parameter
Aaron Hill [Sat, 26 Sep 2020 17:12:49 +0000 (13:12 -0400)]
Add `relaxed_delim_match` parameter

3 years agoAllow skipping extra paren insertion during AST pretty-printing
Aaron Hill [Sat, 26 Sep 2020 16:51:00 +0000 (12:51 -0400)]
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).

3 years agoMove pprust code to a 'state' submodule
Aaron Hill [Sat, 26 Sep 2020 16:41:53 +0000 (12:41 -0400)]
Move pprust code to a 'state' submodule

3 years agoAuto merge of #77727 - thomcc:mach-info-order, r=Amanieu
bors [Sun, 11 Oct 2020 14:06:04 +0000 (14:06 +0000)]
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>

3 years agoAuto merge of #77743 - bugadani:idl-cleanup, r=bugadani
bors [Sun, 11 Oct 2020 09:50:19 +0000 (09:50 +0000)]
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`

3 years agoAuto merge of #77769 - camelid:regression-untriaged, r=jyn514
bors [Sun, 11 Oct 2020 07:55:20 +0000 (07:55 +0000)]
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`

3 years agoAuto merge of #77565 - khyperia:codegen-backend-dep, r=ecstatic-morse
bors [Sun, 11 Oct 2020 06:03:23 +0000 (06:03 +0000)]
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!

3 years agoAuto merge of #77774 - petrochenkov:floatuple, r=estebank
bors [Sun, 11 Oct 2020 03:54:26 +0000 (03:54 +0000)]
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.`

3 years agoAuto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper
bors [Sun, 11 Oct 2020 01:26:06 +0000 (01:26 +0000)]
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.

3 years agorustc_parse: More precise spans for `tuple.0.0`
Vadim Petrochenkov [Fri, 9 Oct 2020 23:01:44 +0000 (02:01 +0300)]
rustc_parse: More precise spans for `tuple.0.0`

3 years agoAuto merge of #77087 - estebank:issue-45817, r=matthewjasper
bors [Sat, 10 Oct 2020 23:27:28 +0000 (23:27 +0000)]
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.

3 years agoAuto merge of #76934 - camelid:rustdoc-allow-generic-params, r=jyn514
bors [Sat, 10 Oct 2020 21:19:50 +0000 (21:19 +0000)]
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.

3 years agoFix query docs
Camelid [Sat, 10 Oct 2020 19:49:31 +0000 (12:49 -0700)]
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.

3 years agoAuto merge of #77798 - JohnTitor:rollup-82u711m, r=JohnTitor
bors [Sat, 10 Oct 2020 19:26:13 +0000 (19:26 +0000)]
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`

3 years agoRollup merge of #77787 - jyn514:consistent-versions, r=spastorino
Yuki Okushi [Sat, 10 Oct 2020 18:19:21 +0000 (03:19 +0900)]
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

3 years agoRollup merge of #77782 - nhayama:fix-typo, r=jonas-schievink
Yuki Okushi [Sat, 10 Oct 2020 18:19:19 +0000 (03:19 +0900)]
Rollup merge of #77782 - nhayama:fix-typo, r=jonas-schievink

Fix typo in error code description

s/abitrary/arbitrary/

3 years agoRollup merge of #77777 - cuviper:doc-stat, r=jonas-schievink
Yuki Okushi [Sat, 10 Oct 2020 18:19:18 +0000 (03:19 +0900)]
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.

3 years agoRollup merge of #77766 - JohnTitor:fix-debug-config, r=jyn514
Yuki Okushi [Sat, 10 Oct 2020 18:19:16 +0000 (03:19 +0900)]
Rollup merge of #77766 - JohnTitor:fix-debug-config, r=jyn514

Clarify the debug-related values should take boolean

#76588 tweaked their placeholders but these values should take boolean and the current placeholders are confusing, at least for me.

3 years agoRollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasper
Yuki Okushi [Sat, 10 Oct 2020 18:19:14 +0000 (03:19 +0900)]
Rollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasper

Add TraitDef::find_map_relevant_impl

This PR adds a method to `TraitDef`. While `for_each_relevant_impl` covers the general use case, sometimes it's not necessary to scan through all the relevant implementations, so this PR introduces a new method, `find_map_relevant_impl`. I've also replaced the `for_each_relevant_impl` calls where possible.

I'm hoping for a tiny bit of efficiency gain here and there.

3 years agoRollup merge of #77748 - mati865:dead-code-cleanup, r=petrochenkov
Yuki Okushi [Sat, 10 Oct 2020 18:19:12 +0000 (03:19 +0900)]
Rollup merge of #77748 - mati865:dead-code-cleanup, r=petrochenkov

Dead code cleanup in windows-gnu std

Closes https://github.com/rust-lang/rust/issues/77622

This is the only leftover I could find.

3 years agoRollup merge of #77738 - RalfJung:alloc-error-handler-comment, r=Amanieu
Yuki Okushi [Sat, 10 Oct 2020 18:19:10 +0000 (03:19 +0900)]
Rollup merge of #77738 - RalfJung:alloc-error-handler-comment, r=Amanieu

fix __rust_alloc_error_handler comment

`__rust_alloc_error_handler` was added in the same `extern` block as the allocator functions, but the comment there was not actually correct for `__rust_alloc_error_handler`. So move it down to the rest of the default allocator handling with a fixed comment. At least the comment reflects my understanding of what happens, please check carefully. :)

r? @Amanieu Cc @haraldh

3 years agoRollup merge of #77709 - pickfire:patch-1, r=jyn514
Yuki Okushi [Sat, 10 Oct 2020 18:19:09 +0000 (03:19 +0900)]
Rollup merge of #77709 - pickfire:patch-1, r=jyn514

Link Vec leak doc to Box

3 years agoRollup merge of #77629 - Julian-Wollersberger:recomputeRawStrError, r=varkor
Yuki Okushi [Sat, 10 Oct 2020 18:19:07 +0000 (03:19 +0900)]
Rollup merge of #77629 - Julian-Wollersberger:recomputeRawStrError, r=varkor

Cleanup of `eat_while()` in lexer

The size of a lexer Token was inflated by the largest `TokenKind` variants `LiteralKind::RawStr` and `RawByteStr`, because
* it used `usize` although `u32` is sufficient in rustc, since crates must be smaller than 4GB,
* and it stored the 20 bytes big `RawStrError` enum for error reporting.

If a raw string is invalid, it now needs to be reparsed to get the `RawStrError` data, but that is a very cold code path.

Technically this breaks other tools that depend on rustc_lexer because they are now also restricted to a max file size of 4GB. But this shouldn't matter in practice, and rustc_lexer isn't stable anyway.

Can I also get a perf run?

Edit: This makes no difference in performance. The PR now only contains a small cleanup.

3 years agoRollup merge of #77195 - follower:patch-2, r=jyn514
Yuki Okushi [Sat, 10 Oct 2020 18:19:05 +0000 (03:19 +0900)]
Rollup merge of #77195 - follower:patch-2, r=jyn514

Link to documentation-specific guidelines.

Changed contribution information URL because it's not obvious how to get from the current URL to the documentation-specific content.

The current URL points to this "Getting Started" page, which contains nothing specific about documentation[*] and instead launches into how to *build* `rustc` which is not a strict prerequisite for contributing documentation fixes:

 * https://rustc-dev-guide.rust-lang.org/getting-started.html

[*] The most specific content is a "Writing documentation" bullet point which is not itself a link to anything (I guess a patch for that might be helpful too).

### Why?

Making this change will make it easier for people who wish to make small "drive by" documentation fixes (and read contribution guidelines ;) ) which I find are often how I start contributing to a project. (Exhibit A: https://github.com/rust-lang/rust/pull/77050 :) )

### Background

My impression is the change of content linked is an unintentional change due to a couple of other changes:

 * Originally, the link pointed to  `contributing.md` which started with a "table of contents" linking to each section. But the content in `contributing.md` was removed and replaced with a link to the "Getting Started" section here:

    * https://github.com/rust-lang/rust/commit/3f6928f1f6eff367e6ddbfb63ebc5e568ffe0eb1#diff-6a3371457528722a734f3c51d9238c13L1

   But the changed link doesn't actually point to the equivalent content, which is now located here:

    * https://rustc-dev-guide.rust-lang.org/contributing.html

   (If the "Guide to Rustc Development" is now considered the canonical location of "How to Contribute" content it might be a good idea to merge some of the "Contributing" Introduction section into the "Getting Started" section.)

 * This was then compounded by changing the link from `contributing.md` to  `contributing.html` here:

     * https://github.com/rust-lang/rust/pull/74037/files#diff-242481015141f373dcb178e93cffa850L88

    In order to even find the new location of the previous `contributing.md` content I ended up needing to do a GitHub search of the `rust-lang` org for the phrase "Documentation improvements are very welcome". :D

3 years agoAuto merge of #77337 - lzutao:asm-mips64, r=Amanieu
bors [Sat, 10 Oct 2020 17:32:28 +0000 (17:32 +0000)]
Auto merge of #77337 - lzutao:asm-mips64, r=Amanieu

Add asm! support for mips64

- [x] Updated `src/doc/unstable-book/src/library-features/asm.md`.
- [ ] No vector type support. I don't know much about those types.

cc #76839

3 years agoAuto merge of #77771 - nagisa:revert-77023, r=Mark-Simulacrum
bors [Sat, 10 Oct 2020 15:17:01 +0000 (15:17 +0000)]
Auto merge of #77771 - nagisa:revert-77023, r=Mark-Simulacrum

Revert "Assume slice len is bounded by allocation size"

https://github.com/rust-lang/rust/pull/77023#issuecomment-703987379
suggests that the original PR introduced a significant perf regression.

This reverts commit e44784b8750016a695361c990024750e037d8f9f / #77023.

cc `@HeroicKatora`

3 years agoClarify the debug-related values should take boolean
Yuki Okushi [Fri, 9 Oct 2020 20:36:33 +0000 (05:36 +0900)]
Clarify the debug-related values should take boolean

They should take boolean values and the current placeholders are confusing, at least for me.

3 years agoImprove vec leak wording
Ivan Tham [Sat, 10 Oct 2020 14:17:48 +0000 (22:17 +0800)]
Improve vec leak wording

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoAlloc vec doc mention cannot undo leak
Ivan Tham [Sat, 10 Oct 2020 14:12:28 +0000 (22:12 +0800)]
Alloc vec doc mention cannot undo leak

3 years agoUpdate `changelog-seen` in config.toml.example
Joshua Nelson [Sat, 10 Oct 2020 14:08:36 +0000 (10:08 -0400)]
Update `changelog-seen` in config.toml.example

This got out of sync when the version was bumped last time.

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.

3 years agoRe-enable test case
Dániel Buga [Sat, 10 Oct 2020 08:20:10 +0000 (10:20 +0200)]
Re-enable test case

3 years agoApply suggestions from code review
Dániel Buga [Sat, 10 Oct 2020 07:30:10 +0000 (09:30 +0200)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRefactor path resolution and use Symbols instead of &str
Dániel Buga [Sat, 10 Oct 2020 00:13:34 +0000 (02:13 +0200)]
Refactor path resolution and use Symbols instead of &str

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoApply suggestions from code review
Dániel Buga [Fri, 9 Oct 2020 15:54:43 +0000 (17:54 +0200)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoClean up hard to follow control flow
Dániel Buga [Fri, 9 Oct 2020 10:04:44 +0000 (12:04 +0200)]
Clean up hard to follow control flow

3 years agoClean up check_full_res
Dániel Buga [Fri, 9 Oct 2020 09:16:57 +0000 (11:16 +0200)]
Clean up check_full_res

3 years agoAuto merge of #77731 - cuviper:big-endian-backtrace, r=alexcrichton
bors [Sat, 10 Oct 2020 12:51:15 +0000 (12:51 +0000)]
Auto merge of #77731 - cuviper:big-endian-backtrace, r=alexcrichton

Update the backtrace crate to fix big-endian ELF

Pulls in rust-lang/backtrace-rs#373.
Fixes #77410.

r? `@alexcrichton`

3 years agoAuto merge of #77717 - tmiasko:posix-spawn-error-check, r=cuviper
bors [Sat, 10 Oct 2020 10:59:20 +0000 (10:59 +0000)]
Auto merge of #77717 - tmiasko:posix-spawn-error-check, r=cuviper

Fix error checking in posix_spawn implementation of Command

* Check for errors returned from posix_spawn*_init functions
* Check for non-zero return value from posix_spawn functions

3 years agoAuto merge of #77580 - petrochenkov:norestarg, r=matthewjasper
bors [Sat, 10 Oct 2020 09:07:35 +0000 (09:07 +0000)]
Auto merge of #77580 - petrochenkov:norestarg, r=matthewjasper

rustc_target: Refactor away `TargetResult`

Follow-up to https://github.com/rust-lang/rust/pull/77202.

Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary.

The second commit contains some further cleanup based on built-in target construction being infallible.

3 years agoFix typo in error code description
Naoki Hayama [Sat, 10 Oct 2020 09:02:53 +0000 (18:02 +0900)]
Fix typo in error code description

s/abitrary/arbitrary/

3 years agoAuto merge of #77336 - pietroalbini:pkgname, r=Mark-Simulacrum
bors [Sat, 10 Oct 2020 06:59:49 +0000 (06:59 +0000)]
Auto merge of #77336 - pietroalbini:pkgname, r=Mark-Simulacrum

Always use the Rust version in package names

The format of the tarballs produced by CI is roughly the following:

    {component}-{release}-{target}.{ext}

While on the beta and nightly channels `{release}` is just the channel name, on the stable channel is either the Rust version or the version of the component we're shipping:

    cargo-0.47.0-x86_64-unknown-linux-gnu.tar.xz
    clippy-0.0.212-x86_64-unknown-linux-gnu.tar.xz
    llvm-tools-1.46.0-x86_64-unknown-linux-gnu.tar.xz
    miri-0.1.0-x86_64-unknown-linux-gnu.tar.xz
    rls-1.41.0-x86_64-unknown-linux-gnu.tar.xz
    rust-1.46.0-x86_64-unknown-linux-gnu.tar.xz
    ...

This makes it really hard to get the package URL without having access to the manifest (and there is no manifest on ci-artifacts.rlo), as there is no consistent version number to use.

This PR addresses the problem by always using the Rust version number as `{release}` for the stable channel, regardless of the version number of the component we're shipping. I chose that instead of "stable" to avoid breaking the URL scheme *that* much.

Rustup should not be affected by this change, as it fetches the URLs from the manifest. Unfortunately we don't have a way to test other clients before making a stable release, as this change only affects the stable channel.

r? `@Mark-Simulacrum`

3 years agoaddress review comments
Esteban Küber [Fri, 9 Oct 2020 23:51:54 +0000 (16:51 -0700)]
address review comments

3 years agodoc: disambiguate stat in MetadataExt::as_raw_stat
Josh Stone [Sat, 10 Oct 2020 03:12:26 +0000 (20:12 -0700)]
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.

3 years agoMove `@has` checks closer to corresponding doc comments
Camelid [Fri, 9 Oct 2020 23:11:15 +0000 (16:11 -0700)]
Move `@has` checks closer to corresponding doc comments

3 years agoUse `next()` instead of `peek()` where possible
Camelid [Fri, 9 Oct 2020 23:08:15 +0000 (16:08 -0700)]
Use `next()` instead of `peek()` where possible

3 years agoLink to GitHub issue re macro resolution
Camelid [Fri, 9 Oct 2020 23:03:00 +0000 (16:03 -0700)]
Link to GitHub issue re macro resolution

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRevert "Assume slice len is bounded by allocation size"
Simonas Kazlauskas [Fri, 9 Oct 2020 21:25:28 +0000 (00:25 +0300)]
Revert "Assume slice len is bounded by allocation size"

https://github.com/rust-lang/rust/pull/77023#issuecomment-703987379
suggests that the original PR introduced a significant perf regression.

This reverts commit e44784b8750016a695361c990024750e037d8f9f / #77023.

3 years agoAdd docstring
Esteban Küber [Thu, 24 Sep 2020 06:20:49 +0000 (23:20 -0700)]
Add docstring

3 years agoGiven `<T as Trait>::A: Ty` suggest `T: Trait<A = Ty>`
Esteban Küber [Thu, 24 Sep 2020 06:01:17 +0000 (23:01 -0700)]
Given `<T as Trait>::A: Ty` suggest `T: Trait<A = Ty>`

Fix #75829

3 years agoSuggest removing bounds even when potential typo
Esteban Küber [Wed, 23 Sep 2020 02:25:27 +0000 (19:25 -0700)]
Suggest removing bounds even when potential typo

3 years agoTweak output and add test cases
Esteban Küber [Wed, 23 Sep 2020 02:19:33 +0000 (19:19 -0700)]
Tweak output and add test cases

3 years agoPoint out why a trait is expected on `Struct + 'lt`
Esteban Küber [Wed, 23 Sep 2020 00:35:03 +0000 (17:35 -0700)]
Point out why a trait is expected on `Struct + 'lt`

3 years agoAuto-prioritize issues with `regression-untriaged`
Camelid [Fri, 9 Oct 2020 21:10:44 +0000 (14:10 -0700)]
Auto-prioritize issues with `regression-untriaged`

3 years agoAuto merge of #77276 - GuillaumeGomez:reexported-item-lints, r=jyn514,ollie27
bors [Fri, 9 Oct 2020 21:01:51 +0000 (21:01 +0000)]
Auto merge of #77276 - GuillaumeGomez:reexported-item-lints, r=jyn514,ollie27

Warn on broken intra-doc links added to cross-crate re-exports

This emits `broken_intra_doc_links` for docs applied to pub use statements that point to external items and are inlined.
Does not address #77200 - any existing broken links from the original crate will not show warnings.

r? `@jyn514`

3 years agoAuto merge of #77674 - cuviper:direntry-diet, r=dtolnay
bors [Fri, 9 Oct 2020 19:06:45 +0000 (19:06 +0000)]
Auto merge of #77674 - cuviper:direntry-diet, r=dtolnay

unix/vxworks: make DirEntry slightly smaller

`DirEntry` contains a `ReadDir` handle, which used to just be a wrapper
on `Arc<InnerReadDir>`. Commit af75314ecdbc5 added `end_of_stream: bool`
which is not needed by `DirEntry`, but adds 8 bytes after padding. We
can let `DirEntry` have an `Arc<InnerReadDir>` directly to avoid that.

3 years agoDon't filter out imports added by the compiler for the moment
Guillaume Gomez [Mon, 5 Oct 2020 09:04:08 +0000 (11:04 +0200)]
Don't filter out imports added by the compiler for the moment

3 years agoRemove unneeded ImportItem on glob ones
Guillaume Gomez [Tue, 29 Sep 2020 18:23:02 +0000 (20:23 +0200)]
Remove unneeded ImportItem on glob ones

3 years agoSimplify included import items handling
Guillaume Gomez [Tue, 29 Sep 2020 15:04:40 +0000 (17:04 +0200)]
Simplify included import items handling

3 years agoAdd test to ensure that external items aren't lint-checked
Guillaume Gomez [Sun, 27 Sep 2020 22:19:31 +0000 (00:19 +0200)]
Add test to ensure that external items aren't lint-checked

3 years agoCorrectly handle "pub use" reexports
Guillaume Gomez [Sun, 27 Sep 2020 22:18:09 +0000 (00:18 +0200)]
Correctly handle "pub use" reexports

3 years agoAdd test for reexported items lints
Guillaume Gomez [Sun, 27 Sep 2020 19:22:39 +0000 (21:22 +0200)]
Add test for reexported items lints

3 years agoDon't remove export items so that we can run lints on them
Guillaume Gomez [Sun, 27 Sep 2020 19:22:11 +0000 (21:22 +0200)]
Don't remove export items so that we can run lints on them

3 years agosimplify the cfg in ReadDir construction
Josh Stone [Fri, 9 Oct 2020 17:54:50 +0000 (10:54 -0700)]
simplify the cfg in ReadDir construction

Co-authored-by: David Tolnay <dtolnay@gmail.com>
3 years agoAuto merge of #77747 - flip1995:clippyup, r=Manishearth
bors [Fri, 9 Oct 2020 17:14:39 +0000 (17:14 +0000)]
Auto merge of #77747 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update.

This includes a `Cargo.lock` update: 7ea42be

r? `@Manishearth`

3 years agoremove ReadDir.end_of_stream on targets that don't use it
Josh Stone [Fri, 9 Oct 2020 16:59:39 +0000 (09:59 -0700)]
remove ReadDir.end_of_stream on targets that don't use it

3 years agounix/vxworks: make DirEntry slightly smaller
Josh Stone [Wed, 7 Oct 2020 21:35:51 +0000 (14:35 -0700)]
unix/vxworks: make DirEntry slightly smaller

`DirEntry` contains a `ReadDir` handle, which used to just be a wrapper
on `Arc<InnerReadDir>`. Commit af75314ecdbc5 added `end_of_stream: bool`
which is not needed by `DirEntry`, but adds 8 bytes after padding. We
can let `DirEntry` have an `Arc<InnerReadDir>` directly to avoid that.

3 years agoRevert calculate_dtor signature change
Dániel Buga [Fri, 9 Oct 2020 15:18:57 +0000 (17:18 +0200)]
Revert calculate_dtor signature change

3 years agoAuto merge of #77609 - ortem:fix-lldb-commands, r=Mark-Simulacrum
bors [Fri, 9 Oct 2020 15:18:41 +0000 (15:18 +0000)]
Auto merge of #77609 - ortem:fix-lldb-commands, r=Mark-Simulacrum

Remove redundant backslashes from `lldb_commands`

3 years agoReimplement for_each_relevant_impl on top of find_map...
Dániel Buga [Fri, 9 Oct 2020 14:56:09 +0000 (16:56 +0200)]
Reimplement for_each_relevant_impl on top of find_map...

3 years agoAdd find_map_relevant_impl
Dániel Buga [Fri, 9 Oct 2020 13:28:32 +0000 (15:28 +0200)]
Add find_map_relevant_impl

3 years agobootstrap: always use the Rust version in package names
Pietro Albini [Tue, 29 Sep 2020 13:33:25 +0000 (15:33 +0200)]
bootstrap: always use the Rust version in package names

The format of the tarballs produced by CI is roughly the following:

    {component}-{release}-{target}.{ext}

While on the beta and nightly channels `{release}` is just the channel
name, on the stable channel is either the Rust version or the version of
the component we're shipping:

    cargo-0.47.0-x86_64-unknown-linux-gnu.tar.xz
    clippy-0.0.212-x86_64-unknown-linux-gnu.tar.xz
    llvm-tools-1.46.0-x86_64-unknown-linux-gnu.tar.xz
    miri-0.1.0-x86_64-unknown-linux-gnu.tar.xz
    rls-1.41.0-x86_64-unknown-linux-gnu.tar.xz
    rust-1.46.0-x86_64-unknown-linux-gnu.tar.xz
    ...

This makes it really hard to get the package URL without having access
to the manifest (and there is no manifest on ci-artifacts.rlo), as there
is no consistent version number to use.

This commit addresses the problem by always using the Rust version
number as `{release}` for the stable channel, regardless of the version
number of the component we're shipping. I chose that instead of "stable"
to avoid breaking the URL scheme *that* much.

Rustup should not be affected by this change, as it fetches the URLs
from the manifest. Unfortunately we don't have a way to test other
clients before making a stable release, as this change only affects the
stable channel.

3 years agoAuto merge of #77690 - est31:llvm_8_required, r=matthewjasper
bors [Fri, 9 Oct 2020 12:23:49 +0000 (12:23 +0000)]
Auto merge of #77690 - est31:llvm_8_required, r=matthewjasper

Simplify some code in rustc_llvm/build.rs now that LLVM 8 is required

LLVM 8 is required since 8506bb006040cf8e8cb004202706c81e62ddacee
so this is safe to do.

3 years agoRemove useless `all` in cfg
Mateusz Mikuła [Thu, 8 Oct 2020 19:54:59 +0000 (21:54 +0200)]
Remove useless `all` in cfg

3 years agoRemove some dead code in windows-gnu std
Mateusz Mikuła [Thu, 8 Oct 2020 19:54:33 +0000 (21:54 +0200)]
Remove some dead code in windows-gnu std

3 years agoUpdate Cargo.lock
flip1995 [Fri, 9 Oct 2020 10:46:26 +0000 (12:46 +0200)]
Update Cargo.lock

3 years agoMerge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup
flip1995 [Fri, 9 Oct 2020 10:45:29 +0000 (12:45 +0200)]
Merge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup

3 years agoAuto merge of #77698 - vandenheuvel:chalkup, r=jackh726
bors [Fri, 9 Oct 2020 10:32:52 +0000 (10:32 +0000)]
Auto merge of #77698 - vandenheuvel:chalkup, r=jackh726

Update chalk to 0.32.0

r? `@jackh726`

3 years agorename __default_lib_allocator -> __default_alloc_error_handler
Ralf Jung [Fri, 9 Oct 2020 09:39:28 +0000 (11:39 +0200)]
rename __default_lib_allocator -> __default_alloc_error_handler

3 years agoalso extend global allocator comment
Ralf Jung [Fri, 9 Oct 2020 09:31:54 +0000 (11:31 +0200)]
also extend global allocator comment

3 years agofix __rust_alloc_error_handler comment
Ralf Jung [Fri, 9 Oct 2020 09:17:08 +0000 (11:17 +0200)]
fix __rust_alloc_error_handler comment

3 years agoNoticed a potential bug in `eat_while()`: it doesn't account for number of UTF8 bytes.
Julian Wollersberger [Fri, 9 Oct 2020 09:12:54 +0000 (11:12 +0200)]
Noticed a potential bug in `eat_while()`: it doesn't account for number of UTF8 bytes.
Fixed it by inlining it in the two places where the count is used and simplified the logic there.

3 years agoAuto merge of #6136 - dtolnay:serve, r=flip1995
bors [Fri, 9 Oct 2020 08:58:19 +0000 (08:58 +0000)]
Auto merge of #6136 - dtolnay:serve, r=flip1995

Clippy dev subcommand to build and serve website

This PR adds `clippy dev serve` which will pop open a browser with a local rendered 'ALL the Clippy Lints' website, and re-render as you edit stuff.

---

changelog: none

3 years agoAuto merge of #77687 - est31:hash_shorter_path, r=davidtwco
bors [Fri, 9 Oct 2020 08:09:32 +0000 (08:09 +0000)]
Auto merge of #77687 - est31:hash_shorter_path, r=davidtwco

Use shorter path for std::hash::Hash

3 years agoAuto merge of #6115 - ebroto:changelog_1_48, r=flip1995
bors [Fri, 9 Oct 2020 08:09:23 +0000 (08:09 +0000)]
Auto merge of #6115 - ebroto:changelog_1_48, r=flip1995

Add changelog for 1.48 beta

[Rendered](https://github.com/ebroto/rust-clippy/blob/changelog_1_48/CHANGELOG.md)

I've not added the PRs fixing `same_item_push` because those were backported, namely:
* [#5908](https://github.com/rust-lang/rust-clippy/pull/5908)
* [#5997](https://github.com/rust-lang/rust-clippy/pull/5997)
* [#6016](https://github.com/rust-lang/rust-clippy/pull/6016)

The following PR was reverted, so I've ignored it too:
* [#5984](https://github.com/rust-lang/rust-clippy/pull/5984)

~~Also, I took the liberty of adding a "Thanks" section, naming all the contributors to this release. I think they deserve visibility in the changelog. Please tell me if we want to add this or maybe it's redundant given we link to the PRs?~~

changelog: none

r? `@flip1995`

3 years agoAuto merge of #6145 - flip1995:backport_remerge, r=flip1995
bors [Fri, 9 Oct 2020 06:53:55 +0000 (06:53 +0000)]
Auto merge of #6145 - flip1995:backport_remerge, r=flip1995

Backport remerge

Step 1 in the release process.

r? `@ghost`

changelog: none

3 years agoMerge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 [Fri, 9 Oct 2020 06:52:06 +0000 (08:52 +0200)]
Merge remote-tracking branch 'upstream/beta' into backport_remerge

3 years agoAuto merge of #77627 - richkadel:rust-demangler, r=tmandry
bors [Fri, 9 Oct 2020 06:15:09 +0000 (06:15 +0000)]
Auto merge of #77627 - richkadel:rust-demangler, r=tmandry

rust-demangler tool strips crate disambiguators with < 16 digits

Addresses Issue #77615.

3 years agoUpdate rustdoc intra-doc link docs
Camelid [Sat, 3 Oct 2020 22:44:53 +0000 (15:44 -0700)]
Update rustdoc intra-doc link docs

* Describe generic parameters feature
* Make general improvements to the docs

3 years agoFix intra-doc links in `core`
Camelid [Sun, 27 Sep 2020 21:51:45 +0000 (14:51 -0700)]
Fix intra-doc links in `core`

Caught by my malformed generics diagnostics!

3 years agoAllow generic parameters in intra-doc links
Camelid [Fri, 9 Oct 2020 05:24:34 +0000 (22:24 -0700)]
Allow generic parameters in intra-doc links

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.

3 years agoAuto merge of #77578 - euclio:max-suggestion, r=davidtwco
bors [Fri, 9 Oct 2020 04:22:18 +0000 (04:22 +0000)]
Auto merge of #77578 - euclio:max-suggestion, r=davidtwco

suggest `MAX` constant if -1 is assigned to unsigned type

Fixes #76413.
Fixes #77416.

3 years agoAuto merge of #77519 - jyn514:track-doc-er, r=GuillaumeGomez
bors [Fri, 9 Oct 2020 02:27:33 +0000 (02:27 +0000)]
Auto merge of #77519 - jyn514:track-doc-er, r=GuillaumeGomez

Resolve intra-doc links on additional documentation for re-exports in lexical scope

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

- Preserve the parent module of `DocFragment`s
  + Add `parent_module` to `DocFragment`
  + Require the `parent_module` of the item being inlined
  + Preserve the hir_id for ExternCrates so rustdoc can find the parent module later
  + Take an optional `parent_module` for `build_impl` and `merge_attrs`.
    Preserve the difference between parent modules for each doc-comment.
  + Support a single additional re-exports in from_ast. Originally this took a vec but I ended up not using it.
  + Don't require the parent_module for all `impl`s, just inlined items

    In particular, this will be `None` whenever the attribute is not on a
    re-export.

  + Only store the parent_module, not the HirId

    When re-exporting a re-export, the HirId is not available. Fortunately,
    `collect_intra_doc_links` doesn't actually need all the info from a
    HirId, just the parent module.

- Introduce `Divider`

  This distinguishes between documentation on the original from docs on  the re-export.

- Use the new module information for intra-doc links

  + Make the parent module conditional on whether the docs are on a re-export
  + Make `resolve_link` take `&Item` instead of `&mut Item`

    Previously the borrow checker gave an error about multiple mutable
    borrows, because `dox` borrowed from `item`.

  + Fix `crate::` for re-exports

    `crate` means something different depending on where the attribute
    came from.

  + Make it work for `#[doc]` attributes too

    This required combining several attributes as one so they would keep
    the links.

r? `@GuillaumeGomez`

3 years agoAuto merge of #76260 - xd009642:rfc/2867, r=jonas-schievink
bors [Fri, 9 Oct 2020 00:29:47 +0000 (00:29 +0000)]
Auto merge of #76260 - xd009642:rfc/2867, r=jonas-schievink

Implementation of RFC2867

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

So I've started work on this, I think my next steps are to make use of the `instruction_set` value in the llvm codegen but this is the point where I begin to get a bit lost. I'm looking at the code but it would be nice to have some guidance on what I've currently done and what I'm doing next :smile:

3 years agoUpdate the backtrace crate to fix big-endian ELF
Josh Stone [Fri, 9 Oct 2020 00:17:28 +0000 (17:17 -0700)]
Update the backtrace crate to fix big-endian ELF

3 years agoImplement the same optimization in windows/time
Thom Chiovoloni [Fri, 9 Oct 2020 00:04:32 +0000 (17:04 -0700)]
Implement the same optimization in windows/time

3 years agoSwitch to using a single atomic and treating 0 as 'uninitialized'
Thom Chiovoloni [Fri, 9 Oct 2020 00:03:16 +0000 (17:03 -0700)]
Switch to using a single atomic and treating 0 as 'uninitialized'

3 years agoFix typo in error code
xd009642 [Thu, 8 Oct 2020 22:56:59 +0000 (23:56 +0100)]
Fix typo in error code

3 years agoAuto merge of #6133 - JPTIZ:no-box-for-c-ffi, r=ebroto
bors [Thu, 8 Oct 2020 22:50:29 +0000 (22:50 +0000)]
Auto merge of #6133 - JPTIZ:no-box-for-c-ffi, r=ebroto

clippy_lints: Do not warn against Box parameter in C FFI

changelog: [`boxed_local`]: don't lint in `extern fn` arguments

Fixes #5542.

When using C FFI, to handle pointers in parameters it is needed to
declare them as `Box` in its Rust-side signature. However, the current
linter warns against the usage of Box stating that "local variable
doesn't need to be boxed here".

This commit fixes it by ignoring functions whose Abi is C.

3 years agoAuto merge of #77723 - jonas-schievink:rollup-htz44r4, r=jonas-schievink
bors [Thu, 8 Oct 2020 22:37:37 +0000 (22:37 +0000)]
Auto merge of #77723 - jonas-schievink:rollup-htz44r4, r=jonas-schievink

Rollup of 8 pull requests

Successful merges:

 - #76750 (Don't discourage implementing `core::fmt::Write`)
 - #77449 (BTreeMap: comment why drain_filter's size_hint is somewhat pessimistic)
 - #77660 ((docs): make mutex error comment consistent with codebase)
 - #77663 (Add compile fail test for issue 27675)
 - #77673 (Remove unnecessary lamda on emitter map.)
 - #77701 (Make `max_log_info` easily greppable (for figuring out why debug logging is disabled))
 - #77702 (Remove not needed lambda.)
 - #77710 (Update submodule llvm to get LVI bugfix)

Failed merges:

r? `@ghost`