]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agorustdoc: Link to the docs on namespaces when an unknown disambiguator is found
Joshua Nelson [Mon, 5 Apr 2021 00:02:32 +0000 (20:02 -0400)]
rustdoc: Link to the docs on namespaces when an unknown disambiguator is found

3 years agoAuto merge of #83833 - jyn514:no-resolver, r=GuillaumeGomez
bors [Wed, 7 Apr 2021 04:45:12 +0000 (04:45 +0000)]
Auto merge of #83833 - jyn514:no-resolver, r=GuillaumeGomez

rustdoc: Store intra-doc links in Cache instead of on items directly

Items are first built after rustdoc creates the TyCtxt. To allow
resolving the links before the TyCtxt is built, the links can't be
stored on `clean::Item` directly.

Helps with https://github.com/rust-lang/rust/issues/83761. Opening this early because I think it might decrease memory usage.

3 years agoAuto merge of #83955 - ehuss:update-stage0, r=Mark-Simulacrum
bors [Wed, 7 Apr 2021 02:26:25 +0000 (02:26 +0000)]
Auto merge of #83955 - ehuss:update-stage0, r=Mark-Simulacrum

Bump bootstrap compiler

Pulls in #83946

Closes #83914

3 years agoBump bootstrap compiler
Eric Huss [Wed, 7 Apr 2021 01:24:09 +0000 (18:24 -0700)]
Bump bootstrap compiler

3 years agoAuto merge of #83828 - camelid:rustdoc-vec-perf, r=jyn514
bors [Tue, 6 Apr 2021 23:57:06 +0000 (23:57 +0000)]
Auto merge of #83828 - camelid:rustdoc-vec-perf, r=jyn514

rustdoc: Use `ThinVec` in a few places

Almost every crate has no primitives and no keywords defined in it, so
using `ThinVec` should make some types smaller.

3 years agoStore links in Cache instead of on items directly
Joshua Nelson [Sun, 4 Apr 2021 02:15:24 +0000 (22:15 -0400)]
Store links in Cache instead of on items directly

Items are first built after rustdoc creates the TyCtxt. To allow
resolving the links before the TyCtxt is built, the links can't be
stored on `clean::Item` directly.

3 years agoAuto merge of #83934 - Dylan-DPC:rollup-nw5dadn, r=Dylan-DPC
bors [Tue, 6 Apr 2021 17:55:55 +0000 (17:55 +0000)]
Auto merge of #83934 - Dylan-DPC:rollup-nw5dadn, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #82963 (Move `SharedContext` to `context.rs`)
 - #83829 (rustc_target: Rely on defaults more in target specs)
 - #83895 (Add listing of lints (eg via `-W help`) to rustdoc)
 - #83902 (Update LLVM to support more wasm simd ops)
 - #83903 (Fix typo in TokenStream documentation)
 - #83910 (Update cargo)
 - #83920 (Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agorustdoc: Use `ThinVec` in a few places
Camelid [Sat, 3 Apr 2021 01:32:06 +0000 (18:32 -0700)]
rustdoc: Use `ThinVec` in a few places

Almost every crate has no primitives and no keywords defined in it, so
using `ThinVec` should make some types smaller.

3 years agoRollup merge of #83920 - ortem:fix-hashmap-lldb-pretty-printer-1.52, r=pnkfelix
Dylan DPC [Tue, 6 Apr 2021 15:42:35 +0000 (17:42 +0200)]
Rollup merge of #83920 - ortem:fix-hashmap-lldb-pretty-printer-1.52, r=pnkfelix

Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0

The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566 after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.

Fixes #83891

3 years agoRollup merge of #83910 - ehuss:update-cargo, r=ehuss
Dylan DPC [Tue, 6 Apr 2021 15:42:34 +0000 (17:42 +0200)]
Rollup merge of #83910 - ehuss:update-cargo, r=ehuss

Update cargo

3 commits in 3c44c3c4b7900b8b13c85ead25ccaa8abb7d8989..65d57e6f384c2317f76626eac116f683e2b63665
2021-03-31 21:21:15 +0000 to 2021-04-04 15:07:52 +0000
- Fix typo in contrib docs. (rust-lang/cargo#9328)
- fix clippy warnings (rust-lang/cargo#9323)
- Add -Zallow-features to match rustc's -Z (rust-lang/cargo#9283)

3 years agoRollup merge of #83903 - rust-lang:GuillaumeGomez-patch-1, r=lcnr
Dylan DPC [Tue, 6 Apr 2021 15:42:33 +0000 (17:42 +0200)]
Rollup merge of #83903 - rust-lang:GuillaumeGomez-patch-1, r=lcnr

Fix typo in TokenStream documentation

3 years agoRollup merge of #83902 - alexcrichton:update-llvm, r=nikic
Dylan DPC [Tue, 6 Apr 2021 15:42:32 +0000 (17:42 +0200)]
Rollup merge of #83902 - alexcrichton:update-llvm, r=nikic

Update LLVM to support more wasm simd ops

Adds a commit with support for i64 simd comparisons for the wasm target

3 years agoRollup merge of #83895 - eggyal:issue-83883, r=jyn514
Dylan DPC [Tue, 6 Apr 2021 15:42:31 +0000 (17:42 +0200)]
Rollup merge of #83895 - eggyal:issue-83883, r=jyn514

Add listing of lints (eg via `-W help`) to rustdoc

Fixes #83883

r? `@jyn514`

3 years agoRollup merge of #83829 - petrochenkov:minclean, r=nagisa
Dylan DPC [Tue, 6 Apr 2021 15:42:29 +0000 (17:42 +0200)]
Rollup merge of #83829 - petrochenkov:minclean, r=nagisa

rustc_target: Rely on defaults more in target specs

3 years agoRollup merge of #82963 - camelid:move-sharedcontext, r=GuillaumeGomez
Dylan DPC [Tue, 6 Apr 2021 15:42:28 +0000 (17:42 +0200)]
Rollup merge of #82963 - camelid:move-sharedcontext, r=GuillaumeGomez

Move `SharedContext` to `context.rs`

It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.

3 years agoAuto merge of #83875 - jyn514:diag_info, r=bugadani
bors [Tue, 6 Apr 2021 15:37:29 +0000 (15:37 +0000)]
Auto merge of #83875 - jyn514:diag_info, r=bugadani

rustdoc: Use DiagnosticInfo in more parts of intra-doc links

This makes the code a lot less verbose.

This is separated into lots of tiny commits because it was easier for me that way, but the overall diff isn't that big if you want to read it at once.

r? `@bugadani`

3 years agoAuto merge of #83922 - RalfJung:miri, r=RalfJung
bors [Tue, 6 Apr 2021 12:20:48 +0000 (12:20 +0000)]
Auto merge of #83922 - RalfJung:miri, r=RalfJung

update Miri

Also updates the lockfile, since Miri updated some dependencies.
Cc `@rust-lang/miri` r? `@ghost`

3 years agoupdate Miri
Ralf Jung [Tue, 6 Apr 2021 11:20:48 +0000 (13:20 +0200)]
update Miri

3 years agoAuto merge of #83821 - camelid:improve-thinvec, r=petrochenkov
bors [Tue, 6 Apr 2021 09:57:12 +0000 (09:57 +0000)]
Auto merge of #83821 - camelid:improve-thinvec, r=petrochenkov

Add `FromIterator` and `IntoIterator` impls for `ThinVec`

These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.

I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.

I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.

3 years agoFix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0
ortem [Tue, 6 Apr 2021 09:23:28 +0000 (12:23 +0300)]
Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0

The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566
after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.

3 years agoAdd listing of lints (eg via -W help) to rustdoc
Alan Egerton [Tue, 6 Apr 2021 01:09:43 +0000 (02:09 +0100)]
Add listing of lints (eg via -W help) to rustdoc

3 years agoAuto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwco
bors [Tue, 6 Apr 2021 07:16:19 +0000 (07:16 +0000)]
Auto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwco

Find codegen backends in more locations

* Search in the sysroot passed using `--sysroot` in addition to the default sysroot.
* Search for `librustc_codegen_$name.so` in addition to `librustc_codegen_$name-$release.so`.

This combined would allow putting `librustc_codegen_cranelift.so` in the right location of a sysroot passed using `--sysroot`.

3 years agoAuto merge of #81234 - repnop:fn-alignment, r=lcnr
bors [Tue, 6 Apr 2021 04:35:26 +0000 (04:35 +0000)]
Auto merge of #81234 - repnop:fn-alignment, r=lcnr

Allow specifying alignment for functions

Fixes #75072

This allows the user to specify alignment for functions, which can be useful for low level work where functions need to necessarily be aligned to a specific value.

I believe the error cases not covered in the match are caught earlier based on my testing so I had them just return `None`.

3 years agoMove `SharedContext` to `context.rs`
Camelid [Fri, 2 Apr 2021 19:08:28 +0000 (12:08 -0700)]
Move `SharedContext` to `context.rs`

It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.

3 years agoAdd `FromIterator` and `IntoIterator` impls for `ThinVec`
Camelid [Sat, 3 Apr 2021 02:56:18 +0000 (19:56 -0700)]
Add `FromIterator` and `IntoIterator` impls for `ThinVec`

These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.

I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.

I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.

3 years agoAuto merge of #83592 - nagisa:nagisa/dso_local, r=davidtwco
bors [Tue, 6 Apr 2021 02:09:01 +0000 (02:09 +0000)]
Auto merge of #83592 - nagisa:nagisa/dso_local, r=davidtwco

Set dso_local for hidden, private and local items

This should probably have no real effect in most cases, as e.g. `hidden`
visibility already implies `dso_local` (or at least LLVM IR does not
preserve the `dso_local` setting if the item is already `hidden`), but
it should fix `-Crelocation-model=static` and improve codegen in
executables.

Note that this PR does not exhaustively port the logic in [clang], only the
portion that is necessary to fix a regression from LLVM 12 that relates to
`-Crelocation_model=static`.

Fixes #83335

[clang]: https://github.com/llvm/llvm-project/blob/3001d080c813da20b329303bf8f45451480e5905/clang/lib/CodeGen/CodeGenModule.cpp#L945-L1039

3 years agoUpdate cargo
Eric Huss [Tue, 6 Apr 2021 00:10:04 +0000 (17:10 -0700)]
Update cargo

3 years agoAuto merge of #83905 - JohnTitor:rollup-pa1la80, r=JohnTitor
bors [Mon, 5 Apr 2021 23:40:18 +0000 (23:40 +0000)]
Auto merge of #83905 - JohnTitor:rollup-pa1la80, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83370 (Add `x.py setup tools` which enables `download-rustc` by default)
 - #83489 (Properly suggest deref in else block)
 - #83734 (Catch a bad placeholder type error for statics in `extern`s)
 - #83814 (expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression)
 - #83835 (rustdoc: sort search index items for compression)
 - #83849 (rustdoc: Cleanup handling of associated items for intra-doc links)
 - #83881 (:arrow_up: rust-analyzer)
 - #83885 (Document compiler/ with -Aprivate-intra-doc-links)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoAllow specifying alignment for functions
Wesley Norris [Thu, 21 Jan 2021 02:49:04 +0000 (21:49 -0500)]
Allow specifying alignment for functions

3 years agoRollup merge of #83885 - jyn514:private-links, r=Mark-Simulacrum
Yuki Okushi [Mon, 5 Apr 2021 21:24:17 +0000 (06:24 +0900)]
Rollup merge of #83885 - jyn514:private-links, r=Mark-Simulacrum

Document compiler/ with -Aprivate-intra-doc-links

Since compiler/ always passes --document-private-items, it's ok to link to items that are private.

3 years agoRollup merge of #83881 - lnicola:rust-analyzer-2021-04-05, r=jonas-schievink
Yuki Okushi [Mon, 5 Apr 2021 21:24:16 +0000 (06:24 +0900)]
Rollup merge of #83881 - lnicola:rust-analyzer-2021-04-05, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadani
Yuki Okushi [Mon, 5 Apr 2021 21:24:15 +0000 (06:24 +0900)]
Rollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadani

rustdoc: Cleanup handling of associated items for intra-doc links

Helps with https://github.com/rust-lang/rust/issues/83761 (right now the uses of the resolver are all intermingled with uses of the tyctxt). Best reviewed one commit at a time.

r? ```@bugadani``` maybe? Feel free to reassign :)

3 years agoRollup merge of #83835 - notriddle:sort-index, r=ollie27
Yuki Okushi [Mon, 5 Apr 2021 21:24:13 +0000 (06:24 +0900)]
Rollup merge of #83835 - notriddle:sort-index, r=ollie27

rustdoc: sort search index items for compression

This should not affect the appearance of the docs pages themselves.

This makes the pre-compressed search index smaller, thanks to the
empty-string path duplication format, and also the gzipped version,
by giving the algorithm more structure to work with.

    rust$ wc -c search-index-old.js search-index-new.js
    2628334 search-index-old.js
    2586181 search-index-new.js
    5214515 total
    rust$ gzip search-index-*
    rust$ wc -c search-index-old.js.gz search-index-new.js.gz
    239486 search-index-old.js.gz
    237386 search-index-new.js.gz
    476872 total

3 years agoRollup merge of #83814 - petrochenkov:emptyexpr, r=davidtwco
Yuki Okushi [Mon, 5 Apr 2021 21:24:12 +0000 (06:24 +0900)]
Rollup merge of #83814 - petrochenkov:emptyexpr, r=davidtwco

expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression

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

The reported error is the same as for `let _ = #[cfg(FALSE)] EXPR;`

3 years agoRollup merge of #83734 - JohnTitor:issue-83621, r=davidtwco
Yuki Okushi [Mon, 5 Apr 2021 21:24:11 +0000 (06:24 +0900)]
Rollup merge of #83734 - JohnTitor:issue-83621, r=davidtwco

Catch a bad placeholder type error for statics in `extern`s

Fixes #83621

3 years agoRollup merge of #83489 - LeSeulArtichaut:deref-else, r=davidtwco
Yuki Okushi [Mon, 5 Apr 2021 21:24:09 +0000 (06:24 +0900)]
Rollup merge of #83489 - LeSeulArtichaut:deref-else, r=davidtwco

Properly suggest deref in else block

Continues #79755, fixes #79736
r? `@davidtwco`

3 years agoRollup merge of #83370 - jyn514:setup-tools, r=Mark-Simulacrum
Yuki Okushi [Mon, 5 Apr 2021 21:24:08 +0000 (06:24 +0900)]
Rollup merge of #83370 - jyn514:setup-tools, r=Mark-Simulacrum

Add `x.py setup tools` which enables `download-rustc` by default

Helps with https://github.com/rust-lang/rust/issues/81930. I know I said in that issue that I should fix that rebasing rebuilds bootstrap, but the compile time improvement is so good I think it's ok to leave that fix for later (I still plan to work on it). I think all the outright bugs have been fixed :)

This builds on https://github.com/rust-lang/rust/pull/83368 so I can set the option to `if-unchanged`.

r? ```@Mark-Simulacrum```

3 years agoAuto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
bors [Mon, 5 Apr 2021 21:14:27 +0000 (21:14 +0000)]
Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum

Use tikv-jemallocator in rustc/rustdoc in addition to jemalloc-sys when enabled.

In https://github.com/rust-lang/rust/pull/81782 it was mentioned that one reason rustc may benefit from minimalloc is it doesn't use the `sdallocx` api from jemalloc.

Currently, on unix, rust uses jemalloc by importing its symbols to use them with the default, System (libc) global allocator.
This PR switches its global alloc to `tikv-jemallocator`, which correctly uses sized deallocation (https://docs.rs/tikv-jemallocator/0.4.1/src/tikv_jemallocator/lib.rs.html#121-126). `tikv-jemallocator`, as far as I can tell, is a more up-to-date set of bindings to jemalloc than `jemallocator`

The perf results of this pr are in large part due to the version upgrade of jemalloc, but sized deallocation has a non-trivial improvement, particularly to rustdoc.

This pr also includes changes to bootstrap to correctly pass the jemalloc feature through to the rustdoc build

3 years agoFix typo in TokenStream documentation
Guillaume Gomez [Mon, 5 Apr 2021 20:58:07 +0000 (22:58 +0200)]
Fix typo in TokenStream documentation

3 years agoUpdate LLVM to support more wasm simd ops
Alex Crichton [Mon, 5 Apr 2021 20:50:49 +0000 (13:50 -0700)]
Update LLVM to support more wasm simd ops

Adds a commit with support for i64 simd comparisons for the wasm target

3 years agorustc_target: Rely on defaults more in target specs
Vadim Petrochenkov [Sat, 3 Apr 2021 21:31:28 +0000 (00:31 +0300)]
rustc_target: Rely on defaults more in target specs

3 years agoAuto merge of #83406 - b-naber:issue-83510, r=lcnr
bors [Mon, 5 Apr 2021 18:50:42 +0000 (18:50 +0000)]
Auto merge of #83406 - b-naber:issue-83510, r=lcnr

Prevent very long compilation runtimes in LateBoundRegionNameCollector

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

On recursive types such as in the example given in https://github.com/rust-lang/rust/issues/83150, the current implementation of `LateBoundRegionNameCollector` has very long compilation runtimes. To prevent those we store the types visited in the `middle::ty::Visitor` implementation of `LateBoundRegionNameCollector` in a `SsoHashSet`.

3 years agoUse DiagnosticInfo for `report_diagnostic`
Joshua Nelson [Mon, 5 Apr 2021 09:28:29 +0000 (05:28 -0400)]
Use DiagnosticInfo for `report_diagnostic`

3 years agoTake DiagnosticInfo in privacy_error
Joshua Nelson [Mon, 5 Apr 2021 09:15:57 +0000 (05:15 -0400)]
Take DiagnosticInfo in privacy_error

3 years agoTake `DiagnosticInfo` in `ambiguity_error`
Joshua Nelson [Mon, 5 Apr 2021 09:09:37 +0000 (05:09 -0400)]
Take `DiagnosticInfo` in `ambiguity_error`

3 years agoTake DiagnosticInfo in disambiguator_error
Joshua Nelson [Mon, 5 Apr 2021 09:06:50 +0000 (05:06 -0400)]
Take DiagnosticInfo in disambiguator_error

3 years agoRename link_range -> disambiguator_range in disambiguator_error
Joshua Nelson [Mon, 5 Apr 2021 09:04:46 +0000 (05:04 -0400)]
Rename link_range -> disambiguator_range in disambiguator_error

It's not the range of the full link, it's only a partial range.

3 years agoTake `DiagnosticInfo` in `resolution_failure`
Joshua Nelson [Mon, 5 Apr 2021 09:01:15 +0000 (05:01 -0400)]
Take `DiagnosticInfo` in `resolution_failure`

3 years agoUse DiagnosticInfo for anchor failure
Joshua Nelson [Mon, 5 Apr 2021 08:56:47 +0000 (04:56 -0400)]
Use DiagnosticInfo for anchor failure

This gets rid of a lot of parameters, as well as fixing a diagnostic
bug.

3 years agoRename path_str -> ori_link in anchor_failure
Joshua Nelson [Mon, 5 Apr 2021 08:50:01 +0000 (04:50 -0400)]
Rename path_str -> ori_link in anchor_failure

ori_link contains anchors, path_str does not. It's important that
anchor_failure be passed a link with the anchors still present.

3 years agoAdd config file for tools enabling stage1 downloads by default
Joshua Nelson [Fri, 4 Dec 2020 17:31:13 +0000 (12:31 -0500)]
Add config file for tools enabling stage1 downloads by default

Otherwise no one will be able to find the setting.

3 years agoAuto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC
bors [Mon, 5 Apr 2021 13:50:17 +0000 (13:50 +0000)]
Auto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #83368 (Add `download-rustc = "if-unchanged"`)
 - #83705 (Give a better error when --theme is not a CSS file)
 - #83853 (Disallow the use of high byte registes as operands on x86_64)
 - #83877 (Remove unnecessary exceptions to the platform-specific code check)
 - #83878 (Fix racing file access in tidy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83878 - the8472:fix-concurrent-tidy-access, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 13:48:46 +0000 (15:48 +0200)]
Rollup merge of #83878 - the8472:fix-concurrent-tidy-access, r=Mark-Simulacrum

Fix racing file access in tidy

That should fix the failure in https://github.com/rust-lang/rust/pull/83776#issuecomment-813311289

The file is only created for a brief moment during the bins checks in the source directories while other checks may also be visiting the same directory. By skipping it we avoid file not found errors.

3 years agoRollup merge of #83877 - jyn514:exceptions, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 13:48:44 +0000 (15:48 +0200)]
Rollup merge of #83877 - jyn514:exceptions, r=Mark-Simulacrum

Remove unnecessary exceptions to the platform-specific code check

Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But in the meantime it seems
silly to ignore the check if it will pass anyway.

3 years agoRollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisa
Dylan DPC [Mon, 5 Apr 2021 13:48:43 +0000 (15:48 +0200)]
Rollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisa

Disallow the use of high byte registes as operands on x86_64

They are still allowed on x86 though.

Fixes #83495

r? `@nagisa`

3 years agoRollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez
Dylan DPC [Mon, 5 Apr 2021 13:48:42 +0000 (15:48 +0200)]
Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez

Give a better error when --theme is not a CSS file

Before:

```
error: invalid argument: "bacon.toml"
```

After:
```
error: invalid argument: "bacon.toml"
  |
  = help: arguments to --theme must be CSS files
```

cc https://github.com/rust-lang/rust/pull/83478

3 years agoRollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 13:48:40 +0000 (15:48 +0200)]
Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum

Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

This sets `BOOTSTRAP_DOWNLOAD_RUSTC` in bootstrap.py so rustbuild doesn't have to try and replicate its logic.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum` cc `@camelid`

3 years agoAdd `download-rustc = "if-unchanged"`
Joshua Nelson [Mon, 22 Mar 2021 06:31:47 +0000 (02:31 -0400)]
Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

3 years agoDisallow the use of high byte registes as operands on x86_64
Amanieu d'Antras [Sun, 4 Apr 2021 16:44:46 +0000 (17:44 +0100)]
Disallow the use of high byte registes as operands on x86_64

They are still allowed on x86 though.

Fixes #83495

3 years agoDocument compiler/ with -Aprivate-intra-doc-links
Joshua Nelson [Mon, 5 Apr 2021 12:38:09 +0000 (08:38 -0400)]
Document compiler/ with -Aprivate-intra-doc-links

Since compiler/ always passes --document-private-items, it's ok to link
to items that are private.

3 years agoUse more appropriate return type for `resolve_associated_item`
Joshua Nelson [Sun, 4 Apr 2021 20:23:08 +0000 (16:23 -0400)]
Use more appropriate return type for `resolve_associated_item`

Previously, the types looked like this:

- None means this is not an associated item (but may be a variant field)
- Some(Err) means this is known to be an error. I think the only way that can happen is if it resolved and but you had your own anchor.
- Some(Ok(_, None)) was impossible.

Now, this returns a nested Option and does the error handling and
fiddling with the side channel in the caller. As a side-effect, it also
removes duplicate error handling.

This has one small change in behavior, which is that
`resolve_primitive_associated_item` now goes through `variant_field` if
it fails to resolve something.  This is not ideal, but since it will be
quickly rejected anyway, I think the performance hit is worth the
cleanup.

This also fixes a bug where struct fields would forget to set the side
channel, adds a test for the bug, and ignores `private_intra_doc_links`
in rustc_resolve (since it's always documented with
--document-private-items).

3 years agoReduce indentation in `resolve_associated_item`
Joshua Nelson [Sun, 4 Apr 2021 13:31:10 +0000 (09:31 -0400)]
Reduce indentation in `resolve_associated_item`

3 years agoRemove duplicate unwrap_or_else
Joshua Nelson [Sun, 4 Apr 2021 13:21:22 +0000 (09:21 -0400)]
Remove duplicate unwrap_or_else

3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 5 Apr 2021 11:40:58 +0000 (14:40 +0300)]
:arrow_up: rust-analyzer

3 years agoAuto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC
bors [Mon, 5 Apr 2021 11:06:20 +0000 (11:06 +0000)]
Auto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #81922 (Let `#[allow(unstable_name_collisions)]` work for things other than function)
 - #82483 (Use FromStr trait for number option parsing)
 - #82739 (Use the beta compiler for building bootstrap tools when `download-rustc` is set)
 - #83650 (Update Source Serif to release 4.004)
 - #83826 (List trait impls before deref methods in doc's sidebar)
 - #83831 (Add `#[inline]` to IpAddr methods)
 - #83863 (Render destructured struct function param names as underscore)
 - #83865 (Don't report disambiguator error if link would have been ignored)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83865 - camelid:disamb-err-fix, r=jyn514
Dylan DPC [Mon, 5 Apr 2021 11:03:44 +0000 (13:03 +0200)]
Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514

Don't report disambiguator error if link would have been ignored

Fixes #83859.

This prevents us from warning on links such as `<hello@example.com>`.
Note that we still warn on links such as `<hello@localhost>` because
they have no dots in them. However, the links will still work, even
though a warning is reported.

r? ````@jyn514````

3 years agoRollup merge of #83863 - eggyal:issue-83852, r=jyn514
Dylan DPC [Mon, 5 Apr 2021 11:03:43 +0000 (13:03 +0200)]
Rollup merge of #83863 - eggyal:issue-83852, r=jyn514

Render destructured struct function param names as underscore

Fixes #83852

r? ````@GuillaumeGomez````

3 years agoRollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-ip, r=m-ou-se
Dylan DPC [Mon, 5 Apr 2021 11:03:42 +0000 (13:03 +0200)]
Rollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-ip, r=m-ou-se

Add `#[inline]` to IpAddr methods

Add some inlines to trivial methods of IpAddr
Closes https://github.com/rust-lang/rust/issues/77583

3 years agoRollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, r=jyn514
Dylan DPC [Mon, 5 Apr 2021 11:03:41 +0000 (13:03 +0200)]
Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, r=jyn514

List trait impls before deref methods in doc's sidebar

This PR is acting directly on a suggestion made by ```````@jyn514``````` in #83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes #83133.

3 years agoRollup merge of #83650 - tspiteri:source-serif-4, r=GuillaumeGomez
Dylan DPC [Mon, 5 Apr 2021 11:03:40 +0000 (13:03 +0200)]
Rollup merge of #83650 - tspiteri:source-serif-4, r=GuillaumeGomez

Update Source Serif to release 4.004

Now the family name is Source Serif 4 (upstream issue 77) instead of Source Serif Pro.

3 years agoRollup merge of #82739 - jyn514:separate-stage0-stage1, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 11:03:38 +0000 (13:03 +0200)]
Rollup merge of #82739 - jyn514:separate-stage0-stage1, r=Mark-Simulacrum

Use the beta compiler for building bootstrap tools when `download-rustc` is set

 ## Motivation

This avoids having to rebuild bootstrap and tidy each time you rebase
over master. In particular, it makes rebasing and running `x.py fmt` on
each commit in a branch significantly faster. It also avoids having to
rebuild bootstrap after setting `download-rustc = true`.

 ## Implementation

Instead of extracting the CI artifacts directly to `stage0/`, extract
them to `ci-rustc/` instead. Continue to copy them to the proper
sysroots as necessary for all stages except stage 0.

This also requires `bootstrap.py` to download both stage0 and CI
artifacts and distinguish between the two when checking stamp files.

Note that since tools have to be built by the same compiler that built
`rustc-dev` and the standard library, the downloaded artifacts can't be
reused when building with the beta compiler. To make sure this is still
a good user experience, warn when building with the beta compiler, and
default to building with stage 2.

I tested this by rebasing this PR from edeee915b1c52f97411e57ef6b1a8bd46548a37a over 1c77a1fa3ca574f2a40056f64d498db8efe0d8a8 and confirming that only the bootstrap library itself had to be rebuilt, not any dependencies and not `tidy`. I also tested that a clean build with `x.py build` builds rustdoc exactly once and does no other work, and that `touch src/librustdoc/lib.rs && x.py build` works. `x.py check` still behaves as before (checks using the beta compiler, even if there are changes to `compiler/`).

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper
Dylan DPC [Mon, 5 Apr 2021 11:03:37 +0000 (13:03 +0200)]
Rollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper

Use FromStr trait for number option parsing

Replace `parse_uint` with generic `parse_number` based on `FromStr`.
Use it for parsing inlining threshold to avoid casting later.

3 years agoRollup merge of #81922 - magurotuna:issue81522, r=matthewjasper
Dylan DPC [Mon, 5 Apr 2021 11:03:36 +0000 (13:03 +0200)]
Rollup merge of #81922 - magurotuna:issue81522, r=matthewjasper

Let `#[allow(unstable_name_collisions)]` work for things other than function

Fixes #81522

In addition to the report in #81522, currently `#[allow(unstable_name_collisions)]` doesn't suppress the corresponding diagnostics even if this attribute is appended to an expression statement or a let statement. It seems like this is because the wrong `HirId` is passed to `struct_span_lint_hir`.
It's fixed in this PR, and a regression test for it is also added.

3 years agodon't try to visit probe file
The8472 [Mon, 5 Apr 2021 10:15:52 +0000 (12:15 +0200)]
don't try to visit probe file

this file is only created for a brief moment during the bins checks
in the source directories while other checks may also be visiting
that directory. skip processing it to avoid missing file errors

3 years agoRemove unnecessary exceptions to the platform-specific code check
Joshua Nelson [Mon, 5 Apr 2021 10:02:29 +0000 (06:02 -0400)]
Remove unnecessary exceptions to the platform-specific code check

Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But it the meantime it seems
silly to ignore the check if it will pass anyway.

3 years agochange SourceSerifPro to SourceSerif4 in emit-shared-files test
Trevor Spiteri [Mon, 5 Apr 2021 08:51:37 +0000 (10:51 +0200)]
change SourceSerifPro to SourceSerif4 in emit-shared-files test

3 years agoUpdate Source Serif to release 4.004
Trevor Spiteri [Mon, 29 Mar 2021 16:33:22 +0000 (18:33 +0200)]
Update Source Serif to release 4.004

Now the family name is Source Serif 4 (upstream issue 77) instead of
Source Serif Pro.

3 years agoAuto merge of #83858 - joshtriplett:unsafe-cell-always-inline, r=Mark-Simulacrum
bors [Mon, 5 Apr 2021 06:21:14 +0000 (06:21 +0000)]
Auto merge of #83858 - joshtriplett:unsafe-cell-always-inline, r=Mark-Simulacrum

Use `#[inline(always)]` on trivial UnsafeCell methods

UnsafeCell is the standard building block for shared mutable data
structures. UnsafeCell should add zero overhead compared to using raw
pointers directly.

Some reports suggest that debug builds, or even builds at opt-level 1,
may not always be inlining its methods. Mark the methods as
`#[inline(always)]`, since once inlined the methods should result in no
actual code other than field accesses.

3 years agoAuto merge of #83819 - AngelicosPhosphoros:issue-73338-fix-partial-eq-impl, r=Mark...
bors [Mon, 5 Apr 2021 03:55:09 +0000 (03:55 +0000)]
Auto merge of #83819 - AngelicosPhosphoros:issue-73338-fix-partial-eq-impl, r=Mark-Simulacrum

Optimize jumps in PartialOrd le

Closes https://github.com/rust-lang/rust/issues/73338
This change stops default implementation of `le()` method of PartialOrd from generating jumps.

3 years agoAuto merge of #83864 - Dylan-DPC:rollup-78an86n, r=Dylan-DPC
bors [Mon, 5 Apr 2021 01:26:57 +0000 (01:26 +0000)]
Auto merge of #83864 - Dylan-DPC:rollup-78an86n, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #80525 (wasm64 support)
 - #83019 (core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.)
 - #83717 (rustdoc: Separate filter-empty-string out into its own function)
 - #83807 (Tests: Remove redundant `ignore-tidy-linelength` annotations)
 - #83815 (ptr::addr_of documentation improvements)
 - #83820 (Remove attribute `#[link_args]`)
 - #83841 (Allow clobbering unsupported registers in asm!)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRenamed test
Alan Egerton [Sun, 4 Apr 2021 23:29:43 +0000 (00:29 +0100)]
Renamed test

3 years agoMerge branch 'master' of github.com:rust-lang/rust into issue-83852
Alan Egerton [Sun, 4 Apr 2021 23:27:57 +0000 (00:27 +0100)]
Merge branch 'master' of github.com:rust-lang/rust into issue-83852

3 years agoDon't report disambiguator error if link would have been ignored
Camelid [Sun, 4 Apr 2021 22:31:43 +0000 (15:31 -0700)]
Don't report disambiguator error if link would have been ignored

This prevents us from warning on links such as `<hello@example.com>`.
Note that we still warn on links such as `<hello@localhost>` because
they have no dots in them. However, the links will still work, even
though a warning is reported.

3 years agoAuto merge of #83530 - Mark-Simulacrum:bootstrap-bump, r=Mark-Simulacrum
bors [Sun, 4 Apr 2021 22:45:56 +0000 (22:45 +0000)]
Auto merge of #83530 - Mark-Simulacrum:bootstrap-bump, r=Mark-Simulacrum

Bump bootstrap to 1.52 beta

This includes the standard bump, but also a workaround for new cargo behavior around clearing out the doc directory when the rustdoc version changes.

3 years agoRollup merge of #83841 - Amanieu:asm_clobber_feature, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:34 +0000 (00:24 +0200)]
Rollup merge of #83841 - Amanieu:asm_clobber_feature, r=nagisa

Allow clobbering unsupported registers in asm!

Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed.

cc #81092

r? ``@nagisa``

3 years agoRollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:33 +0000 (00:24 +0200)]
Rollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa

Remove attribute `#[link_args]`

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

The attribute could always be replaced with `-C link-arg`, but cargo didn't provide a reasonable way to pass such flags to rustc.
Now cargo supports `cargo:rustc-link-arg*` directives in build scripts (https://doc.rust-lang.org/cargo/reference/unstable.html#extra-link-arg), so this attribute can be removed.

3 years agoRollup merge of #83815 - RalfJung:addr_of, r=kennytm
Dylan DPC [Sun, 4 Apr 2021 22:24:32 +0000 (00:24 +0200)]
Rollup merge of #83815 - RalfJung:addr_of, r=kennytm

ptr::addr_of documentation improvements

While writing https://github.com/rust-lang/reference/pull/1001 I figured I could also improve the docs here a bit.

3 years agoRollup merge of #83807 - sjakobi:77548-remove-ignore-annotations, r=Mark-Simulacrum
Dylan DPC [Sun, 4 Apr 2021 22:24:31 +0000 (00:24 +0200)]
Rollup merge of #83807 - sjakobi:77548-remove-ignore-annotations, r=Mark-Simulacrum

Tests: Remove redundant `ignore-tidy-linelength` annotations

This is step 2 towards fixing #77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.

3 years agoRollup merge of #83717 - notriddle:main-js-slice-loop, r=GuillaumeGomez
Dylan DPC [Sun, 4 Apr 2021 22:24:29 +0000 (00:24 +0200)]
Rollup merge of #83717 - notriddle:main-js-slice-loop, r=GuillaumeGomez

rustdoc: Separate filter-empty-string out into its own function

3 years agoRollup merge of #83019 - eddyb:spirv-no-block-swap, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:29 +0000 (00:24 +0200)]
Rollup merge of #83019 - eddyb:spirv-no-block-swap, r=nagisa

core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.

SPIR-V primarily supports what it calls the "Logical addressing model" (and AFAIK for graphical shaders it's the only option), and what that implies is that there is no "memory" to uniformly address at some byte/word level, and that you can't really talk about values having a "raw representation" in terms of sequences of bytes. Therefore, the "block"-wise swapping optimization employed by `ptr::swap_nonoverlapping_one` (where a "block" is 32 bytes, currently), is fundamentally incompatible with SPIR-V "memory".

As such, [Rust-GPU](https://github.com/EmbarkStudios/rust-gpu/)'s `rustc_codegen_spirv` backend cannot currently allow the use of `ptr::swap_nonoverlapping_one` - but that comes at a great price, since it's the building block of `mem::{swap,replace}`, and those in turn are used by e.g. `Option::take` and `Range`'s `Iterator` implementation (the latter blocking the use of `for i in 0..n` loops).

There's 4 options I can see in terms of supporting `ptr::swap_nonoverlapping_one` in `rustc_codegen_spirv`:
* legalize the block-wise swap loop back into swapping whole values, for SPIR-V
  * this is made borderline impossible by the fact that the size of the state "on the stack" is a block, and has to be expanded back to the appropriate size of the value being swapped, so in practice this would have to effectively pattern-match on the exact shape of the block-wise swapping algorithm, as a roundabout way of "patching `core::ptr` on the fly"
* (**this PR**) disable the block-wise swap optimization altogether when `#[cfg(target_arch = "spirv")`
  * I've tested it and it does in fact allow compiling `for i in 0..n` loops, which was my primary motivation
  * main downside IMO is the fact that `core` now acknowledges an out-of-tree backend
    * as a counterpoint, any attempt to compile Rust to SPIR-V would run into this problem, one way or another
* only enable the block-wise swap optimization on targets where it's been empirically proven to be an improvement
  * would avoid any surprises in terms of potentially-broken/inefficient codegen, in general
  * however, it may be universally applicable (thanks to caches), even if the optimal block size could differ
* move low-level swapping into an intrinsic, where the backend can choose any optimization approach it wants
  * this also has an impact on MIR optimizations (cc ``@rust-lang/wg-mir-opt)`` - which currently cannot hope to make sense of e.g. `Option::take` despite it being effectively `_0 = *_1;` `*_1 = None;` `return;`
  * long-term this is my preferred approach, and I can start working on it if that's desired, but I wanted to confirm that this swapping optimization is the final blocker for [Rust-GPU](https://github.com/EmbarkStudios/rust-gpu/) supporting e.g. range `for` loops

r? ``@nagisa`` cc ``@rust-lang/libs``

3 years agoRollup merge of #80525 - devsnek:wasm64, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:23 +0000 (00:24 +0200)]
Rollup merge of #80525 - devsnek:wasm64, r=nagisa

wasm64 support

There is still some upstream llvm work needed before this can land.

3 years agoRender destructured struct function param names as underscore.
Alan Egerton [Sun, 4 Apr 2021 21:42:19 +0000 (22:42 +0100)]
Render destructured struct function param names as underscore.

Fixes #83852

r? `@GuillaumeGomez`

3 years agouse jemallocator in rustc/rustdoc
Gus Wynn [Sun, 4 Apr 2021 21:07:56 +0000 (14:07 -0700)]
use jemallocator in rustc/rustdoc

3 years agoGet rid of unneeded `aliases` field
Michael Howell [Sun, 4 Apr 2021 20:08:17 +0000 (13:08 -0700)]
Get rid of unneeded `aliases` field

3 years agoAuto merge of #82907 - petrochenkov:dercache, r=Aaron1011
bors [Sun, 4 Apr 2021 20:16:09 +0000 (20:16 +0000)]
Auto merge of #82907 - petrochenkov:dercache, r=Aaron1011

resolve/expand: Cache intermediate results of `#[derive]` expansion

Expansion function for `#[derive]` (`rustc_builtin_macros::derive::Expander::expand`) may return an indeterminate result, and therefore can be called multiple times.
Previously we parsed the `#[derive(Foo, Bar)]`'s input and tried to resolve `Foo` and `Bar` on every such call.

Now we maintain a cache `Resolver::derive_data` and take all the necessary data from it if it was computed previously.
So `Foo, Bar` is now parsed at most once, and `Foo` and `Bar` are successfully resolved at most once.

3 years agoUse the beta compiler for building bootstrap tools when `download-rustc` is set
Joshua Nelson [Wed, 10 Feb 2021 05:33:17 +0000 (00:33 -0500)]
Use the beta compiler for building bootstrap tools when `download-rustc` is set

 ## Motivation

This avoids having to rebuild bootstrap and tidy each time you rebase
over master. In particular, it makes rebasing and running `x.py fmt` on
each commit in a branch significantly faster. It also avoids having to
rebuild bootstrap after setting `download-rustc = true`.

 ## Implementation

Instead of extracting the CI artifacts directly to `stage0/`, extract
them to `ci-rustc/` instead. Continue to copy them to the proper
sysroots as necessary for all stages except stage 0.

This also requires `bootstrap.py` to download both stage0 and CI
artifacts and distinguish between the two when checking stamp files.

Note that since tools have to be built by the same compiler that built
`rustc-dev` and the standard library, the downloaded artifacts can't be
reused when building with the beta compiler. To make sure this is still
a good user experience, warn when building with the beta compiler, and
default to building with stage 2.

3 years agocore: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.
Eduard-Mihai Burtescu [Thu, 11 Mar 2021 14:33:34 +0000 (16:33 +0200)]
core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.

3 years agocore: rearrange `ptr::swap_nonoverlapping_one`'s cases (no functional changes).
Eduard-Mihai Burtescu [Thu, 11 Mar 2021 12:39:37 +0000 (14:39 +0200)]
core: rearrange `ptr::swap_nonoverlapping_one`'s cases (no functional changes).

3 years agoWorkaround increased cache clearing in Cargo
Mark Rousskov [Sun, 4 Apr 2021 18:51:22 +0000 (14:51 -0400)]
Workaround increased cache clearing in Cargo

1.52 Cargo adds rust-lang/cargo#8640 which means that cargo will try to purge
the doc directory caches for us. In theory this may mean that we can jettison
the clear_if_dirty for rustdoc versioning entirely, but for now just workaround
the effects of this change in a less principled but more local way.

3 years agoBump cfgs
Mark Rousskov [Fri, 26 Mar 2021 20:10:21 +0000 (16:10 -0400)]
Bump cfgs