]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister
bors [Thu, 5 May 2022 12:26:38 +0000 (12:26 +0000)]
Auto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister

Add a new Rust attribute to support embedding debugger visualizers

Implemented [this RFC](https://github.com/rust-lang/rfcs/pull/3191) to add support for embedding debugger visualizers into a PDB.

Added a new attribute `#[debugger_visualizer]` and updated the `CrateMetadata` to store debugger visualizers for crate dependencies.

RFC: https://github.com/rust-lang/rfcs/pull/3191

2 years agoAuto merge of #96649 - tbu-:pr_to_ipv4_loopback_doc, r=m-ou-se
bors [Thu, 5 May 2022 09:45:53 +0000 (09:45 +0000)]
Auto merge of #96649 - tbu-:pr_to_ipv4_loopback_doc, r=m-ou-se

Make it clear that `to_ipv4` returns an IPv4 address for the IPv6 loopback

2 years agoAuto merge of #96630 - m-ysk:fix/issue-88038, r=notriddle
bors [Thu, 5 May 2022 07:25:18 +0000 (07:25 +0000)]
Auto merge of #96630 - m-ysk:fix/issue-88038, r=notriddle

Include nonexported macro_rules! macros in the doctest target

Fixes #88038

This PR aims to include nonexported `macro_rules!` macros in the doctest target. For more details, please see the above issue.

2 years agoAuto merge of #96626 - thomcc:rand-bump, r=m-ou-se
bors [Thu, 5 May 2022 05:08:44 +0000 (05:08 +0000)]
Auto merge of #96626 - thomcc:rand-bump, r=m-ou-se

Avoid using `rand::thread_rng` in the stdlib benchmarks.

This is kind of an anti-pattern because it introduces extra nondeterminism for no real reason. In thread_rng's case this comes both from the random seed and also from the reseeding operations it does, which occasionally does syscalls (which adds additional nondeterminism). The impact of this would be pretty small in most cases, but it's a good practice to avoid (particularly because avoiding it was not hard).

Anyway, several of our benchmarks already did the right thing here anyway, so the change was pretty easy and mostly just applying it more universally. That said, the stdlib benchmarks aren't particularly stable (nor is our benchmark framework particularly great), so arguably this doesn't matter that much in practice.

~~Anyway, this also bumps the `rand` dev-dependency to 0.8, since it had fallen somewhat out of date.~~ Nevermind, too much of a headache.

2 years agoAuto merge of #96720 - JohnTitor:rollup-9jaaekr, r=JohnTitor
bors [Thu, 5 May 2022 02:49:16 +0000 (02:49 +0000)]
Auto merge of #96720 - JohnTitor:rollup-9jaaekr, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #96603 (Enable full revision in const generics ui tests)
 - #96616 (Relax memory ordering used in `min_stack`)
 - #96619 (Relax memory ordering used in SameMutexCheck)
 - #96628 (Stabilize `bool::then_some`)
 - #96658 (Move callback to the () => {} syntax.)
 - #96677 (Add more tests for label-break-value)
 - #96697 (Enable tracing for all queries)

Failed merges:

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

2 years agoRollup merge of #96697 - oli-obk:trace_queries, r=michaelwoerister
Yuki Okushi [Thu, 5 May 2022 01:20:38 +0000 (10:20 +0900)]
Rollup merge of #96697 - oli-obk:trace_queries, r=michaelwoerister

Enable tracing for all queries

This allows you to log everything within a specific query, e.g.

```
env RUSTC_LOG=[mir_borrowck]
```

dumping all borrowck queries may be a bit verbose, so you can also restrict it to just an item of your choice:

```
env RUSTC_LOG=[mir_borrowck{key=\.\*name_of_item\.\*}]
```

the regex `.*` in the key name are because the key is a debug printed DefId, so you'd get all kinds of things like hashes in there. The tracing logs will show you the key, so you can restrict it further if you want.

2 years agoRollup merge of #96677 - jyn514:label-break-value-tests, r=petrochenkov
Yuki Okushi [Thu, 5 May 2022 01:20:37 +0000 (10:20 +0900)]
Rollup merge of #96677 - jyn514:label-break-value-tests, r=petrochenkov

Add more tests for label-break-value

Helps with https://github.com/rust-lang/rust/issues/48594. The tests are adapted from https://github.com/rust-lang/rust/issues/48594#issuecomment-421625182.

2 years agoRollup merge of #96658 - Folyd:es6, r=GuillaumeGomez
Yuki Okushi [Thu, 5 May 2022 01:20:36 +0000 (10:20 +0900)]
Rollup merge of #96658 - Folyd:es6, r=GuillaumeGomez

Move callback to the () => {} syntax.

Part of https://github.com/rust-lang/rust/issues/93058.

r? `@GuillaumeGomez`

2 years agoRollup merge of #96628 - joshtriplett:stabilize-then-some, r=m-ou-se
Yuki Okushi [Thu, 5 May 2022 01:20:35 +0000 (10:20 +0900)]
Rollup merge of #96628 - joshtriplett:stabilize-then-some, r=m-ou-se

Stabilize `bool::then_some`

FCP completed in https://github.com/rust-lang/rust/issues/80967

2 years agoRollup merge of #96619 - akiekintveld:same_mutex_check_relaxed_ordering, r=m-ou-se
Yuki Okushi [Thu, 5 May 2022 01:20:34 +0000 (10:20 +0900)]
Rollup merge of #96619 - akiekintveld:same_mutex_check_relaxed_ordering, r=m-ou-se

Relax memory ordering used in SameMutexCheck

`SameMutexCheck` only requires atomicity for `self.addr`, but does not need ordering of other memory accesses in either the success or failure case. Using `Relaxed`, the code still correctly handles the case when two threads race to store an address.

2 years agoRollup merge of #96616 - akiekintveld:min_stack_relaxed_ordering, r=joshtriplett
Yuki Okushi [Thu, 5 May 2022 01:20:33 +0000 (10:20 +0900)]
Rollup merge of #96616 - akiekintveld:min_stack_relaxed_ordering, r=joshtriplett

Relax memory ordering used in `min_stack`

`min_stack` does not provide any synchronization guarantees to its callers, and only requires atomicity for `MIN` itself, so relaxed memory ordering is sufficient.

2 years agoRollup merge of #96603 - Alexendoo:const-generics-tests, r=Mark-Simulacrum
Yuki Okushi [Thu, 5 May 2022 01:20:32 +0000 (10:20 +0900)]
Rollup merge of #96603 - Alexendoo:const-generics-tests, r=Mark-Simulacrum

Enable full revision in const generics ui tests

The ICEs no longer occur since https://github.com/rust-lang/rust/pull/95776 so the revisions can be reenabled

Also adds some regression tests for issues that no longer ICE because of it

closes #77357
closes #78180
closes #83993

2 years agoAuto merge of #96593 - jackh726:issue-93262, r=compiler-errors
bors [Thu, 5 May 2022 00:24:48 +0000 (00:24 +0000)]
Auto merge of #96593 - jackh726:issue-93262, r=compiler-errors

Revert "Prefer projection candidates instead of param_env candidates for Sized predicates"

Fixes #93262
Reopens #89352

This was a hack that seemed to have no negative side-effects at the time. Given that the latter has a workaround and likely less common than the former, it makes sense to revert this change.

r? `@compiler-errors`

2 years agoCleanup broken doc links.
ridwanabdillahi [Thu, 5 May 2022 00:17:57 +0000 (17:17 -0700)]
Cleanup broken doc links.

2 years agoMake it clear that `to_ipv4` returns an IPv4 address for the IPv6 loopback
Tobias Bucher [Mon, 2 May 2022 21:20:51 +0000 (23:20 +0200)]
Make it clear that `to_ipv4` returns an IPv4 address for the IPv6 loopback

2 years agoAuto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkov
bors [Wed, 4 May 2022 21:16:28 +0000 (21:16 +0000)]
Auto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkov

Overhaul `MacArgs`

Motivation:
- Clarify some code that I found hard to understand.
- Eliminate one use of three places where `TokenKind::Interpolated` values are created.

r? `@petrochenkov`

2 years agoAdd a comment on `TokenKind::Interpolated`.
Nicholas Nethercote [Wed, 4 May 2022 06:12:09 +0000 (16:12 +1000)]
Add a comment on `TokenKind::Interpolated`.

2 years agoOverhaul `MacArgs::Eq`.
Nicholas Nethercote [Thu, 28 Apr 2022 20:52:01 +0000 (06:52 +1000)]
Overhaul `MacArgs::Eq`.

The value in `MacArgs::Eq` is currently represented as a `Token`.
Because of `TokenKind::Interpolated`, `Token` can be either a token or
an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a
literal or macro call AST fragment, and then is later lowered to a
literal token. But this is very non-obvious. `Token` is a much more
general type than what is needed.

This commit restricts things, by introducing a new type `MacArgsEqKind`
that is either an AST expression (pre-lowering) or an AST literal
(post-lowering). The downside is that the code is a bit more verbose in
a few places. The benefit is that makes it much clearer what the
possibilities are (though also shorter in some other places). Also, it
removes one use of `TokenKind::Interpolated`, taking us a step closer to
removing that variant, which will let us make `Token` impl `Copy` and
remove many "handle Interpolated" code paths in the parser.

Things to note:
- Error messages have improved. Messages like this:
  ```
  unexpected token: `"bug" + "found"`
  ```
  now say "unexpected expression", which makes more sense. Although
  arbitrary expressions can exist within tokens thanks to
  `TokenKind::Interpolated`, that's not obvious to anyone who doesn't
  know compiler internals.
- In `parse_mac_args_common`, we no longer need to collect tokens for
  the value expression.

2 years agoEnable tracing for all queryies
Oli Scherer [Wed, 4 May 2022 08:30:13 +0000 (08:30 +0000)]
Enable tracing for all queryies

2 years agoAuto merge of #96683 - nnethercote:speed-up-Token-ident-lifetime, r=petrochenkov
bors [Wed, 4 May 2022 15:24:02 +0000 (15:24 +0000)]
Auto merge of #96683 - nnethercote:speed-up-Token-ident-lifetime, r=petrochenkov

Speed up `Token::{ident,lifetime}`

Some speed and cleanliness improvements.

r? `@petrochenkov`

2 years agoAuto merge of #94775 - oli-obk:operand_order, r=davidtwco
bors [Wed, 4 May 2022 12:54:02 +0000 (12:54 +0000)]
Auto merge of #94775 - oli-obk:operand_order, r=davidtwco

Fix constants not getting dropped if part of a diverging expression

fixes https://github.com/rust-lang/rust/issues/90762

cc `@RalfJung`

2 years agoStabilize `bool::then_some`
Josh Triplett [Mon, 2 May 2022 08:12:35 +0000 (01:12 -0700)]
Stabilize `bool::then_some`

2 years agoAuto merge of #96695 - JohnTitor:rollup-oo4fc1h, r=JohnTitor
bors [Wed, 4 May 2022 09:55:51 +0000 (09:55 +0000)]
Auto merge of #96695 - JohnTitor:rollup-oo4fc1h, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #96597 (openbsd: unbreak build on native platform)
 - #96662 (Fix typo in lint levels doc)
 - #96668 (Fix flaky rustdoc-ui test because it did not replace time result)
 - #96679 (Quick fix for #96223.)
 - #96684 (Update `ProjectionElem::Downcast` documentation)
 - #96686 (Add some TAIT-related tests)

Failed merges:

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

2 years agoGenerate an intermediate temporary for `Drop` constants.
Oli Scherer [Wed, 9 Mar 2022 17:10:48 +0000 (17:10 +0000)]
Generate an intermediate temporary for `Drop` constants.

To limit the fallout from this, don't do this for the last (or only) operand in an rvalue.

2 years agoRollup merge of #96686 - JohnTitor:impl-trait-tests, r=oli-obk
Yuki Okushi [Wed, 4 May 2022 08:13:16 +0000 (17:13 +0900)]
Rollup merge of #96686 - JohnTitor:impl-trait-tests, r=oli-obk

Add some TAIT-related tests

Closes #53398
Closes #58662
Closes #89952
Closes #94429

r? `@oli-obk` as you're familiar with it

2 years agoRollup merge of #96684 - tmiasko:mir-downcast, r=petrochenkov
Yuki Okushi [Wed, 4 May 2022 08:13:15 +0000 (17:13 +0900)]
Rollup merge of #96684 - tmiasko:mir-downcast, r=petrochenkov

Update `ProjectionElem::Downcast` documentation

`ProjectionElem:::Downcast` is used when downcasting to a variant of
an enum or a generator, regardless of the number of variants.

2 years agoRollup merge of #96679 - ricked-twice:issue-96223-fix, r=jackh726
Yuki Okushi [Wed, 4 May 2022 08:13:14 +0000 (17:13 +0900)]
Rollup merge of #96679 - ricked-twice:issue-96223-fix, r=jackh726

Quick fix for #96223.

This PR is a quick fix regarding #96223.

As mentioned in the issue, others modification could be added to not elide types with bound vars from suggestions.

Special thanks to ``@jackh726`` for mentoring and ``@Manishearth`` for minimal test case.

r? ``@jackh726``

2 years agoRollup merge of #96668 - GuillaumeGomez:fix-rustdoc-ui-flaky-test, r=petrochenkov
Yuki Okushi [Wed, 4 May 2022 08:13:13 +0000 (17:13 +0900)]
Rollup merge of #96668 - GuillaumeGomez:fix-rustdoc-ui-flaky-test, r=petrochenkov

Fix flaky rustdoc-ui test because it did not replace time result

As mentioned in https://github.com/rust-lang/rust/pull/93715: a test is flaky because I forgot to replace the time value.

This PR fixes it.

r? ``@petrochenkov``

2 years agoRollup merge of #96662 - rockboynton:master, r=GuillaumeGomez
Yuki Okushi [Wed, 4 May 2022 08:13:12 +0000 (17:13 +0900)]
Rollup merge of #96662 - rockboynton:master, r=GuillaumeGomez

Fix typo in lint levels doc

2 years agoRollup merge of #96597 - semarie:split_debuginfo-unix, r=davidtwco,Mark-Simulacrum
Yuki Okushi [Wed, 4 May 2022 08:13:11 +0000 (17:13 +0900)]
Rollup merge of #96597 - semarie:split_debuginfo-unix, r=davidtwco,Mark-Simulacrum

openbsd: unbreak build on native platform

after #95612, only linux and windows target are build with `-Zunstable-options`, but others platforms might use `-Csplit-debuginfo`

currently, without this PR, the build of rustc on OpenBSD fails with:

```
Building stage0 tool unstable-book-gen (x86_64-unknown-openbsd)
running: "/data/semarie/build-rust/install_dir/beta/bin/cargo" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path"
"/data/semarie/build-rust/build_dir/rustc-nightly-src/src/tools/unstable-book-gen/Cargo.toml" "--message-format" "json-render-diagnostics"
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/data/semarie/build-rust/build_dir/build/bootstrap/debug/rustc - --crate-name ___ --print=file-names --cfg=bootstrap -Csymbol-mangling-version=v0 -Zmacro-backtrace -Clink-args=-Wl,-z,origin
'-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Csplit-debuginfo=off -Ztls-model=initial-exec --target x86_64-unknown-openbsd --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro
--print=sysroot --print=cfg` (exit status: 1)
  --- stdout

  Did not run successfully: exit status: 1
  "/data/semarie/build-rust/install_dir/beta/bin/rustc" "-" "--crate-name" "___" "--print=file-names" "--cfg=bootstrap" "-Csymbol-mangling-version=v0" "-Zmacro-backtrace" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib"
"-Csplit-debuginfo=off" "-Ztls-model=initial-exec" "--target" "x86_64-unknown-openbsd" "--crate-type" "bin" "--crate-type" "rlib" "--crate-type" "dylib" "--crate-type" "cdylib" "--crate-type" "staticlib" "--crate-type" "proc-macro"
"--print=sysroot" "--print=cfg" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/data/semarie/build-rust/install_dir/beta"
  -------------

  --- stderr
  error: `-Csplit-debuginfo` is unstable on this platform

command did not execute successfully: "/data/semarie/build-rust/install_dir/beta/bin/cargo.bin" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path"
```

I am suspecting that all unix might be affected, but I am unsure about the right conditional to use. so I only added "openbsd" target inside it as I am able to test it.

rustc nightly built correctly with this PR on openbsd.

2 years agoAuto merge of #96693 - ehuss:update-cargo, r=ehuss
bors [Wed, 4 May 2022 07:31:58 +0000 (07:31 +0000)]
Auto merge of #96693 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in f63f23ff1f1a12ede8585bbd1bbf0c536e50293d..a44758ac805600edbb6ba51e7e6fb81a6077c0cd
2022-04-28 03:15:50 +0000 to 2022-05-04 02:29:34 +0000
- Add support for `-Zbuild-std` to `cargo fetch` (rust-lang/cargo#10129)
- Migrate tests of `cargo-init` to snapbox (rust-lang/cargo#10620)
- dedupe toml_edit crate, followup rust-lang/cargo#10603 (rust-lang/cargo#10619)
- Update GitHub Actions actions/checkout@v2 to v3 (rust-lang/cargo#10618)
- Integrate snapbox in with cargo-test-support (rust-lang/cargo#10581)
- Fix zsh completion (rust-lang/cargo#10613)
- Update documentation for workspace inheritance (rust-lang/cargo#10611)

2 years agoAdd regression test
Oli Scherer [Wed, 9 Mar 2022 15:27:28 +0000 (15:27 +0000)]
Add regression test

2 years agoRevert #92191 Prefer projection candidates instead of param_env candidates for Sized...
Jack Huey [Sun, 1 May 2022 01:00:57 +0000 (21:00 -0400)]
Revert #92191 Prefer projection candidates instead of param_env candidates for Sized predicates

2 years agoUpdate cargo
Eric Huss [Wed, 4 May 2022 05:48:05 +0000 (22:48 -0700)]
Update cargo

2 years agoAuto merge of #96447 - petrochenkov:docregr, r=GuillaumeGomez
bors [Wed, 4 May 2022 05:01:47 +0000 (05:01 +0000)]
Auto merge of #96447 - petrochenkov:docregr, r=GuillaumeGomez

rustdoc: Resolve doc links on fields during early resolution

Another subset of https://github.com/rust-lang/rust/pull/94857 which fixes https://github.com/rust-lang/rust/issues/96429.

This case regressed in https://github.com/rust-lang/rust/pull/96135 when `may_have_doc_links`-based filtering was introduced.
Before that filtering structs could collect traits in scope for their fields, but after the filtering structs won't collect anything if they don't have doc comments on them, so we have to visit fields too.

2 years agoMove callback to the () => {} syntax.
Folyd [Tue, 3 May 2022 04:03:17 +0000 (12:03 +0800)]
Move callback to the () => {} syntax.

Fix lint

Fix main.js

Restore anonymous functions

Fix

Fix more

2 years agoAuto merge of #96353 - estebank:issue-95413, r=compiler-errors
bors [Wed, 4 May 2022 01:58:23 +0000 (01:58 +0000)]
Auto merge of #96353 - estebank:issue-95413, r=compiler-errors

When suggesting to import an item, also suggest changing the path if appropriate

When we don't find an item we search all of them for an appropriate
import and suggest `use`ing it. This is sometimes done for expressions
that have paths with more than one segment. We now also suggest changing
that path to work with the `use`.

Fix #95413

2 years agoAdd some TAIT-related tests
Yuki Okushi [Wed, 4 May 2022 00:12:50 +0000 (09:12 +0900)]
Add some TAIT-related tests

2 years agoAuto merge of #95380 - compiler-errors:unit-destructure-assign, r=nikomatsakis
bors [Tue, 3 May 2022 22:29:58 +0000 (22:29 +0000)]
Auto merge of #95380 - compiler-errors:unit-destructure-assign, r=nikomatsakis

Fix unit struct/enum variant in destructuring assignment

See https://github.com/rust-lang/rfcs/blob/master/text/2909-destructuring-assignment.md#guide-level-explanation, "including **unit** and tuple structs"

Fixes #94319

2 years agoUpdate `ProjectionElem::Downcast` documentation
Tomasz Miąsko [Tue, 3 May 2022 00:00:00 +0000 (00:00 +0000)]
Update `ProjectionElem::Downcast` documentation

`ProjectionElem:::Downcast` is used when downcasting to a variant of
an enum or a generator, regardless of the number of variants.

2 years agoTaking review hints into account.
ricked-twice [Tue, 3 May 2022 20:23:30 +0000 (22:23 +0200)]
Taking review hints into account.

2 years agoRemove unnecessary `NtIdent` in `Token::is_whole_expr`.
Nicholas Nethercote [Tue, 3 May 2022 05:12:43 +0000 (15:12 +1000)]
Remove unnecessary `NtIdent` in `Token::is_whole_expr`.

The comment on this function explains that it's a specialized version of
`maybe_whole_expr`. But `maybe_whole_expr` doesn't do anything with
`NtIdent`, so `is_whole_expr` also doesn't need to.

2 years agoFix spelling of an identifier.
Nicholas Nethercote [Tue, 3 May 2022 04:23:19 +0000 (14:23 +1000)]
Fix spelling of an identifier.

2 years agoSpeed up `Token::{ident,lifetime}`.
Nicholas Nethercote [Tue, 3 May 2022 02:40:35 +0000 (12:40 +1000)]
Speed up `Token::{ident,lifetime}`.

They're hot enough that the repeated matching done by `uninterpolate`
has a measurable effect.

2 years agoAuto merge of #96558 - bjorn3:librarify_parse_format, r=davidtwco
bors [Tue, 3 May 2022 20:03:54 +0000 (20:03 +0000)]
Auto merge of #96558 - bjorn3:librarify_parse_format, r=davidtwco

Make rustc_parse_format compile on stable

This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.

2 years agoQuick fix for #96223.
ricked-twice [Tue, 3 May 2022 19:16:03 +0000 (21:16 +0200)]
Quick fix for #96223.

2 years agoAdd more tests for label-break-value
Joshua Nelson [Tue, 3 May 2022 19:07:36 +0000 (14:07 -0500)]
Add more tests for label-break-value

2 years agoFix flaky rustdoc-ui test because it did not replace time result
Guillaume Gomez [Tue, 3 May 2022 18:46:02 +0000 (20:46 +0200)]
Fix flaky rustdoc-ui test because it did not replace time result

2 years agoAdd support for a new attribute `#[debugger_visualizer]` to support embedding debugge...
ridwanabdillahi [Tue, 26 Apr 2022 01:02:43 +0000 (18:02 -0700)]
Add support for a new attribute `#[debugger_visualizer]` to support embedding debugger visualizers into a generated PDB.

Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries.

Merge the queries for debugger visualizers into a single query.

Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`.

Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate.

Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature.

Respond to PR comments and minor cleanups.

2 years agoAuto merge of #96280 - lygstate:ffi-fixes, r=joshtriplett
bors [Tue, 3 May 2022 17:22:58 +0000 (17:22 +0000)]
Auto merge of #96280 - lygstate:ffi-fixes, r=joshtriplett

library/core: Fixes implement of c_uint, c_long, c_ulong

Fixes: aa670166243 ("make memcmp return a value of c_int_width instead of i32")
Introduce c_num_definition to getting the cfg_if logic easier to maintain
Add newlines for easier code reading

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2 years agoignore the doctest for map
Yoshiki Matsuda [Tue, 3 May 2022 15:53:46 +0000 (00:53 +0900)]
ignore the doctest for map

2 years agoAuto merge of #96601 - tmiasko:ssa-rpo, r=davidtwco
bors [Tue, 3 May 2022 12:16:00 +0000 (12:16 +0000)]
Auto merge of #96601 - tmiasko:ssa-rpo, r=davidtwco

Use reverse postorder in `non_ssa_locals`

The reverse postorder, unlike preorder, is now cached inside the MIR
body. Code generation uses reverse postorder anyway, so it might be
a small perf improvement to use it here as well.

2 years agoignore a doctest for the non-exported macro
Yoshiki Matsuda [Tue, 3 May 2022 09:33:56 +0000 (18:33 +0900)]
ignore a doctest for the non-exported macro

2 years agoAuto merge of #96666 - lnicola:rust-analyzer-2022-05-03, r=lnicola
bors [Tue, 3 May 2022 09:27:59 +0000 (09:27 +0000)]
Auto merge of #96666 - lnicola:rust-analyzer-2022-05-03, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoMake rustc_parse_format compile on stable
bjorn3 [Fri, 29 Apr 2022 16:48:58 +0000 (18:48 +0200)]
Make rustc_parse_format compile on stable

This allows it to be used by lightweight formatting systems and may
allow it to be used by rust-analyzer.

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 3 May 2022 09:13:22 +0000 (12:13 +0300)]
:arrow_up: rust-analyzer

2 years agoAuto merge of #96663 - JohnTitor:rollup-lthuzdq, r=JohnTitor
bors [Tue, 3 May 2022 06:09:57 +0000 (06:09 +0000)]
Auto merge of #96663 - JohnTitor:rollup-lthuzdq, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #93097 (Switch settings menu to full js)
 - #96587 (Refactor the WriteBackendMethods and ExtraBackendMethods traits)
 - #96589 (Use source callsite in check_argument_types suggestion)
 - #96599 (Update `RValue::Discriminant` documentation)
 - #96614 (Add a regression test for #92305)
 - #96629 (Fix invalid keyword order for function declarations)
 - #96641 (Use a yes/no enum instead of a bool.)
 - #96646 (Mitigate impact of subtle invalid call suggestion logic)

Failed merges:

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

2 years agoRollup merge of #96646 - estebank:issue-96638, r=jackh726
Yuki Okushi [Tue, 3 May 2022 05:59:03 +0000 (14:59 +0900)]
Rollup merge of #96646 - estebank:issue-96638, r=jackh726

Mitigate impact of subtle invalid call suggestion logic

There's some subtle interaction between inferred expressions being
passed as an argument to fn calls with fewer than expected arguments. To
avoid the ICE, I'm changing indexing operations with `.get(idx)`, but
the underlying logic still needs to be audited as it was written with
the assumption that `final_arg_types` and `provided_args` have the right
length.

Address #96638.

2 years agoRollup merge of #96641 - oli-obk:bool_args, r=wesleywiser
Yuki Okushi [Tue, 3 May 2022 05:59:01 +0000 (14:59 +0900)]
Rollup merge of #96641 - oli-obk:bool_args, r=wesleywiser

Use a yes/no enum instead of a bool.

The bool's meaning wasn't obvious to me at some call sites.

2 years agoRollup merge of #96629 - ken-matsui:fix-invalid-keyword-order-for-function-declaratio...
Yuki Okushi [Tue, 3 May 2022 05:59:01 +0000 (14:59 +0900)]
Rollup merge of #96629 - ken-matsui:fix-invalid-keyword-order-for-function-declarations, r=davidtwco

Fix invalid keyword order for function declarations

Closes: https://github.com/rust-lang/rust/issues/94879
2 years agoRollup merge of #96614 - JohnTitor:test-92305, r=oli-obk
Yuki Okushi [Tue, 3 May 2022 05:59:00 +0000 (14:59 +0900)]
Rollup merge of #96614 - JohnTitor:test-92305, r=oli-obk

Add a regression test for #92305

Closes #92305
r? ``@oli-obk`` as per https://github.com/rust-lang/rust/issues/92305#issuecomment-1114043188

2 years agoRollup merge of #96599 - tmiasko:discriminant-docs, r=estebank
Yuki Okushi [Tue, 3 May 2022 05:58:59 +0000 (14:58 +0900)]
Rollup merge of #96599 - tmiasko:discriminant-docs, r=estebank

Update `RValue::Discriminant` documentation

`RValue::Discriminant` returns zero for types without discriminant.
This guarantee is already documented for `discriminant_value`
intrinsics which is implemented in terms of `RValue::Discriminant`.

2 years agoRollup merge of #96589 - Badel2:source-callsite, r=michaelwoerister
Yuki Okushi [Tue, 3 May 2022 05:58:58 +0000 (14:58 +0900)]
Rollup merge of #96589 - Badel2:source-callsite, r=michaelwoerister

Use source callsite in check_argument_types suggestion

This makes the "remove extra arguement" suggestion valid when the function argument is a macro.

Additionally, this may fix #96225, but the only way I can reproduce that issue is using the playground, so we will need to wait until after this is merged to ensure it's fixed.

2 years agoRollup merge of #96587 - bjorn3:refactor_backend_write, r=michaelwoerister
Yuki Okushi [Tue, 3 May 2022 05:58:57 +0000 (14:58 +0900)]
Rollup merge of #96587 - bjorn3:refactor_backend_write, r=michaelwoerister

Refactor the WriteBackendMethods and ExtraBackendMethods traits

The new interface is slightly less confusing and is easier to implement for non-LLVM backends.

2 years agoRollup merge of #93097 - GuillaumeGomez:settings-js, r=jsha
Yuki Okushi [Tue, 3 May 2022 05:58:56 +0000 (14:58 +0900)]
Rollup merge of #93097 - GuillaumeGomez:settings-js, r=jsha

Switch settings menu to full js

Since the settings can only be set when the JS is enabled, it's not really a problem. It also fixes a debate we had around the themes not being accessible easily before.

![Screenshot from 2022-01-19 23-06-59](https://user-images.githubusercontent.com/3050060/150221936-fd1a1e76-06b6-4416-a653-dbae111979ed.png)

You can test it [here](https://rustdoc.crud.net/imperio/settings-js/doc/foo/index.html).

r? ``@jsha``

2 years agoFix typo in lint levels doc
Rock Boynton [Tue, 3 May 2022 05:33:28 +0000 (22:33 -0700)]
Fix typo in lint levels doc

2 years agoUpdate library/core/src/ffi/mod.rs
Yonggang Luo [Tue, 3 May 2022 02:42:46 +0000 (10:42 +0800)]
Update library/core/src/ffi/mod.rs

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoTweak wording
Esteban Kuber [Tue, 3 May 2022 02:07:47 +0000 (02:07 +0000)]
Tweak wording

2 years agoWhen suggesting to import an item, also suggest changing the path if appropriate
Esteban Küber [Sat, 23 Apr 2022 23:41:36 +0000 (16:41 -0700)]
When suggesting to import an item, also suggest changing the path if appropriate

When we don't find an item we search all of them for an appropriate
import and suggest `use`ing it. This is sometimes done for expressions
that have paths with more than one segment. We now also suggest changing
that path to work with the `use`.

Fix #95413

2 years agoAuto merge of #96580 - CAD97:E0705-no-ignore, r=michaelwoerister
bors [Tue, 3 May 2022 00:45:18 +0000 (00:45 +0000)]
Auto merge of #96580 - CAD97:E0705-no-ignore, r=michaelwoerister

Remove `ignore` from E0705 test

Spotted this, and I think this can be made to test now.

2 years agoAuto merge of #92566 - the8472:inline-tra, r=m-ou-se
bors [Mon, 2 May 2022 21:45:20 +0000 (21:45 +0000)]
Auto merge of #92566 - the8472:inline-tra, r=m-ou-se

Inline `__iterator_get_unchecked` for some iterator adapters.

This aligns the inline attributes of existing `__iterator_get_unchecked` with those of `next()` on adapters that have both.

It improves the performance of iterators using unchecked access when building in incremental mode (due to the larger CGU count?). It might negatively affect incremental compile times for better runtime results, but considering that the equivalent `next()` implementations also are `#[inline]` and usually are more complex this should be ok.

```
./x.py bench library/core -i --stage 0 --test-args bench_trusted_random_access

OLD: 119,172 ns/iter
NEW:  17,714 ns/iter
```

2 years agoMitigate impact of subtle invalid call suggestion logic
Esteban Kuber [Mon, 2 May 2022 19:11:03 +0000 (19:11 +0000)]
Mitigate impact of subtle invalid call suggestion logic

There's some subtle interaction between inferred expressions being
passed as an argument to fn calls with fewer than expected arguments. To
avoid the ICE, I'm changing indexing operations with `.get(idx)`, but
the underlying logic still needs to be audited as it was written with
the assumption that `final_arg_types` and `provided_args` have the right
length.

Address 96638.

2 years agoAuto merge of #96578 - tmiasko:chunked-bit-set-fmt, r=nnethercote
bors [Mon, 2 May 2022 18:57:32 +0000 (18:57 +0000)]
Auto merge of #96578 - tmiasko:chunked-bit-set-fmt, r=nnethercote

Fix -Zdump-mir-dataflow by implementing DebugWithContext for ChunkedBitSet

`DebugWithContext` is used to format changes to dataflow state along with MIR
in graphviz dot files. In the case of `ChunkedBitSet` it was left unimplemented,
so attempts to use `-Zdump-mir-dataflow -Zdump-mir=all` resulted in an ICE:

> thread 'rustc' panicked at 'not implemented: implement when/if needed',

Provide the missing implementation.

r? `@nnethercote`

2 years agoThis aligns the inline attributes of existing `__iterator_get_unchecked` with those...
The 8472 [Wed, 5 Jan 2022 01:22:39 +0000 (02:22 +0100)]
This aligns the inline attributes of existing `__iterator_get_unchecked` with those of `next()` on adapters that have both.

It improves the performance of iterators using unchecked access when building in incremental mode
(due to the larger CGU count?). It might negatively affect incremental compile times for better runtime results,
but considering that the equivalent `next()` implementations also are `#[inline]` and usually are more complex this
should be ok.

```
./x.py bench library/core -i --stage 0 --test-args bench_trusted_random_access

OLD: 119,172 ns/iter
NEW:  17,714 ns/iter
```

2 years agoadd benchmark
The 8472 [Wed, 5 Jan 2022 01:28:30 +0000 (02:28 +0100)]
add benchmark

2 years agoAuto merge of #96436 - petrochenkov:nowhole2, r=wesleywiser
bors [Mon, 2 May 2022 16:28:47 +0000 (16:28 +0000)]
Auto merge of #96436 - petrochenkov:nowhole2, r=wesleywiser

linker: Stop using whole-archive on dependencies of dylibs

https://github.com/rust-lang/rust/pull/95604 implemented a better and more fine-grained way of keeping exported symbols alive.

Addresses the second question from https://github.com/rust-lang/rust/pull/93901#issuecomment-1041325522.
r? `@wesleywiser`

2 years agoUse a yes/no enum instead of a bool.
Oli Scherer [Mon, 2 May 2022 15:36:48 +0000 (15:36 +0000)]
Use a yes/no enum instead of a bool.

The bool's meaning wasn't obvious to me at some call sites.

2 years agoAuto merge of #96431 - petrochenkov:parent, r=cjgillot
bors [Mon, 2 May 2022 14:03:20 +0000 (14:03 +0000)]
Auto merge of #96431 - petrochenkov:parent, r=cjgillot

rustc: Panic by default in `DefIdTree::parent`

Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.

Same applies to `local_parent`/`opt_local_parent`.

2 years agoAuto merge of #96310 - bertptrs:remove-debugger-bootstrap, r=Mark-Simulacrum
bors [Mon, 2 May 2022 11:22:29 +0000 (11:22 +0000)]
Auto merge of #96310 - bertptrs:remove-debugger-bootstrap, r=Mark-Simulacrum

Remove DebbugerScripts from bootstrap CLI

This PR implements #95992 and removes the debugger scripts from the bootstrap CLI.

I could not find a lot of documentation on the bootstrap binary so perhaps there's still some documentation to be updated.

2 years agoremove the special case for nonexported macro_rules! macros
Yoshiki Matsuda [Mon, 2 May 2022 09:50:54 +0000 (18:50 +0900)]
remove the special case for nonexported macro_rules! macros

2 years agoFix invalid keyword order for function declarations
Ken Matsui [Mon, 2 May 2022 09:14:43 +0000 (18:14 +0900)]
Fix invalid keyword order for function declarations

2 years agoAuto merge of #96596 - scottmcm:limited-calloc, r=Mark-Simulacrum
bors [Mon, 2 May 2022 09:05:22 +0000 (09:05 +0000)]
Auto merge of #96596 - scottmcm:limited-calloc, r=Mark-Simulacrum

Tweak the vec-calloc runtime check to only apply to shortish-arrays

r? `@Mark-Simulacrum`

`@nbdd0121` pointed out in https://github.com/rust-lang/rust/pull/95362#issuecomment-1114085395 that LLVM currently doesn't constant-fold the `IsZero` check for long arrays, so that seems like a reasonable justification for limiting it.

It appears that it's based on length, not byte size, (https://godbolt.org/z/4s48Y81dP), so that's what I used in the PR.  Maybe it's a ["the number of inlining shall be three"](https://youtu.be/s4wnuiCwTGU?t=320) sort of situation.

Certainly there's more that could be done here -- that generated code that checks long arrays byte-by-byte is highly suboptimal, for example -- but this is an easy, low-risk tweak.

2 years agoAvoid use of `rand::thread_rng` in stdlib benchmarks
Thom Chiovoloni [Mon, 2 May 2022 06:10:56 +0000 (23:10 -0700)]
Avoid use of `rand::thread_rng` in stdlib benchmarks

2 years agoRemove DebbugerScripts from bootstrap CLI
Bert Peters [Fri, 22 Apr 2022 06:49:58 +0000 (08:49 +0200)]
Remove DebbugerScripts from bootstrap CLI

2 years agoAuto merge of #96600 - c410-f3r:z-errors, r=petrochenkov
bors [Mon, 2 May 2022 05:52:01 +0000 (05:52 +0000)]
Auto merge of #96600 - c410-f3r:z-errors, r=petrochenkov

Move some tests to more reasonable places

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`

16602 -> `codegen` because of https://github.com/rust-lang/rust/issues/16602#issuecomment-53806665

2 years agoTweak the calloc optimization to only apply to shortish-arrays
Scott McMurray [Sun, 1 May 2022 07:16:16 +0000 (00:16 -0700)]
Tweak the calloc optimization to only apply to shortish-arrays

2 years agoopenbsd: unbreak build on native platform
Sébastien Marie [Mon, 2 May 2022 04:55:04 +0000 (04:55 +0000)]
openbsd: unbreak build on native platform

after #95612, only linux and windows target are build with -Zunstable-options,
but others platforms might use -Csplit-debuginfo

add "openbsd" target in the list of platforms using it.

2 years agoAuto merge of #96622 - JohnTitor:rollup-8hckgaj, r=JohnTitor
bors [Mon, 2 May 2022 03:28:14 +0000 (03:28 +0000)]
Auto merge of #96622 - JohnTitor:rollup-8hckgaj, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #94126 (Classify BinaryHeap & LinkedList unit tests as such)
 - #96222 (Clarify docs for `from_raw_parts` on `Vec` and `String`)
 - #96499 (Make it possible to write doctests for bootstrap)
 - #96567 (Fix docs for u32 and i32 logs func)
 - #96568 (std::fmt: Various fixes and improvements to documentation)
 - #96571 (Add a bathroom stall to weird expressions test)
 - #96610 (Update browser-ui-test version to 0.9.0)

Failed merges:

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

2 years agoAdd comment
Austin Kiekintveld [Mon, 2 May 2022 02:07:36 +0000 (19:07 -0700)]
Add comment

2 years agoFix formatting
Austin Kiekintveld [Mon, 2 May 2022 02:02:28 +0000 (19:02 -0700)]
Fix formatting

2 years agoRollup merge of #96610 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Yuki Okushi [Mon, 2 May 2022 01:41:59 +0000 (10:41 +0900)]
Rollup merge of #96610 - GuillaumeGomez:update-browser-ui-test, r=notriddle

Update browser-ui-test version to 0.9.0

It adds the command `screenshot` and disables the screenshot comparison by default.

r? `@notriddle`

2 years agoRollup merge of #96571 - thomcc:bathroom-stall, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:59 +0000 (10:41 +0900)]
Rollup merge of #96571 - thomcc:bathroom-stall, r=Mark-Simulacrum

Add a bathroom stall to weird expressions test

2 years agoRollup merge of #96568 - EliasHolzmann:fmt_doc_fixes, r=joshtriplett
Yuki Okushi [Mon, 2 May 2022 01:41:58 +0000 (10:41 +0900)]
Rollup merge of #96568 - EliasHolzmann:fmt_doc_fixes, r=joshtriplett

std::fmt: Various fixes and improvements to documentation

This PR contains the following changes:

- **Added argument index comments to examples for specifying precision**

  The examples for specifying the precision have comments explaining which
  argument the specifier is referring to. However, for implicit positional
  arguments, the examples simply refer to "next arg". To simplify following the
  comments, "next arg" was supplemented with the actual resulting argument index.

- **Fixed documentation for specifying precision via `.*`**

  The documentation stated that in case of the syntax `{<arg>:<spec>.*}`, "the
  `<arg>` part refers to the value to print, and the precision must come in the
  input preceding `<arg>`". This is not correct: the <arg> part does indeed refer
  to the value to print, but the precision does not come in the input preciding
  arg, but in the next implicit input (as if specified with {}).

  Fixes #96413.

- **Fix the grammar documentation**

  According to the grammar documented, the format specifier `{: }` should not be
  legal because of the whitespace it contains. However, in reality, this is
  perfectly fine because the actual implementation allows spaces before the
  closing brace. Fixes #71088.

  Also, the exact meaning of most of the terminal symbols was not specified, for
  example the meaning of `identifier`.

- **Removed reference to Formatter::buf and other private fields**

  Formatter::buf is not a public field and therefore isn't very helpful in user-
  facing documentation. Also, the other public fields of Formatter were removed
  during stabilization of std::fmt (4af3494bb0) and can only be accessed via
  getters.

- **Improved list of formatting macros**

  Two improvements:
  1. write! can not only receive a `io::Write`, but also a `fmt::Write` as first argument.
  2. The description texts now contain links to the actual macros for easier
     navigation.

2 years agoRollup merge of #96567 - alex-semenyuk:fix_docs_for_logs_func, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:57 +0000 (10:41 +0900)]
Rollup merge of #96567 - alex-semenyuk:fix_docs_for_logs_func, r=Mark-Simulacrum

Fix docs for u32 and i32 logs func

Closes #96545

2 years agoRollup merge of #96499 - jyn514:bootstrap-doctests, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:56 +0000 (10:41 +0900)]
Rollup merge of #96499 - jyn514:bootstrap-doctests, r=Mark-Simulacrum

Make it possible to write doctests for bootstrap

This probably isn't super useful in practice, but it was easy to fix
and avoids confusing errors about mismatched versions between beta and the default toolchain.

2 years agoRollup merge of #96222 - jmaargh:john-mark/clarify-from-raw-parts-docs, r=JohnTitor
Yuki Okushi [Mon, 2 May 2022 01:41:55 +0000 (10:41 +0900)]
Rollup merge of #96222 - jmaargh:john-mark/clarify-from-raw-parts-docs, r=JohnTitor

Clarify docs for `from_raw_parts` on `Vec` and `String`

Closes #95427

Original safety explanation for `from_raw_parts` was unclear on safety for consuming a C string. This clarifies when doing so is safe.

2 years agoRollup merge of #94126 - ssomers:alloc_prep_1, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:54 +0000 (10:41 +0900)]
Rollup merge of #94126 - ssomers:alloc_prep_1, r=Mark-Simulacrum

Classify BinaryHeap & LinkedList unit tests as such

All but one of these so-called integration test case are unit tests, just like btree's were (#75531). In addition, reunite the unit tests of linked_list that were split off during #23104 because they needed to remain unit tests (they were later moved to the separate file they are in during #63207). The two sets could remain separate files, but I opted to merge them back together, more or less in the order they used to be, apart from one duplicate name `test_split_off` and one duplicate tiny function `list_from`.

2 years agoRelax memory ordering used in SameMutexCheck
Austin Kiekintveld [Sun, 1 May 2022 23:46:19 +0000 (16:46 -0700)]
Relax memory ordering used in SameMutexCheck

`SameMutexCheck` only requires atomicity for `self.addr`, but does not need ordering of other memory accesses in either the success or failure case. Using `Relaxed`, the code still correctly handles the case when two threads race to store an address.

2 years agorustc: Panic by default in `DefIdTree::parent`
Vadim Petrochenkov [Mon, 25 Apr 2022 19:08:45 +0000 (22:08 +0300)]
rustc: Panic by default in `DefIdTree::parent`

Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.

Same applies to `local_parent`/`opt_local_parent`.

2 years agoAuto merge of #96517 - ferrocene:pa-files-related-to-test, r=Mark-Simulacrum
bors [Sun, 1 May 2022 22:56:11 +0000 (22:56 +0000)]
Auto merge of #96517 - ferrocene:pa-files-related-to-test, r=Mark-Simulacrum

[compiletest] Extract code to detect files related to a test into a different function

In the code that checks whether a test needs to be re-executed, compiletest checks the modification date of all the files related to the test. I need the list of files related to the test for other purposes inside compiletest, and while I could copy/paste the code `is_up_to_date` runs, that would produce incomplete results if more related files are added in the future.

This PR extracts the code to detect related files into a separate function, allowing the rest of compiletest to access the same data.

r? `@Mark-Simulacrum`