]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #93655 - matthiaskrgr:rollup-dm88b02, r=matthiaskrgr
bors [Sat, 5 Feb 2022 01:47:59 +0000 (01:47 +0000)]
Auto merge of #93655 - matthiaskrgr:rollup-dm88b02, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90132 (Stabilize `-Z instrument-coverage` as `-C instrument-coverage`)
 - #91589 (impl `Arc::unwrap_or_clone`)
 - #93495 (kmc-solid: Fix off-by-one error in `SystemTime::now`)
 - #93576 (Emit more valid HTML from rustdoc)
 - #93608 (Clean up `find_library_crate`)
 - #93612 (doc: use U+2212 for minus sign in integer MIN/MAX text)
 - #93615 (Fix `isize` optimization in `StableHasher` for big-endian architectures)

Failed merges:

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

2 years agoRollup merge of #93615 - Kobzol:stable-hash-opt-endianness, r=the8472
Matthias Krüger [Fri, 4 Feb 2022 17:42:18 +0000 (18:42 +0100)]
Rollup merge of #93615 - Kobzol:stable-hash-opt-endianness, r=the8472

Fix `isize` optimization in `StableHasher` for big-endian architectures

This PR fixes a problem with the stable hash optimization introduced in https://github.com/rust-lang/rust/pull/93432. As `@michaelwoerister` has [found out](https://github.com/rust-lang/rust/pull/93432#issuecomment-1028756212), the original implementation wouldn't produce the same hash on little/big architectures.

r? `@the8472`

2 years agoRollup merge of #93612 - tspiteri:master, r=m-ou-se
Matthias Krüger [Fri, 4 Feb 2022 17:42:17 +0000 (18:42 +0100)]
Rollup merge of #93612 - tspiteri:master, r=m-ou-se

doc: use U+2212 for minus sign in integer MIN/MAX text

Closes #90793.

2 years agoRollup merge of #93608 - nnethercote:speed-up-find_library_crate, r=petrochenkov
Matthias Krüger [Fri, 4 Feb 2022 17:42:16 +0000 (18:42 +0100)]
Rollup merge of #93608 - nnethercote:speed-up-find_library_crate, r=petrochenkov

Clean up `find_library_crate`

Some clean-ups.

r? `@petrochenkov`

2 years agoRollup merge of #93576 - jsha:fix-rustdoc-html, r=GuillaumeGomez
Matthias Krüger [Fri, 4 Feb 2022 17:42:15 +0000 (18:42 +0100)]
Rollup merge of #93576 - jsha:fix-rustdoc-html, r=GuillaumeGomez

Emit more valid HTML from rustdoc

Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`.

However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements

We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section

After this change we get only three warnings from tidy, run on struct.String.html:

line 6 column 10790 - Warning: trimming empty <span>
line 1 column 1118 - Warning: <link> proprietary attribute "disabled"
line 1 column 1193 - Warning: <link> proprietary attribute "disabled"

The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue.

The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute.

We can suppress those warnings with flags to tidy, and get a run that returns 0 (success):

```
tidy -o /dev/null -quiet --drop-empty-elements no --warn-proprietary-attributes no build/x86_64-unknown-linux-gnu/doc/std/string/trait.ToString.html
```

Note: this requires the latest version of tidy-html5, built from https://github.com/htacg/tidy-html5. Older versions (including the default version on Ubuntu 21.10) think `<section>` can't occur inside `<summary>`.

Demo: https://rustdoc.crud.net/jsha/fix-rustdoc-html/std/string/struct.String.html

r? `@GuillaumeGomez`

2 years agoRollup merge of #93495 - solid-rs:fix-kmc-solid-rtc-month, r=yaahc
Matthias Krüger [Fri, 4 Feb 2022 17:42:14 +0000 (18:42 +0100)]
Rollup merge of #93495 - solid-rs:fix-kmc-solid-rtc-month, r=yaahc

kmc-solid: Fix off-by-one error in `SystemTime::now`

Fixes a miscalculation of `SystemTime`  on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

Unlike the identically-named libc counterpart `tm::tm_mon`, `SOLID_RTC_TIME::tm_mon` contains a 1-based month number.

2 years agoRollup merge of #91589 - derekdreery:arc_unwrap_or_clone, r=m-ou-se
Matthias Krüger [Fri, 4 Feb 2022 17:42:13 +0000 (18:42 +0100)]
Rollup merge of #91589 - derekdreery:arc_unwrap_or_clone, r=m-ou-se

impl `Arc::unwrap_or_clone`

The function gets the inner value, cloning only if necessary. The conversation started on [`irlo`](https://internals.rust-lang.org/t/arc-into-inner/15707). If the reviewer think the PR has potential to be merged, and does not need an RFC, then I will create the corresponding tracking issues and update the PR.

## Alternative names

 - `into_inner`
 - `make_owned`
 - `make_unique`
 - `take_*` (`take_inner`?)

2 years agoRollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser
Matthias Krüger [Fri, 4 Feb 2022 17:42:13 +0000 (18:42 +0100)]
Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser

Stabilize `-Z instrument-coverage` as `-C instrument-coverage`

(Tracking issue for `instrument-coverage`: https://github.com/rust-lang/rust/issues/79121)

This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.)

Many, many people have tested this support, and there are numerous reports of it working as expected.

Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option.

Addressing questions raised in the tracking issue:

> If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.)

This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration.

> The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline?

This stabilization PR depends on https://github.com/rust-lang/rust/pull/90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version).

> The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM.

Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement.

The [tracking issue](https://github.com/rust-lang/rust/issues/79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization.

The original `-Z instrument-coverage` support went through a compiler-team MCP at https://github.com/rust-lang/compiler-team/issues/278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.

2 years agoAuto merge of #93654 - RalfJung:miri, r=RalfJung
bors [Fri, 4 Feb 2022 17:40:02 +0000 (17:40 +0000)]
Auto merge of #93654 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/93355
r? `@ghost`

2 years agoupdate miri
Ralf Jung [Fri, 4 Feb 2022 17:26:16 +0000 (18:26 +0100)]
update miri

2 years agodoc: use U+2212 for minus sign in integer MIN/MAX text
Trevor Spiteri [Fri, 4 Feb 2022 16:59:53 +0000 (17:59 +0100)]
doc: use U+2212 for minus sign in integer MIN/MAX text

2 years agoAuto merge of #93645 - matthiaskrgr:rollup-eua2621, r=matthiaskrgr
bors [Fri, 4 Feb 2022 14:33:00 +0000 (14:33 +0000)]
Auto merge of #93645 - matthiaskrgr:rollup-eua2621, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #92735 (Add crate filter parameter in URL)
 - #93402 (Windows: Disable LLVM crash dialog boxes.)
 - #93508 (Add rustdoc info to jsondocck output)
 - #93551 (Add package.json in gitignore)
 - #93555 (Link `try_exists` docs to `Path::exists`)
 - #93585 (Missing tests for #92630)
 - #93593 (Fix ret > 1 bound if shadowed by const)
 - #93630 (clippy::perf fixes)
 - #93631 (rustc_mir_dataflow: use iter::once instead of Some().into_iter)
 - #93632 (rustdoc: clippy::complexity fixes)
 - #93638 (rustdoc: remove unused Hash impl)

Failed merges:

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

2 years agoRollup merge of #93638 - notriddle:notriddle/unused-hash, r=GuillaumeGomez
Matthias Krüger [Fri, 4 Feb 2022 13:59:08 +0000 (14:59 +0100)]
Rollup merge of #93638 - notriddle:notriddle/unused-hash, r=GuillaumeGomez

rustdoc: remove unused Hash impl

2 years agoRollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomez
Matthias Krüger [Fri, 4 Feb 2022 13:59:07 +0000 (14:59 +0100)]
Rollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomez

rustdoc: clippy::complexity fixes

clippy::map_flatten
clippy::clone_on_copy
clippy::useless_conversion
clippy::needless_arbitrary_self_type

2 years agoRollup merge of #93631 - notriddle:notriddle/cleanup-some-into-iter, r=oli-obk
Matthias Krüger [Fri, 4 Feb 2022 13:59:06 +0000 (14:59 +0100)]
Rollup merge of #93631 - notriddle:notriddle/cleanup-some-into-iter, r=oli-obk

rustc_mir_dataflow: use iter::once instead of Some().into_iter

2 years agoRollup merge of #93630 - matthiaskrgr:clipperf, r=oli-obk
Matthias Krüger [Fri, 4 Feb 2022 13:59:05 +0000 (14:59 +0100)]
Rollup merge of #93630 - matthiaskrgr:clipperf, r=oli-obk

clippy::perf fixes

single_char_pattern and to_string_in_format_args

2 years agoRollup merge of #93593 - JulianKnodt:master, r=oli-obk
Matthias Krüger [Fri, 4 Feb 2022 13:59:04 +0000 (14:59 +0100)]
Rollup merge of #93593 - JulianKnodt:master, r=oli-obk

Fix ret > 1 bound if shadowed by const

Prior to a change, it would only look at types in bounds. When it started looking for consts,
shadowing type variables with a const would cause an ICE, so now defer looking at consts only if
there are no types present.

cc ``````@compiler-errors``````
Should Fix #93553

2 years agoRollup merge of #93585 - tamaroning:add_tests_for_92630, r=m-ou-se
Matthias Krüger [Fri, 4 Feb 2022 13:59:03 +0000 (14:59 +0100)]
Rollup merge of #93585 - tamaroning:add_tests_for_92630, r=m-ou-se

Missing tests for #92630

fixes #93143

2 years agoRollup merge of #93555 - ChrisDenton:fs-try-exists-doc, r=Mark-Simulacrum
Matthias Krüger [Fri, 4 Feb 2022 13:59:02 +0000 (14:59 +0100)]
Rollup merge of #93555 - ChrisDenton:fs-try-exists-doc, r=Mark-Simulacrum

Link `try_exists` docs to `Path::exists`

Links to the existing `Path::exists` method from both `std::Path::try_exists` and `std::fs:try_exists`.

Tracking issue for `path_try_exists`: #83186

2 years agoRollup merge of #93551 - GuillaumeGomez:ignore-package-json, r=Mark-Simulacrum
Matthias Krüger [Fri, 4 Feb 2022 13:59:00 +0000 (14:59 +0100)]
Rollup merge of #93551 - GuillaumeGomez:ignore-package-json, r=Mark-Simulacrum

Add package.json in gitignore

It happened a few times (last one is https://github.com/rust-lang/rust/pull/93537/files#r796757998) so I think it's fine to ignore this file to prevent it to happen again in the future. :)

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

2 years agoRollup merge of #93508 - CraftSpider:jsondocck-runtest-output, r=Mark-Simulacrum
Matthias Krüger [Fri, 4 Feb 2022 13:58:59 +0000 (14:58 +0100)]
Rollup merge of #93508 - CraftSpider:jsondocck-runtest-output, r=Mark-Simulacrum

Add rustdoc info to jsondocck output

Makes debugging issues in the generated output simpler by handling emitted logs and etc.

2 years agoRollup merge of #93402 - ehuss:llvm-dialog, r=michaelwoerister
Matthias Krüger [Fri, 4 Feb 2022 13:58:57 +0000 (14:58 +0100)]
Rollup merge of #93402 - ehuss:llvm-dialog, r=michaelwoerister

Windows: Disable LLVM crash dialog boxes.

This disables the crash dialog box on Windows. When LLVM hits an assertion, it will open a dialog box with Abort/Retry/Ignore. This is annoying on CI because CI will just hang until it times out (which can take hours).

Instead of opening a dialog box, it will print a message like this:

```
Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file D:\Proj\rust\rust\src\llvm-project\llvm\include\llvm/Support/Casting.h, line 255
```

Closes #92829

2 years agoRollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jsha
Matthias Krüger [Fri, 4 Feb 2022 13:58:56 +0000 (14:58 +0100)]
Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jsha

Add crate filter parameter in URL

Fixes #92621.

r? `@jsha`

2 years agoAdd a comment about possible mismatches.
Nicholas Nethercote [Fri, 4 Feb 2022 02:08:21 +0000 (13:08 +1100)]
Add a comment about possible mismatches.

2 years agoRemove `staticlibs` local variable.
Nicholas Nethercote [Thu, 3 Feb 2022 22:56:18 +0000 (09:56 +1100)]
Remove `staticlibs` local variable.

2 years agoFix some tests to use -Cinstrument-coverage
Wesley Wiser [Fri, 4 Feb 2022 00:59:47 +0000 (19:59 -0500)]
Fix some tests to use -Cinstrument-coverage

2 years agorustdoc: remove unused Hash impl
Michael Howell [Fri, 4 Feb 2022 00:01:32 +0000 (17:01 -0700)]
rustdoc: remove unused Hash impl

2 years agoClean up `find_library_crate`.
Nicholas Nethercote [Thu, 3 Feb 2022 22:36:17 +0000 (09:36 +1100)]
Clean up `find_library_crate`.

By introducing prefix and suffix variables for all file types, and
renaming some variables.

2 years agorustdoc: clippy::complexity fixes
Matthias Krüger [Thu, 3 Feb 2022 21:28:19 +0000 (22:28 +0100)]
rustdoc: clippy::complexity fixes

clippy::map_flatten
clippy::clone_on_copy
clippy::useless_conversion
clippy::needless_arbitrary_self_type

2 years agoAdd GUI test for crate filter URL parameter
Guillaume Gomez [Mon, 10 Jan 2022 16:48:07 +0000 (17:48 +0100)]
Add GUI test for crate filter URL parameter

2 years agoUpdate tester to have FILTER_CRATE set to null if undefined.
Guillaume Gomez [Thu, 3 Feb 2022 21:43:02 +0000 (22:43 +0100)]
Update tester to have FILTER_CRATE set to null if undefined.

2 years agoAdd filter-crate URL parameter
Guillaume Gomez [Mon, 10 Jan 2022 13:57:43 +0000 (14:57 +0100)]
Add filter-crate URL parameter

2 years agorustc_mir_dataflow: use iter::once instead of Some().into_iter
Michael Howell [Thu, 3 Feb 2022 20:51:37 +0000 (13:51 -0700)]
rustc_mir_dataflow: use iter::once instead of Some().into_iter

2 years agoclippy::perf fixes
Matthias Krüger [Thu, 3 Feb 2022 20:44:47 +0000 (21:44 +0100)]
clippy::perf fixes

single_char_pattern and to_string_in_format_args

2 years agoAuto merge of #93621 - JohnTitor:rollup-1bcud0x, r=JohnTitor
bors [Thu, 3 Feb 2022 15:49:30 +0000 (15:49 +0000)]
Auto merge of #93621 - JohnTitor:rollup-1bcud0x, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #92310 (rustdoc: Fix ICE report)
 - #92802 (Deduplicate lines in long const-eval stack trace)
 - #93515 (Factor convenience functions out of main printer implementation)
 - #93566 (Make rustc use `RUST_BACKTRACE=full` by default)
 - #93589 (Use Option::then in two places)
 - #93600 (fix: Remove extra newlines from junit output)
 - #93606 (Correct incorrect description of preorder traversals)

Failed merges:

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

2 years agoFix ret > 1 bound if shadowed by const
kadmin [Wed, 2 Feb 2022 16:42:37 +0000 (16:42 +0000)]
Fix ret > 1 bound if shadowed by const

Prior to a change, it would only look at types in bounds. When it started looking for consts,
shadowing type variables with a const would cause an ICE, so now defer looking at consts only if
there are no types present.

2 years agoOnly disable dialogs on CI.
Eric Huss [Thu, 3 Feb 2022 15:03:44 +0000 (07:03 -0800)]
Only disable dialogs on CI.

The "CI" environment var isn't universal (for example, I think Azure
uses TF_BUILD). However, we are mostly concerned with rust-lang/rust's
own CI which currently is GitHub Actions which does set "CI". And I
think most other providers use "CI" as well.

2 years agoRollup merge of #93606 - JakobDegen:mischaracterized-preorder, r=oli-obk
Yuki Okushi [Thu, 3 Feb 2022 13:20:29 +0000 (22:20 +0900)]
Rollup merge of #93606 - JakobDegen:mischaracterized-preorder, r=oli-obk

Correct incorrect description of preorder traversals

The internal documentation for the `Preorder` type gave an incorrect description (the description is not even correct for the example provided, since C is visited after one of its successors). This corrects the description, and adds in a sentence explaining more precisely how the traversals are performed.

2 years agoRollup merge of #93600 - last-partizan:fix-junit-formatter, r=yaahc
Yuki Okushi [Thu, 3 Feb 2022 13:20:28 +0000 (22:20 +0900)]
Rollup merge of #93600 - last-partizan:fix-junit-formatter, r=yaahc

fix: Remove extra newlines from junit output

This PR fixes extra newline in junit output https://github.com/rust-lang/rust/issues/93454

2 years agoRollup merge of #93589 - est31:option_then, r=cjgillot
Yuki Okushi [Thu, 3 Feb 2022 13:20:27 +0000 (22:20 +0900)]
Rollup merge of #93589 - est31:option_then, r=cjgillot

Use Option::then in two places

2 years agoRollup merge of #93566 - Aaron1011:rustc-backtrace, r=davidtwco
Yuki Okushi [Thu, 3 Feb 2022 13:20:26 +0000 (22:20 +0900)]
Rollup merge of #93566 - Aaron1011:rustc-backtrace, r=davidtwco

Make rustc use `RUST_BACKTRACE=full` by default

Compiler panics should be rare - when they do occur, we want the report
filed by the user to contain as much information as possible. This is
especially important when the panic is due to an incremental compilation
bug, since we may not have enough information to reproduce it.

This PR sets `RUST_BACKTRACE=full` inside `rustc` if the user has not
explicitly set `RUST_BACKTRACE`. This is more verbose than
`RUST_BACKTRACE=1`, but this may make it easier to debug incremental
compilation issues. Users who find this too verbose can still manually
set `RUST_BACKTRACE` before invoking the compiler.

This only affects `rustc` (and any tool using `rustc_driver::install_ice_hook`).
It does *not* affect any user crates or the standard library -
backtraces will continue to be off by default in any application
*compiled* by rustc.

2 years agoRollup merge of #93515 - dtolnay:convenience, r=davidtwco
Yuki Okushi [Thu, 3 Feb 2022 13:20:25 +0000 (22:20 +0900)]
Rollup merge of #93515 - dtolnay:convenience, r=davidtwco

Factor convenience functions out of main printer implementation

The pretty printer in rustc_ast_pretty has a section of methods commented "Convenience functions to talk to the printer". This PR pulls those out to a separate module. This leaves pp.rs with only the minimal API that is core to the pretty printing algorithm.

I found this separation to be helpful in https://github.com/dtolnay/prettyplease because it makes clear when changes are adding some fundamental new capability to the pretty printer algorithm vs just making it more convenient to call some already existing functionality.

2 years agoRollup merge of #92802 - compiler-errors:deduplicate-stack-trace, r=oli-obk
Yuki Okushi [Thu, 3 Feb 2022 13:20:24 +0000 (22:20 +0900)]
Rollup merge of #92802 - compiler-errors:deduplicate-stack-trace, r=oli-obk

Deduplicate lines in long const-eval stack trace

Lemme know if this is kinda overkill, lol.

Fixes #92796

2 years agoRollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
Yuki Okushi [Thu, 3 Feb 2022 13:20:23 +0000 (22:20 +0900)]
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank

rustdoc: Fix ICE report

The ICE report in rustdoc was confusing because it was returning an argument parse error:

```
thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'
```

This is because the ICE reporter was trying to parse the arguments as rustc, not rustdoc.  Since an argument error is a fatal error, it was early-exiting with the argument error due to unwinding.

This changes it to be a more primitive scan of the arguments. The arguments being checked are pretty simple, and only have a small handful of forms that are easy to check for.

It now looks like this:

```
thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.59.0-dev running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -Z treat-err-as-bug

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
```

It still says `rustc`, but I can live with that.

2 years agoAuto merge of #92932 - ouz-a:master, r=oli-obk
bors [Thu, 3 Feb 2022 12:46:02 +0000 (12:46 +0000)]
Auto merge of #92932 - ouz-a:master, r=oli-obk

Temporary fix for the layout of aligned enums

Fix for the issue #92464

~~I was after this issue for quite some time now, I have a temporary fix for it.
I think the current problem is [here](https://github.com/ouz-a/rust/blob/e75f96763f99d56d03ada939fe05cbeb2254888d/compiler/rustc_middle/src/ty/layout.rs#L1305-L1310) created `tag` value might be wrong, because when I checked `min` and `max` values it's always between 0..1, which results in wrong size comparison in a few lines down below.
I think `min` and `max` values don't take `#[repr(aligned(8))]` into consideration and just act from base values assigned inside the enum. If what I am saying is true, aligned enums were created with the wrong layout for some time.~~

~~As stated in the title this is only a temporary fix and I think this needs further investigation, if someone wants to mentor it I would like to work on that too.~~ 😸

**Edit: Weird some tests fail now going to close this for now...**

**Edit2: I made it work again.**

I think I figured out the main problem of the issue, layout types of aligned enums with custom discriminant types were not handled, which resulted in confusing(such as this issue) behavior down the line, this is a kinda hacky fix for the issue.

2 years agoFix `isize` optimization in `StableHasher` for big-endian architectures
Jakub Beránek [Thu, 3 Feb 2022 10:47:41 +0000 (11:47 +0100)]
Fix `isize` optimization in `StableHasher` for big-endian architectures

2 years agoAdd tracking issue and impl for `Rc`.
Richard Dodd [Thu, 3 Feb 2022 09:35:21 +0000 (09:35 +0000)]
Add tracking issue and impl for `Rc`.

2 years agoimpl `Arc::unwrap_or_clone`
Richard Dodd [Mon, 6 Dec 2021 11:25:42 +0000 (11:25 +0000)]
impl `Arc::unwrap_or_clone`

The function gets the inner value, cloning only if necessary.

2 years agoAuto merge of #93146 - workingjubilee:use-std-simd, r=Mark-Simulacrum
bors [Thu, 3 Feb 2022 09:15:16 +0000 (09:15 +0000)]
Auto merge of #93146 - workingjubilee:use-std-simd, r=Mark-Simulacrum

pub use std::simd::StdFloat;

Syncs portable-simd up to commit rust-lang/portable-simd@03f6fbb21e6050da2a05b3ce8f480c020b384916,
Diff: https://github.com/rust-lang/portable-simd/compare/533f0fc81ab9ba097779fcd27c8f9ea12261fef5...03f6fbb21e6050da2a05b3ce8f480c020b384916

This sync requires a little bit more legwork because it also introduces a trait into `std::simd`, so that it is no longer simply a reexport of `core::simd`. Out of simple-minded consistency and to allow more options, I replicated the pattern for the way `core::simd` is integrated in the first place, however this is not necessary if it doesn't acquire any interdependencies inside `std`: it could be a simple crate reexport. I just don't know yet if that will happen or not.

To summarize other misc changes:
- Shifts no longer panic, now wrap on too-large shifts (like `Simd` integers usually do!)
- mask16x32 will now be many i16s, not many i32s... 🙃
- `#[must_use]` is spread around generously
- Adjusts division, float min/max, and `Mask::{from,to}_array` internally to be faster
- Adds the much-requested `Simd::cast::<U>` function (equivalent to `simd.to_array().map(|lane| lane as U)`)

2 years agoAuto merge of #93432 - Kobzol:stable-hash-isize-hash-compression, r=the8472
bors [Thu, 3 Feb 2022 01:08:45 +0000 (01:08 +0000)]
Auto merge of #93432 - Kobzol:stable-hash-isize-hash-compression, r=the8472

Compress amount of hashed bytes for `isize` values in StableHasher

This is another attempt to land https://github.com/rust-lang/rust/pull/92103, this time hopefully with a correct implementation w.r.t. stable hashing guarantees. The previous PR was [reverted](https://github.com/rust-lang/rust/pull/93014) because it could produce the [same hash](https://github.com/rust-lang/rust/pull/92103#issuecomment-1014625442) for different values even in quite simple situations. I have since added a basic [test](https://github.com/rust-lang/rust/pull/93193) that should guard against that situation, I also added a new test in this PR, specialised for this optimization.

## Why this optimization helps
Since the original PR, I have tried to analyze why this optimization even helps (and why it especially helps for `clap`). I found that the vast majority of stable-hashing `i64` actually comes from hashing `isize` (which is converted to `i64` in the stable hasher). I only found a single place where is this datatype used directly in the compiler, and this place has also been showing up in traces that I used to find out when is `isize` being hashed. This place is `rustc_span::FileName::DocTest`, however, I suppose that isizes also come from other places, but they might not be so easy to find (there were some other entries in the trace). `clap` hashes about 8.5 million `isize`s, and all of them fit into a single byte, which is why this optimization has helped it [quite a lot](https://github.com/rust-lang/rust/pull/92103#issuecomment-1005711861).

Now, I'm not sure if special casing `isize` is the correct solution here, maybe something could be done with that `isize` inside `DocTest` or in other places, but that's for another discussion I suppose. In this PR, instead of hardcoding a special case inside `SipHasher128`, I instead put it into `StableHasher`, and only used it for `isize` (I tested that for `i64` it doesn't help, or at least not for `clap` and other few benchmarks that I was testing).

## New approach
Since the most common case is a single byte, I added a fast path for hashing `isize` values which positive value fits within a single byte, and a cold path for the rest of the values.

To avoid the previous correctness problem, we need to make sure that each unique `isize` value will produce a unique hash stream to the hasher. By hash stream I mean a sequence of bytes that will be hashed (a different sequence should produce a different hash, but that is of course not guaranteed).

We have to distinguish different values that produce the same bit pattern when we combine them. For example, if we just simply skipped the leading zero bytes for values that fit within a single byte, `(0xFF, 0xFFFFFFFFFFFFFFFF)` and `(0xFFFFFFFFFFFFFFFF, 0xFF)` would send the same hash stream to the hasher, which must not happen.

To avoid this situation, values `[0, 0xFE]` are hashed as a single byte. When we hash a larger (treating `isize` as `u64`) value, we first hash an additional byte `0xFF`. Since `0xFF` cannot occur when we apply the single byte optimization, we guarantee that the hash streams will be unique when hashing two values `(a, b)` and `(b, a)` if `a != b`:
1) When both `a` and `b` are within `[0, 0xFE]`, their hash streams will be different.
2) When neither `a` and `b` are within `[0, 0xFE]`, their hash streams will be different.
3) When `a` is within `[0, 0xFE]` and `b` isn't, when we hash `(a, b)`, the hash stream will definitely not begin with `0xFF`. When we hash `(b, a)`, the hash stream will definitely begin with `0xFF`. Therefore the hash streams will be different.

r? `@the8472`

2 years agoCorrect incorrect description of preorder traversals.
Jakob Degen [Thu, 3 Feb 2022 00:28:01 +0000 (19:28 -0500)]
Correct incorrect description of preorder traversals.

2 years agoAuto merge of #93101 - Mark-Simulacrum:library-backtrace, r=yaahc
bors [Wed, 2 Feb 2022 22:03:23 +0000 (22:03 +0000)]
Auto merge of #93101 - Mark-Simulacrum:library-backtrace, r=yaahc

Support configuring whether to capture backtraces at runtime

Tracking issue: https://github.com/rust-lang/rust/issues/93346

This adds a new API to the `std::panic` module which configures whether and how the default panic hook will emit a backtrace when a panic occurs.

After discussion with `@yaahc` on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/backtrace.20lib.20vs.2E.20panic), this PR chooses to avoid adjusting or seeking to provide a similar API for the (currently unstable) std::backtrace API. It seems likely that the users of that API may wish to expose more specific settings rather than just a global one (e.g., emulating the `env_logger`, `tracing` per-module configuration) to avoid the cost of capture in hot code. The API added here could plausibly be copied and/or re-exported directly from std::backtrace relatively easily, but I don't think that's the right call as of now.

```rust
mod panic {
    #[derive(Copy, Clone, Debug, PartialEq, Eq)]
    #[non_exhaustive]
    pub enum BacktraceStyle {
        Short,
        Full,
        Off,
    }
    fn set_backtrace_style(BacktraceStyle);
    fn get_backtrace_style() -> Option<BacktraceStyle>;
}
```

Several unresolved questions:

* Do we need to move to a thread-local or otherwise more customizable strategy for whether to capture backtraces? See [this comment](https://github.com/rust-lang/rust/pull/79085#issuecomment-727845826) for some potential use cases for this.
   * Proposed answer: no, leave this for third-party hooks.
* Bikeshed on naming of all the options, as usual.
* Should BacktraceStyle be moved into `std::backtrace`?
   * It's already somewhat annoying to import and/or re-type the `std::panic::` prefix necessary to use these APIs, probably adding a second module to the mix isn't worth it.

Note that PR #79085 proposed a much simpler API, but particularly in light of the desire to fully replace setting environment variables via `env::set_var` to control the backtrace API, a more complete API seems preferable. This PR likely subsumes that one.

2 years agoUnify storage getter and setter functions
Guillaume Gomez [Mon, 10 Jan 2022 13:50:16 +0000 (14:50 +0100)]
Unify storage getter and setter functions

2 years agofix: Remove extra newlines from junit output
Serg Tereshchenko [Tue, 1 Feb 2022 19:41:24 +0000 (21:41 +0200)]
fix: Remove extra newlines from junit output

2 years agoAuto merge of #93594 - matthiaskrgr:rollup-lcvhpdv, r=matthiaskrgr
bors [Wed, 2 Feb 2022 19:07:07 +0000 (19:07 +0000)]
Auto merge of #93594 - matthiaskrgr:rollup-lcvhpdv, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #92528 (Make `Fingerprint::combine_commutative` associative)
 - #93221 ([borrowck] Fix help on mutating &self in async fns)
 - #93542 (Prevent lifetime elision in type alias)
 - #93546 (Validate that values in switch int terminator are unique)
 - #93571 (better suggestion for duplicated `where` clause)
 - #93574 (don't suggest adding `let` due to bad assignment expressions inside of `while` loop)
 - #93590 (More let_else adoptions)
 - #93592 (Remove unused dep from rustc_arena)

Failed merges:

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

2 years agoConfigure panic hook backtrace behavior
Mark Rousskov [Wed, 26 Jan 2022 03:14:26 +0000 (22:14 -0500)]
Configure panic hook backtrace behavior

2 years agoRollup merge of #93592 - est31:remove_unused_deps, r=bjorn3
Matthias Krüger [Wed, 2 Feb 2022 18:34:08 +0000 (19:34 +0100)]
Rollup merge of #93592 - est31:remove_unused_deps, r=bjorn3

Remove unused dep from rustc_arena

2 years agoRollup merge of #93590 - est31:let_else, r=lcnr
Matthias Krüger [Wed, 2 Feb 2022 18:34:07 +0000 (19:34 +0100)]
Rollup merge of #93590 - est31:let_else, r=lcnr

More let_else adoptions

Continuation of #89933, #91018, #91481, #93046.

2 years agoRollup merge of #93574 - compiler-errors:bad-let-suggestion, r=lcnr
Matthias Krüger [Wed, 2 Feb 2022 18:34:06 +0000 (19:34 +0100)]
Rollup merge of #93574 - compiler-errors:bad-let-suggestion, r=lcnr

don't suggest adding `let` due to bad assignment expressions inside of `while` loop

adds a check that our `lhs` expression is actually within the conditional part of the `while` loop, instead of anywhere in the `while` body.

fixes #93486

2 years agoRollup merge of #93571 - compiler-errors:better-where-suggestion, r=lcnr
Matthias Krüger [Wed, 2 Feb 2022 18:34:05 +0000 (19:34 +0100)]
Rollup merge of #93571 - compiler-errors:better-where-suggestion, r=lcnr

better suggestion for duplicated `where` clause

fixes #93567

2 years agoRollup merge of #93546 - tmiasko:validate-switch-int, r=oli-obk
Matthias Krüger [Wed, 2 Feb 2022 18:34:04 +0000 (19:34 +0100)]
Rollup merge of #93546 - tmiasko:validate-switch-int, r=oli-obk

Validate that values in switch int terminator are unique

2 years agoRollup merge of #93542 - GuillaumeGomez:lifetime-elision, r=oli-obk
Matthias Krüger [Wed, 2 Feb 2022 18:34:03 +0000 (19:34 +0100)]
Rollup merge of #93542 - GuillaumeGomez:lifetime-elision, r=oli-obk

Prevent lifetime elision in type alias

Fixes #93401.

Apparently, the problem has been fixed in the compiler.

r? `@oli-obk`

2 years agoRollup merge of #93221 - alyssaverkade:fix-93093, r=wesleywiser
Matthias Krüger [Wed, 2 Feb 2022 18:34:02 +0000 (19:34 +0100)]
Rollup merge of #93221 - alyssaverkade:fix-93093, r=wesleywiser

[borrowck] Fix help on mutating &self in async fns

Previously, when rustc was provided an async function that tried to
mutate through a shared reference to an implicit self (as shown in the
ui test), rustc would suggest modifying the parameter signature
to `&mut` + the fully qualified name of the ty (in the case of the repro
`S`). If a user modified their code to match the suggestion, the
compiler would not accept it.

This commit modifies the suggestion so that when rustc is provided the
ui test that is also attached in this commit, it suggests (correctly)
`&mut self`. We try to be careful about distinguishing between implicit
and explicit self annotations, since the latter seem to be handled
correctly already.

This is my first PR here so I'm pretty sure I probably missed something/could use better terminology. I also didn't try to make the match exhaustive since implicit self is the only real special case that I need to handle (that I'm aware of), and I'm pretty sure there's a cleaner way to do this so any advice would be greatly appreciated! (I'm also not terribly confident about how I wrote the ui tests)

here is your cc as requested `@compiler-errors`

This is an attempt to fix #93093

2 years agoRollup merge of #92528 - tmiasko:combine-commutative, r=michaelwoerister
Matthias Krüger [Wed, 2 Feb 2022 18:34:01 +0000 (19:34 +0100)]
Rollup merge of #92528 - tmiasko:combine-commutative, r=michaelwoerister

Make `Fingerprint::combine_commutative` associative

The previous implementation swapped lower and upper 64-bits of a result
of modular addition, so the function was non-associative.

r? `@Aaron1011`

2 years agoRemove unused dep from rustc_arena
est31 [Wed, 2 Feb 2022 16:37:14 +0000 (17:37 +0100)]
Remove unused dep from rustc_arena

2 years agoMore let_else adoptions
est31 [Wed, 2 Feb 2022 11:45:20 +0000 (12:45 +0100)]
More let_else adoptions

2 years agoAuto merge of #93312 - pierwill:map-all-local-trait-impls, r=cjgillot
bors [Wed, 2 Feb 2022 15:36:12 +0000 (15:36 +0000)]
Auto merge of #93312 - pierwill:map-all-local-trait-impls, r=cjgillot

Return an indexmap in `all_local_trait_impls` query

The data structure previously used here required that `DefId` be `Ord`. As part of #90317, we do not want `DefId` to implement `Ord`.

2 years agoUse Option::then in two places
est31 [Wed, 2 Feb 2022 15:08:05 +0000 (16:08 +0100)]
Use Option::then in two places

2 years agoadd tests
tamaron [Wed, 2 Feb 2022 14:07:02 +0000 (23:07 +0900)]
add tests

2 years agoAuto merge of #93154 - michaelwoerister:fix-generic-closure-and-generator-debuginfo...
bors [Wed, 2 Feb 2022 12:37:28 +0000 (12:37 +0000)]
Auto merge of #93154 - michaelwoerister:fix-generic-closure-and-generator-debuginfo, r=wesleywiser

debuginfo: Make sure that type names for closure and generator environments are unique in debuginfo.

Before this change, closure/generator environments coming from different instantiations of the same generic function were all assigned the same name even though they were distinct types with potentially different data layout. Now we append the generic arguments of the originating function to the type name.

This commit also emits `{closure_env#0}` as the name of these types in order to disambiguate them from the accompanying closure function (which keeps being called `{closure#0}`). Previously both were assigned the same name.

NOTE: Changing debuginfo names like this can break pretty printers and other debugger plugins. I think it's OK in this particular case because the names we are changing were ambiguous anyway. In general though it would be great to have a process for doing changes like these.

2 years agoAuto merge of #93573 - matthiaskrgr:rollup-nrjmygz, r=matthiaskrgr
bors [Wed, 2 Feb 2022 09:39:18 +0000 (09:39 +0000)]
Auto merge of #93573 - matthiaskrgr:rollup-nrjmygz, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92758 (librustdoc: impl core::fmt::Write for rustdoc::html::render::Buffer)
 - #92788 (Detect `::` -> `:` typo in type argument)
 - #93420 (Improve wrapping on settings page)
 - #93493 (Document valid values of the char type)
 - #93531 (Fix incorrect panic message in example)
 - #93559 (Add missing | between print options)
 - #93560 (Fix two incorrect "it's" (typos in comments))

Failed merges:

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

2 years agobetter suggestion for duplicated `where`
Michael Goulet [Wed, 2 Feb 2022 05:44:44 +0000 (21:44 -0800)]
better suggestion for duplicated `where`

2 years agoEmit valid HTML from rustdoc
Jacob Hoffman-Andrews [Wed, 2 Feb 2022 06:11:36 +0000 (22:11 -0800)]
Emit valid HTML from rustdoc

Previously, tidy-html5 (`tidy`) would complain about a few things in our
HTML. The main thing is that `<summary>` tags can't contain `<div>`s.
That's easily fixed by changing out the `<div>`s for `<span>`s with
`display: block`.

However, there's also a rule that `<span>`s can't contain heading
elements. `<span>` permits only "phrasing content"
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and
`<h3>` (and friends) are "Flow content, heading content, palpable
content".
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements

We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`,
etc. We turn that into a `<section>` rather than a `<span>` because
`<section>` permits "flow content".
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section

After this change we get only three warnings from tidy, run on
struct.String.html:

line 6 column 10790 - Warning: trimming empty <span>
line 1 column 1118 - Warning: <link> proprietary attribute "disabled"
line 1 column 1193 - Warning: <link> proprietary attribute "disabled"

The empty `<span>` is a known issue - there's a span in front of the
search box to work around a strange Safari issue.

The `<link>` attributes are the non-default stylesheets. We can probably
refactor theme application to avoid using this proprietary "disabled"
attribute.

2 years agodon't suggest adding `let` due to expressions inside of `while` loop
Michael Goulet [Wed, 2 Feb 2022 07:27:04 +0000 (23:27 -0800)]
don't suggest adding `let` due to expressions inside of `while` loop

2 years agoRollup merge of #93560 - steffahn:a_typo, r=petrochenkov
Matthias Krüger [Wed, 2 Feb 2022 06:11:09 +0000 (07:11 +0100)]
Rollup merge of #93560 - steffahn:a_typo, r=petrochenkov

Fix two incorrect "it's" (typos in comments)

Found one of these while reading the documentation online. The other came up because it's in the same file.

2 years agoRollup merge of #93559 - danielframpton:link-args-typo, r=oli-obk
Matthias Krüger [Wed, 2 Feb 2022 06:11:08 +0000 (07:11 +0100)]
Rollup merge of #93559 - danielframpton:link-args-typo, r=oli-obk

Add missing | between print options

The help text for the newly stabilized print option is missing a | between stack-protector-strategies and link-args.

2 years agoRollup merge of #93531 - TheColdVoid:patch-1, r=m-ou-se
Matthias Krüger [Wed, 2 Feb 2022 06:11:07 +0000 (07:11 +0100)]
Rollup merge of #93531 - TheColdVoid:patch-1, r=m-ou-se

Fix incorrect panic message in example

The panic message when calling the `connect()` should probably be a  message about connection failure, not a message about binding address failure.

2 years agoRollup merge of #93493 - GKFX:char-docs-2, r=scottmcm
Matthias Krüger [Wed, 2 Feb 2022 06:11:07 +0000 (07:11 +0100)]
Rollup merge of #93493 - GKFX:char-docs-2, r=scottmcm

Document valid values of the char type

As discussed at #93392, the current documentation on what constitutes a valid char isn't very detailed and is partly on the MAX constant rather than the type itself.

This PR expands on that information, stating the actual numerical range, giving examples of what won't work, and also mentions how a `char` might be a valid USV but still not be a defined character (terminology checked against [Unicode 14.0, table 2-3](https://www.unicode.org/versions/Unicode14.0.0/ch02.pdf#M9.61673.TableTitle.Table.22.Types.of.Code.Points)).

2 years agoRollup merge of #93420 - jsha:adjust-settings-layout, r=GuillaumeGomez
Matthias Krüger [Wed, 2 Feb 2022 06:11:06 +0000 (07:11 +0100)]
Rollup merge of #93420 - jsha:adjust-settings-layout, r=GuillaumeGomez

Improve wrapping on settings page

Previously, the radio button choices for themes would wrap awkwardly on
narrow screens. With this change, the group of choices will prefer
bumping down to the next line together, leaving the setting name on its
own line.

Also fix some minor spacing issues:

 - Align the setting name vertically with the radio button choices.
 - Use margin instead of padding for most spacing choices.
 - Use no margin/padding on the right-hand side.

 Demo: https://rustdoc.crud.net/jsha/adjust-settings-layout/settings.html

 r? ``@GuillaumeGomez``

Before (narrow screen):

![image](https://user-images.githubusercontent.com/220205/151555533-7ab65216-d178-4dcc-8792-3c8fb9da8718.png)

After (narrow screen):

![image](https://user-images.githubusercontent.com/220205/151555702-ad79af32-f84b-4ee4-ae7a-1a2a463c0f6f.png)

2 years agoRollup merge of #92788 - estebank:colon-colon, r=cjgillot
Matthias Krüger [Wed, 2 Feb 2022 06:11:05 +0000 (07:11 +0100)]
Rollup merge of #92788 - estebank:colon-colon, r=cjgillot

Detect `::` -> `:` typo in type argument

When writing `Vec<A:B>`, suggest `Vec<A::B>`.

2 years agoRollup merge of #92758 - mfrw:mfrw/rustdoc-impl-write, r=GuillaumeGomez
Matthias Krüger [Wed, 2 Feb 2022 06:11:04 +0000 (07:11 +0100)]
Rollup merge of #92758 - mfrw:mfrw/rustdoc-impl-write, r=GuillaumeGomez

librustdoc: impl core::fmt::Write for rustdoc::html::render::Buffer

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Fixes: #92563
2 years agoMake rustc use `RUST_BACKTRACE=full` by default
Aaron Hill [Wed, 2 Feb 2022 00:27:16 +0000 (19:27 -0500)]
Make rustc use `RUST_BACKTRACE=full` by default

Compiler panics should be rare - when they do occur, we want the report
filed by the user to contain as much information as possible. This is
especially important when the panic is due to an incremental compilation
bug, since we may not have enough information to reproduce it.

This PR sets `RUST_BACKTRACE=full` inside `rustc` if the user has not
explicitly set `RUST_BACKTRACE`. This is more verbose than
`RUST_BACKTRACE=1`, but this may make it easier to debug incremental
compilation issues. Users who find this too verbose can still manually
set `RUST_BACKTRACE` before invoking the compiler.

This only affects `rustc` (and any tool using `rustc_driver::install_ice_hook`).
It does *not* affect any user crates or the standard library -
backtraces will continue to be off by default in any application
*compiled* by rustc.

2 years agoAuto merge of #93466 - cjgillot:query-dead, r=nagisa
bors [Wed, 2 Feb 2022 02:29:32 +0000 (02:29 +0000)]
Auto merge of #93466 - cjgillot:query-dead, r=nagisa

Make dead code check a query.

Dead code check is run for each invocation of the compiler, even if no modifications were involved.
This PR makes dead code check a query keyed on the module. This allows to skip the check when a module has not changed.
To perform this, a query `live_symbols_and_ignored_derived_traits` is introduced to encapsulate the global analysis of finding live symbols. The second query `check_mod_deathness` outputs diagnostics for each module based on this first query's results.

2 years agoMake `SearchPathFile::file_name_str` non-optional.
Nicholas Nethercote [Wed, 2 Feb 2022 02:16:25 +0000 (13:16 +1100)]
Make `SearchPathFile::file_name_str` non-optional.

Currently, it can be `None` if the conversion from `OsString` fails, in
which case all searches will skip over the `SearchPathFile`.

The commit changes things so that the `SearchPathFile` just doesn't get
created in the first place. Same behaviour, but slightly simpler code.

2 years agoDetect `::` -> `:` typo in type argument
Esteban Kuber [Tue, 11 Jan 2022 21:56:10 +0000 (21:56 +0000)]
Detect `::` -> `:` typo in type argument

When writing `Vec<A:B>`, suggest `Vec<A::B>`.

2 years agoAuto merge of #93285 - JulianKnodt:const_eq_2, r=oli-obk
bors [Tue, 1 Feb 2022 23:18:01 +0000 (23:18 +0000)]
Auto merge of #93285 - JulianKnodt:const_eq_2, r=oli-obk

Continue work on associated const equality

This actually implements some more complex logic for assigning associated consts to values.
Inside of projection candidates, it now defers to a separate function for either consts or
types. To reduce amount of code, projections are now generic over T, where T is either a Type or
a Const. I can add some comments back later, but this was the fastest way to implement it.

It also now finds the correct type of consts in type_of.

---

The current main TODO is finding the const of the def id for the LeafDef.

Right now it works if the function isn't called, but once you use the trait impl with the bound it fails inside projection.
I was hoping to get some help in getting the `&'tcx ty::Const<'tcx>`, in addition to a bunch of other `todo!()`s which I think may not be hit.

r? `@oli-obk`

Updates #92827

2 years agoInline and remove `FileSearch::search`.
Nicholas Nethercote [Tue, 1 Feb 2022 05:32:13 +0000 (16:32 +1100)]
Inline and remove `FileSearch::search`.

It has only a single callsite, and having all the code in one place will
make it possible to optimize the search.

2 years agoRemove `FileMatch`.
Nicholas Nethercote [Tue, 1 Feb 2022 05:24:48 +0000 (16:24 +1100)]
Remove `FileMatch`.

It's returned from `FileSearch::search` but it's only used to print some
debug info.

2 years agoRemove rlib special-casing in `FileSearch::search`.
Nicholas Nethercote [Tue, 1 Feb 2022 05:18:39 +0000 (16:18 +1100)]
Remove rlib special-casing in `FileSearch::search`.

This code and comment appear to be out of date.
`CrateLocator::find_library_crate` is the only caller of this function
and it handles rlib vs dylib overlap itself (see
`CrateLocator::extract_lib`) after inspecting all the files present, so
it doesn't need to see them in any particular order.

2 years agoFix annotation of code blocks
George Bateman [Tue, 1 Feb 2022 21:44:53 +0000 (21:44 +0000)]
Fix annotation of code blocks

2 years agoFix two incorrect "it's"
Frank Steffahn [Tue, 1 Feb 2022 21:32:02 +0000 (22:32 +0100)]
Fix two incorrect "it's"

2 years agoAdd missing | between print options
Daniel Frampton [Tue, 1 Feb 2022 20:40:01 +0000 (12:40 -0800)]
Add missing | between print options

2 years agoFix w/ comments
kadmin [Tue, 1 Feb 2022 15:28:31 +0000 (15:28 +0000)]
Fix w/ comments

2 years agoAuto merge of #93442 - yaahc:Termination-abstraction, r=Mark-Simulacrum
bors [Tue, 1 Feb 2022 20:05:46 +0000 (20:05 +0000)]
Auto merge of #93442 - yaahc:Termination-abstraction, r=Mark-Simulacrum

Change Termination::report return type to ExitCode

Related to https://github.com/rust-lang/rust/issues/43301

The goal of this change is to minimize the forward compatibility risks in stabilizing Termination. By using the opaque type `ExitCode` instead of an `i32` we leave room for us to evolve the API over time to provide what cross-platform consistency we can / minimize footguns when working with exit codes, where as stabilizing on `i32` would limit what changes we could make in the future in how we represent and construct exit codes.

2 years agoLink `try_exists` docs to `Path::exists`
Chris Denton [Tue, 1 Feb 2022 17:47:19 +0000 (17:47 +0000)]
Link `try_exists` docs to `Path::exists`

2 years agoAuto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgr
bors [Tue, 1 Feb 2022 16:55:43 +0000 (16:55 +0000)]
Auto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #86374 (Enable combining `+crt-static` and `relocation-model=pic` on `x86_64-unknown-linux-gnu`)
 - #91828 (Implement `RawWaker` and `Waker` getters for underlying pointers)
 - #92021 (Eliminate duplicate codes of is_single_fp_element)
 - #92584 (add rustc lint, warning when iterating over hashmaps 2)
 - #93267 (implement a lint for suspicious auto trait impls)
 - #93290 (remove `TyS::same_type`)
 - #93436 (Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib)

Failed merges:

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

2 years agoAdd package.json in gitignore
Guillaume Gomez [Tue, 1 Feb 2022 16:14:59 +0000 (17:14 +0100)]
Add package.json in gitignore

2 years agoAdd rustdoc info to jsondocck output
Rune Tynan [Mon, 31 Jan 2022 15:38:15 +0000 (10:38 -0500)]
Add rustdoc info to jsondocck output

2 years agoRollup merge of #93436 - dcsommer:master, r=Mark-Simulacrum
Matthias Krüger [Tue, 1 Feb 2022 15:08:06 +0000 (16:08 +0100)]
Rollup merge of #93436 - dcsommer:master, r=Mark-Simulacrum

Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib

I ran `./x.py dist --host= --target=armv7-linux-androideabi` before this diff:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-3d9661a82c59c66a.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
2
```
And after:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-ffd2745070943321.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
1
```
Fixes #93310

See also https://github.com/rust-lang/compiler-builtins/issues/449 and https://github.com/rust-lang/compiler-builtins/pull/450

2 years agoRollup merge of #93290 - lcnr:same_type, r=jackh726
Matthias Krüger [Tue, 1 Feb 2022 15:08:05 +0000 (16:08 +0100)]
Rollup merge of #93290 - lcnr:same_type, r=jackh726

remove `TyS::same_type`

This function ignored regions and constants in adts, but didn't do so for references or any other types. cc https://github.com/rust-lang/rust/pull/93148#discussion_r791408057