]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #91418 - matthiaskrgr:rollup-vn9f9w3, r=matthiaskrgr
bors [Wed, 1 Dec 2021 09:51:00 +0000 (09:51 +0000)]
Auto merge of #91418 - matthiaskrgr:rollup-vn9f9w3, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #87160 (When recovering from a `:` in a pattern, use adequate AST pattern)
 - #90985 (Use `get_diagnostic_name` more)
 - #91087 (Remove all migrate.nll.stderr files)
 - #91207 (Add support for LLVM coverage mapping format versions 5 and 6)
 - #91298 (Improve error message for `E0659` if the source is not available)
 - #91346 (Add `Option::inspect` and `Result::{inspect, inspect_err}`)
 - #91404 (Fix bad `NodeId` limit checking.)

Failed merges:

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

2 years agoRollup merge of #91404 - nnethercote:fix-bad-NodeId-limit-checking, r=dtolnay
Matthias Krüger [Wed, 1 Dec 2021 09:50:23 +0000 (10:50 +0100)]
Rollup merge of #91404 - nnethercote:fix-bad-NodeId-limit-checking, r=dtolnay

Fix bad `NodeId` limit checking.

`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!

This commit removes the conversion to/from `usize`.

2 years agoRollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay
Matthias Krüger [Wed, 1 Dec 2021 09:50:22 +0000 (10:50 +0100)]
Rollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay

Add `Option::inspect` and `Result::{inspect, inspect_err}`

```rust
// core::result

impl Result<T, E> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
    pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self;
}

// core::option

impl Option<T> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
}
```

2 years agoRollup merge of #91298 - FabianWolff:issue-91028-source-avail, r=cjgillot
Matthias Krüger [Wed, 1 Dec 2021 09:50:21 +0000 (10:50 +0100)]
Rollup merge of #91298 - FabianWolff:issue-91028-source-avail, r=cjgillot

Improve error message for `E0659` if the source is not available

Fixes #91028. The fix is similar to those in #89233 and #87088. With this change, instead of the dangling
```
note: `Option` could also refer to the enum defined here
```
I get
```
note: `Option` could also refer to an enum from prelude
```
If the standard library source code _is_ available, the output does not change.

2 years agoRollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry
Matthias Krüger [Wed, 1 Dec 2021 09:50:20 +0000 (10:50 +0100)]
Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry

Add support for LLVM coverage mapping format versions 5 and 6

This PR cherry-pick's Swatinem's initial commit in unsubmitted PR #90047.

My additional commit augments Swatinem's great starting point, but adds full support for LLVM
Coverage Mapping Format version 6, conditionally, if compiling with LLVM 13.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`

2 years agoRollup merge of #91087 - rukai:fix_test_nll_revisions, r=jackh726
Matthias Krüger [Wed, 1 Dec 2021 09:50:19 +0000 (10:50 +0100)]
Rollup merge of #91087 - rukai:fix_test_nll_revisions, r=jackh726

Remove all migrate.nll.stderr files

There are a few ui tests that setup the revisions like:
```rust
// revisions: migrate nll`
// [nll]compile-flags: -Zborrowck=mir
```

However most of them fail to disable the nll compare mode like this:
```rust
// ignore-compare-mode-nll
```

This ends up generating confusing files ending in `.migrate.nll.stderr` because the nll compare mode is run on top of the migrate revision.

This PR fixes this by adding `ignore-compare-mode-nll` to these tests.

I would have just made these tests use compare modes instead but I assume the reason these tests are messing around with revisions instead of just letting the nll compare mode do its thing is to enforce error annotations for both migrate and nll.
Relying on just compare modes would only have the error annotations for migrate.

2 years agoRollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726
Matthias Krüger [Wed, 1 Dec 2021 09:50:18 +0000 (10:50 +0100)]
Rollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726

Use `get_diagnostic_name` more

2 years agoRollup merge of #87160 - estebank:colon-recovery, r=nagisa
Matthias Krüger [Wed, 1 Dec 2021 09:50:18 +0000 (10:50 +0100)]
Rollup merge of #87160 - estebank:colon-recovery, r=nagisa

When recovering from a `:` in a pattern, use adequate AST pattern

If the suggestion to use `::` instead of `:` in the pattern isn't correct, a second resolution error will be emitted.

2 years agoAuto merge of #91324 - eggyal:avoid-uneccesary-clone-of-annotatable, r=Aaron1011
bors [Wed, 1 Dec 2021 06:18:39 +0000 (06:18 +0000)]
Auto merge of #91324 - eggyal:avoid-uneccesary-clone-of-annotatable, r=Aaron1011

Avoid uneccessary clone of Annotatable

Addresses FIXME comment created in #82608

r? `@Aaron1011`

2 years agoFix bad `NodeId` limit checking.
Nicholas Nethercote [Tue, 30 Nov 2021 20:22:29 +0000 (07:22 +1100)]
Fix bad `NodeId` limit checking.

`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!

This commit removes the conversion to/from `usize`.

2 years agoAuto merge of #91406 - matthiaskrgr:rollup-a2whn8m, r=matthiaskrgr
bors [Wed, 1 Dec 2021 02:51:15 +0000 (02:51 +0000)]
Auto merge of #91406 - matthiaskrgr:rollup-a2whn8m, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #91294 (Visit type in process_projection_elem.)
 - #91340 (Bump compiler_builtins to 0.1.55 to bring in fixes for targets lackin…)
 - #91366 (Only show notable traits if both types are the same)
 - #91397 (Emit a warning on generic parameters with doc comments)

Failed merges:

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

2 years agoRollup merge of #91397 - jyn514:generic-param-docs, r=wesleywiser
Matthias Krüger [Tue, 30 Nov 2021 22:43:33 +0000 (23:43 +0100)]
Rollup merge of #91397 - jyn514:generic-param-docs, r=wesleywiser

Emit a warning on generic parameters with doc comments

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

2 years agoRollup merge of #91366 - notriddle:notriddle/only-show-notable-if-types-are-the-same...
Matthias Krüger [Tue, 30 Nov 2021 22:43:32 +0000 (23:43 +0100)]
Rollup merge of #91366 - notriddle:notriddle/only-show-notable-if-types-are-the-same, r=GuillaumeGomez

Only show notable traits if both types are the same

Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347

2 years agoRollup merge of #91340 - cr1901:no-atomic, r=Mark-Simulacrum
Matthias Krüger [Tue, 30 Nov 2021 22:43:31 +0000 (23:43 +0100)]
Rollup merge of #91340 - cr1901:no-atomic, r=Mark-Simulacrum

Bump compiler_builtins to 0.1.55 to bring in fixes for targets lackin…

…g atomic support.

This fixes a "Cannot select" LLVM error when compiling `compiler_builtins` for targets lacking atomics, like MSP430. Se https://github.com/rust-lang/compiler-builtins/issues/441 for more info. This PR is a more general version of #91248.

2 years agoRollup merge of #91294 - cjgillot:process-elem, r=jackh726
Matthias Krüger [Tue, 30 Nov 2021 22:43:31 +0000 (23:43 +0100)]
Rollup merge of #91294 - cjgillot:process-elem, r=jackh726

Visit type in process_projection_elem.

Instead of reimplementing it for each visitor.

2 years agoAdd conditional support for coverage map version 6
Rich Kadel [Thu, 25 Nov 2021 00:58:49 +0000 (16:58 -0800)]
Add conditional support for coverage map version 6

This commit augments Swatinem's initial commit in uncommitted PR #90047,
which was a great starting point, but did not fully support LLVM
Coverage Mapping Format version 6.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`

2 years agoUpdate src/librustdoc/clean/types.rs
Michael Howell [Tue, 30 Nov 2021 21:22:15 +0000 (14:22 -0700)]
Update src/librustdoc/clean/types.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agoUpdate src/librustdoc/clean/types.rs
Michael Howell [Tue, 30 Nov 2021 21:22:03 +0000 (14:22 -0700)]
Update src/librustdoc/clean/types.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agoEmit a warning on generic parameters with doc comments
Joshua Nelson [Tue, 30 Nov 2021 18:47:01 +0000 (18:47 +0000)]
Emit a warning on generic parameters with doc comments

2 years agoAuto merge of #91352 - nnethercote:RawVec-reserve_for_push, r=dtolnay
bors [Tue, 30 Nov 2021 13:52:38 +0000 (13:52 +0000)]
Auto merge of #91352 - nnethercote:RawVec-reserve_for_push, r=dtolnay

Introduce `RawVec::reserve_for_push`.

If `Vec::push`'s capacity check fails it calls `RawVec::reserve`, which
then also does a capacity check.

This commit introduces `reserve_for_push` which skips the redundant
capacity check, for some slight compile time speed-ups.

I tried lots of minor variations on this, e.g. different inlining
attributes. This was the best one I could find.

r? `@ghost`

2 years agoAuto merge of #91388 - JohnTitor:rollup-640o1e5, r=JohnTitor
bors [Tue, 30 Nov 2021 10:45:22 +0000 (10:45 +0000)]
Auto merge of #91388 - JohnTitor:rollup-640o1e5, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #91243 (Don't treat unnormalized function arguments as well-formed)
 - #91250 (Refactor EmitterWriter::emit_suggestion_default )
 - #91317 (tests: Ignore `test/debuginfo/rc_arc.rs` on windows-gnu)
 - #91323 (CTFE: support assert_zero_valid and assert_uninit_valid)
 - #91358 (Fix small typo)
 - #91360 (:arrow_up: rust-analyzer)
 - #91368 (Don't re-export `MirPass`)
 - #91383 (Add `drop_while` as doc alias to `Iterator::skip_while`)

Failed merges:

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

2 years agoRollup merge of #91383 - ScriptDevil:drop-while-doc-alias, r=joshtriplett
Yuki Okushi [Tue, 30 Nov 2021 08:29:13 +0000 (17:29 +0900)]
Rollup merge of #91383 - ScriptDevil:drop-while-doc-alias, r=joshtriplett

Add `drop_while` as doc alias to `Iterator::skip_while`

`skip_while` is commonly referred to as `drop_while` in other languages (clojure/c++/haskell). This recently came up in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.E2.9C.94.20DropWhile/near/262203352) as well.

This pull request adds 'drop_while' as a doc-alias for 'skip_while'.

r? `@joshtriplett`

2 years agoRollup merge of #91368 - ecstatic-morse:mir-pass-reexport, r=cjgillot
Yuki Okushi [Tue, 30 Nov 2021 08:29:12 +0000 (17:29 +0900)]
Rollup merge of #91368 - ecstatic-morse:mir-pass-reexport, r=cjgillot

Don't re-export `MirPass`

`rust-analyzer` wants to use the `rustc_const_eval` one by default, which is weird.

r? ``@cjgillot``

2 years agoRollup merge of #91360 - lnicola:rust-analyzer-2021-11-29, r=lnicola
Yuki Okushi [Tue, 30 Nov 2021 08:29:11 +0000 (17:29 +0900)]
Rollup merge of #91360 - lnicola:rust-analyzer-2021-11-29, r=lnicola

:arrow_up: rust-analyzer

r? ```@ghost```

2 years agoRollup merge of #91358 - kd-collective:fix_typo, r=cjgillot
Yuki Okushi [Tue, 30 Nov 2021 08:29:10 +0000 (17:29 +0900)]
Rollup merge of #91358 - kd-collective:fix_typo, r=cjgillot

Fix small typo

Fix a typo in code commenting!
`accross` -> `across`

2 years agoRollup merge of #91323 - RalfJung:assert-type, r=oli-obk
Yuki Okushi [Tue, 30 Nov 2021 08:29:09 +0000 (17:29 +0900)]
Rollup merge of #91323 - RalfJung:assert-type, r=oli-obk

CTFE: support assert_zero_valid and assert_uninit_valid

This ensures the implementation of all three type-based assert_ intrinsics remains consistent in Miri.

`assert_inhabited` recently got stabilized in https://github.com/rust-lang/rust/pull/90896 (meaning stable `const fn` can call it), so do the same with these other intrinsics.

Cc ```@rust-lang/wg-const-eval```

2 years agoRollup merge of #91317 - petrochenkov:debugnu, r=Mark-Simulacrum
Yuki Okushi [Tue, 30 Nov 2021 08:29:08 +0000 (17:29 +0900)]
Rollup merge of #91317 - petrochenkov:debugnu, r=Mark-Simulacrum

tests: Ignore `test/debuginfo/rc_arc.rs` on windows-gnu

The tests checks some pretty-printer output, but pretty-printers are not embedded on windows-gnu.

Regressed in https://github.com/rust-lang/rust/pull/85448.

2 years agoRollup merge of #91250 - rukai:remove_trailing_whitespace, r=wesleywiser
Yuki Okushi [Tue, 30 Nov 2021 08:29:07 +0000 (17:29 +0900)]
Rollup merge of #91250 - rukai:remove_trailing_whitespace, r=wesleywiser

Refactor EmitterWriter::emit_suggestion_default

Makes progress towards https://github.com/rust-lang/rust/issues/89979

Split into 2 commits:
* the first commit is purely a refactor and I verified that `./x.py test src/test/ui --stage 1` and  `./x.py test src/test/rustdoc-ui --stage 1` continue to pass on this commit.
* ~~the second commit removes the empty trailing line from diff style suggestions.~~ - I discovered an issue with this so its just the refactor now.

r? diagnostics

2 years agoRollup merge of #91243 - jackh726:issue-91068, r=nikomatsakis
Yuki Okushi [Tue, 30 Nov 2021 08:29:06 +0000 (17:29 +0900)]
Rollup merge of #91243 - jackh726:issue-91068, r=nikomatsakis

Don't treat unnormalized function arguments as well-formed

Partial revert of #88312

r? ``@pnkfelix``
cc ``@nikomatsakis``

2 years agoAuto merge of #91330 - cjgillot:no-ee-features, r=Aaron1011
bors [Tue, 30 Nov 2021 07:40:08 +0000 (07:40 +0000)]
Auto merge of #91330 - cjgillot:no-ee-features, r=Aaron1011

Remove eval_always for lib_features.

r? `@Aaron1011`

2 years agoAdd `drop_while` as doc alias to `Iterator::skip_while`
Ashok Gautham Jadatharan [Tue, 30 Nov 2021 04:57:16 +0000 (10:27 +0530)]
Add `drop_while` as doc alias to `Iterator::skip_while`

2 years agoAuto merge of #91379 - ehuss:update-cargo, r=ehuss
bors [Tue, 30 Nov 2021 04:15:31 +0000 (04:15 +0000)]
Auto merge of #91379 - ehuss:update-cargo, r=ehuss

Update cargo

6 commits in 7f08ace4f1305de7f3b1b0e2f765911957226bd4..294967c53f0c70d598fc54ca189313c86c576ea7
2021-11-24 17:54:39 +0000 to 2021-11-29 19:04:22 +0000
- Fix some tests with output collisions. (rust-lang/cargo#10137)
- Description of the targets that can be applied (rust-lang/cargo#10109)
- Improve unused patch message when source URLs mismatched (rust-lang/cargo#10130)
- Add a note about doctest xcompile. (rust-lang/cargo#10132)
- book: add edit links to specific pages (rust-lang/cargo#10124)
- Add crate type flag to rustc command (rust-lang/cargo#10093)

2 years agoUpdate cargo
Eric Huss [Tue, 30 Nov 2021 02:11:17 +0000 (18:11 -0800)]
Update cargo

2 years agoAuto merge of #91244 - dtolnay:lossy, r=Mark-Simulacrum
bors [Tue, 30 Nov 2021 01:08:56 +0000 (01:08 +0000)]
Auto merge of #91244 - dtolnay:lossy, r=Mark-Simulacrum

Eliminate bunch of copies of error codepath from Utf8LossyChunksIter

Using a macro to stamp out 7 identical copies of the nontrivial slicing logic to exit this loop didn't seem like a necessary use of a macro. The early return case can be handled by `break` without practically any changes to the logic inside the loop.

All this code is from early 2014 (#12062&mdash;nearly 8 years ago; pre-1.0) so it's possible there were compiler limitations that forced the macro way at the time.

Confirmed that `x.py bench library/alloc --stage 0 --test-args from_utf8_lossy` is unaffected on my machine.

2 years agoRemove all migrate.nll.stderr files
Lucas Kent [Sat, 20 Nov 2021 12:13:40 +0000 (23:13 +1100)]
Remove all migrate.nll.stderr files

2 years agoIntroduce `RawVec::reserve_for_push`.
Nicholas Nethercote [Mon, 29 Nov 2021 10:15:51 +0000 (21:15 +1100)]
Introduce `RawVec::reserve_for_push`.

If `Vec::push`'s capacity check fails it calls `RawVec::reserve`, which
then also does a capacity check.

This commit introduces `reserve_for_push` which skips the redundant
capacity check, for some slight compile time speed-ups.

I tried lots of minor variations on this, e.g. different inlining
attributes. This was the best one I could find.

2 years agoDon't re-export `MirPass`
Dylan MacKenzie [Mon, 29 Nov 2021 20:58:15 +0000 (12:58 -0800)]
Don't re-export `MirPass`

2 years agoBless nll
Jack Huey [Mon, 29 Nov 2021 20:24:44 +0000 (15:24 -0500)]
Bless nll

2 years agoOnly show notable traits if both types are the same
Michael Howell [Mon, 29 Nov 2021 19:18:57 +0000 (12:18 -0700)]
Only show notable traits if both types are the same

Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347

2 years agoreview comments: clean up
Esteban Kuber [Sun, 21 Nov 2021 04:56:32 +0000 (04:56 +0000)]
review comments: clean up

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 29 Nov 2021 16:53:28 +0000 (18:53 +0200)]
:arrow_up: rust-analyzer

2 years agoCTFE: support assert_zero_valid and assert_uninit_valid
Ralf Jung [Sun, 28 Nov 2021 18:00:37 +0000 (13:00 -0500)]
CTFE: support assert_zero_valid and assert_uninit_valid

2 years agoFix small typo
kijima [Mon, 29 Nov 2021 16:31:10 +0000 (01:31 +0900)]
Fix small typo

2 years agoAuto merge of #91299 - cjgillot:expect-ldid, r=petrochenkov
bors [Mon, 29 Nov 2021 15:02:01 +0000 (15:02 +0000)]
Auto merge of #91299 - cjgillot:expect-ldid, r=petrochenkov

Take a LocalDefId in expect_*item.

Items and item-likes are always HIR owners.
When trying to find such nodes, there is no ambiguity, the `LocalDefId` and the `HirId::owner` always match.
In such cases, `local_def_id_to_hir_id` does not carry any meaningful information, so we can just skip calling it altogether.

2 years agoAuto merge of #91350 - matthiaskrgr:rollup-nleabdj, r=matthiaskrgr
bors [Mon, 29 Nov 2021 10:34:52 +0000 (10:34 +0000)]
Auto merge of #91350 - matthiaskrgr:rollup-nleabdj, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91049 (Add a caveat to std::os::windows::fs::symlink_file)
 - #91281 (Add demonstration test for #91161)
 - #91327 (Delete an unreachable codepath from format_args implementation)
 - #91336 (Remove unused root_parent.)
 - #91349 (Accumulate all values of `-C remark` option)

Failed merges:

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

2 years agoRollup merge of #91349 - tmiasko:accumulate-remark-args, r=nikic
Matthias Krüger [Mon, 29 Nov 2021 09:41:38 +0000 (10:41 +0100)]
Rollup merge of #91349 - tmiasko:accumulate-remark-args, r=nikic

Accumulate all values of `-C remark` option

When `-C remark=...` option is specified multiple times,
accumulate all values instead of using only the last one.

r? `@nikic`

2 years agoRollup merge of #91336 - cjgillot:root_parent, r=matthewjasper
Matthias Krüger [Mon, 29 Nov 2021 09:41:37 +0000 (10:41 +0100)]
Rollup merge of #91336 - cjgillot:root_parent, r=matthewjasper

Remove unused root_parent.

2 years agoRollup merge of #91327 - dtolnay:exact, r=michaelwoerister
Matthias Krüger [Mon, 29 Nov 2021 09:41:36 +0000 (10:41 +0100)]
Rollup merge of #91327 - dtolnay:exact, r=michaelwoerister

Delete an unreachable codepath from format_args implementation

2 years agoRollup merge of #91281 - scottmcm:non-exhaustive-as-test, r=Mark-Simulacrum
Matthias Krüger [Mon, 29 Nov 2021 09:41:34 +0000 (10:41 +0100)]
Rollup merge of #91281 - scottmcm:non-exhaustive-as-test, r=Mark-Simulacrum

Add demonstration test for #91161

Since cross-crate things are hard to demonstrate in playground, here's a test showing that something currently works that shouldn't.

cc https://github.com/rust-lang/rust/issues/91161 that tracks fixing the problem (and updating this test)

2 years agoRollup merge of #91049 - dimo414:patch-1, r=kennytm
Matthias Krüger [Mon, 29 Nov 2021 09:41:33 +0000 (10:41 +0100)]
Rollup merge of #91049 - dimo414:patch-1, r=kennytm

Add a caveat to std::os::windows::fs::symlink_file

This is similar to the note on [Python's `os.symlink()`](https://docs.python.org/3/library/os.html#os.symlink). Some additional notes in https://github.com/dimo414/bkt/issues/3.

2 years agoAccumulate all values of `-C remark` option
Tomasz Miąsko [Sat, 13 Nov 2021 00:00:00 +0000 (00:00 +0000)]
Accumulate all values of `-C remark` option

When `-C remark=...` option is specified multiple times,
accumulate all values instead of using only the last one.

2 years agoAuto merge of #91043 - camsteffen:descendant-eq, r=petrochenkov
bors [Mon, 29 Nov 2021 07:46:36 +0000 (07:46 +0000)]
Auto merge of #91043 - camsteffen:descendant-eq, r=petrochenkov

Add fast path to `is_descendant_of`

2 years agoAuto merge of #91344 - RalfJung:miri, r=RalfJung
bors [Mon, 29 Nov 2021 04:40:31 +0000 (04:40 +0000)]
Auto merge of #91344 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoadd `Option::inspect` and `Result::{inspect, inspect_err}`
Ibraheem Ahmed [Mon, 29 Nov 2021 04:31:32 +0000 (23:31 -0500)]
add `Option::inspect` and `Result::{inspect, inspect_err}`

2 years agoBump compiler_builtins to 0.1.55 to bring in fixes for targets lacking atomic support.
William D. Jones [Sun, 28 Nov 2021 22:53:50 +0000 (17:53 -0500)]
Bump compiler_builtins to 0.1.55 to bring in fixes for targets lacking atomic support.

2 years agoupdate Miri
Ralf Jung [Mon, 29 Nov 2021 01:37:49 +0000 (20:37 -0500)]
update Miri

2 years agoAuto merge of #91338 - matthiaskrgr:rollup-46ry8wi, r=matthiaskrgr
bors [Mon, 29 Nov 2021 01:35:33 +0000 (01:35 +0000)]
Auto merge of #91338 - matthiaskrgr:rollup-46ry8wi, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #90131 (Fix a format_args span to be expansion)
 - #90832 (Add 1.57.0 release notes)
 - #90833 (Emit LLVM optimization remarks when enabled with `-Cremark`)

Failed merges:

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

2 years agoRollup merge of #90833 - tmiasko:optimization-remarks, r=nikic
Matthias Krüger [Sun, 28 Nov 2021 22:45:17 +0000 (23:45 +0100)]
Rollup merge of #90833 - tmiasko:optimization-remarks, r=nikic

Emit LLVM optimization remarks when enabled with `-Cremark`

The default diagnostic handler considers all remarks to be disabled by
default unless configured otherwise through LLVM internal flags:
`-pass-remarks`, `-pass-remarks-missed`, and `-pass-remarks-analysis`.
This behaviour makes `-Cremark` ineffective on its own.

Fix this by configuring a custom diagnostic handler that enables
optimization remarks based on the value of `-Cremark` option. With
`-Cremark=all` enabling all remarks.

Fixes #90924.

r? `@nikic`

2 years agoRollup merge of #90832 - cuviper:relnotes-1.57.0, r=Mark-Simulacrum
Matthias Krüger [Sun, 28 Nov 2021 22:45:16 +0000 (23:45 +0100)]
Rollup merge of #90832 - cuviper:relnotes-1.57.0, r=Mark-Simulacrum

Add 1.57.0 release notes

2 years agoRollup merge of #90131 - camsteffen:fmt-args-span-fix, r=cjgillot
Matthias Krüger [Sun, 28 Nov 2021 22:45:15 +0000 (23:45 +0100)]
Rollup merge of #90131 - camsteffen:fmt-args-span-fix, r=cjgillot

Fix a format_args span to be expansion

I found this while exploring solutions for rust-lang/rust-clippy#7843.

r? `@m-ou-se`

2 years agoAdd parent crate assert to register_expn_id
Cameron Steffen [Sun, 28 Nov 2021 22:35:31 +0000 (16:35 -0600)]
Add parent crate assert to register_expn_id

2 years agoAdd fast path to is_descendant_of
Cameron Steffen [Fri, 19 Nov 2021 15:43:03 +0000 (09:43 -0600)]
Add fast path to is_descendant_of

2 years agoAuto merge of #90681 - workingjubilee:update-libc, r=JohnTitor
bors [Sun, 28 Nov 2021 22:29:57 +0000 (22:29 +0000)]
Auto merge of #90681 - workingjubilee:update-libc, r=JohnTitor

Update libc to 0.2.108

Changelog:
https://github.com/rust-lang/libc/releases/tag/0.2.107
https://github.com/rust-lang/libc/releases/tag/0.2.108
Primarily intended to pull in rust-lang/libc@fd331f65f214ea75b6210b415b5fd8650be15c73
This should help with https://github.com/rust-lang/rust/pull/90044

2 years agoRemove unused root_parent.
Camille GILLOT [Thu, 21 Oct 2021 17:22:44 +0000 (19:22 +0200)]
Remove unused root_parent.

2 years agoRemove eval_always for lib_features.
Camille GILLOT [Thu, 20 May 2021 18:57:09 +0000 (20:57 +0200)]
Remove eval_always for lib_features.

2 years agoTake a LocalDefId in expect_*item.
Camille GILLOT [Wed, 20 Oct 2021 20:38:10 +0000 (22:38 +0200)]
Take a LocalDefId in expect_*item.

2 years agoDelete an unreachable codepath from format_args implementation
David Tolnay [Sun, 28 Nov 2021 19:52:38 +0000 (11:52 -0800)]
Delete an unreachable codepath from format_args implementation

2 years agoAvoid uneccessary clone of Annotatable
Alan Egerton [Sun, 28 Nov 2021 18:41:04 +0000 (18:41 +0000)]
Avoid uneccessary clone of Annotatable

2 years agoAuto merge of #91320 - matthiaskrgr:rollup-r209seq, r=matthiaskrgr
bors [Sun, 28 Nov 2021 17:14:04 +0000 (17:14 +0000)]
Auto merge of #91320 - matthiaskrgr:rollup-r209seq, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #91251 (Perform Sync check on static items in wf-check instead of during const checks)
 - #91308 (Fix ICE when lowering `trait A where for<'a> Self: 'a`)
 - #91319 (Change output path to {{build-base}} for rustdoc scrape_examples ui test)

Failed merges:

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

2 years agoRollup merge of #91319 - fee1-dead:rustdoc-ice-fix, r=jyn514
Matthias Krüger [Sun, 28 Nov 2021 16:11:12 +0000 (17:11 +0100)]
Rollup merge of #91319 - fee1-dead:rustdoc-ice-fix, r=jyn514

Change output path to {{build-base}} for rustdoc scrape_examples ui test

See https://github.com/rust-lang/rust/pull/90611#issuecomment-981092909

r? `@jyn514`

cc `@petrochenkov`

2 years agoRollup merge of #91308 - BGR360:issue-88586, r=jackh726
Matthias Krüger [Sun, 28 Nov 2021 16:11:11 +0000 (17:11 +0100)]
Rollup merge of #91308 - BGR360:issue-88586, r=jackh726

Fix ICE when lowering `trait A where for<'a> Self: 'a`

Fixes #88586.

r? `@jackh726`

Jack, this fix is much smaller in scope than what I think you were proposing in the issue. Let me know if you had a vision for a larger refactor here.

cc `@JohnTitor`

2 years agoRollup merge of #91251 - oli-obk:wf_sync_statics, r=matthewjasper
Matthias Krüger [Sun, 28 Nov 2021 16:11:10 +0000 (17:11 +0100)]
Rollup merge of #91251 - oli-obk:wf_sync_statics, r=matthewjasper

Perform Sync check on static items in wf-check instead of during const checks

r? `@RalfJung`

This check is solely happening on the signature of the static item and not on its body, therefor it belongs into wf-checking instead of const checking.

2 years agoChange output path to {{build-base}}
Deadbeef [Sun, 28 Nov 2021 15:26:47 +0000 (23:26 +0800)]
Change output path to {{build-base}}

2 years agotests: Ignore `test/debuginfo/rc_arc.rs` on windows-gnu
Vadim Petrochenkov [Sun, 28 Nov 2021 15:05:54 +0000 (23:05 +0800)]
tests: Ignore `test/debuginfo/rc_arc.rs` on windows-gnu

The tests checks some pretty-printer output, but pretty-printers are not embedded on windows-gnu

2 years agoAddress PR feedback
Ben Reeves [Sun, 28 Nov 2021 13:05:23 +0000 (07:05 -0600)]
Address PR feedback

2 years agoAuto merge of #91230 - eggyal:fallible-type-fold, r=jackh726
bors [Sun, 28 Nov 2021 13:04:27 +0000 (13:04 +0000)]
Auto merge of #91230 - eggyal:fallible-type-fold, r=jackh726

Make `TypeFolder::fold_*` return `Result`

Implements rust-lang/compiler-team#432.

Initially this is just a rebase of `@LeSeulArtichaut's` work in #85469 (abandoned; see https://github.com/rust-lang/rust/pull/85485#issuecomment-908781112).  At that time, it caused a regression in performance that required some further exploration... with this rebased PR bors can hopefully report some perf analysis from which we can investigate further (if the regression is indeed still present).

r? `@jackh726` cc `@nikomatsakis`

2 years agoAuto merge of #91311 - matthiaskrgr:rollup-ju9xizl, r=matthiaskrgr
bors [Sun, 28 Nov 2021 09:57:59 +0000 (09:57 +0000)]
Auto merge of #91311 - matthiaskrgr:rollup-ju9xizl, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #90896 (Stabilize some `MaybeUninit` behavior as const)
 - #91254 (Only check for errors in predicate when skipping impl assembly)
 - #91303 (Miri: fix alignment check in array initialization)

Failed merges:

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

2 years agoRollup merge of #91303 - RalfJung:array-init-align, r=oli-obk
Matthias Krüger [Sun, 28 Nov 2021 09:42:40 +0000 (10:42 +0100)]
Rollup merge of #91303 - RalfJung:array-init-align, r=oli-obk

Miri: fix alignment check in array initialization

https://github.com/rust-lang/rust/pull/85376 introduced a regression in Miri, reported at https://github.com/rust-lang/miri/issues/1919 and https://github.com/rust-lang/miri/issues/1925. This PR fixes that. I will add tests to Miri once this lands.

r? `@oli-obk`
Fixes https://github.com/rust-lang/miri/issues/1919
Fixes https://github.com/rust-lang/miri/issues/1925

2 years agoRollup merge of #91254 - Aaron1011:impl-candidate-err-ty, r=lcnr
Matthias Krüger [Sun, 28 Nov 2021 09:42:39 +0000 (10:42 +0100)]
Rollup merge of #91254 - Aaron1011:impl-candidate-err-ty, r=lcnr

Only check for errors in predicate when skipping impl assembly

Prior to PR #91205, checking for errors in the overall obligation
would check checking the `ParamEnv`, due to an incorrect
`super_visit_with` impl. With this bug fixed, we will now
bail out of impl candidate assembly if the `ParamEnv` contains
any error types.

In practice, this appears to be overly conservative - when an error
occurs early in compilation, we end up giving up early for some
predicates that we could have successfully evaluated without overflow.
By only checking for errors in the predicate itself, we avoid causing
additional spurious 'type annotations needed' errors after a 'real'
error has already occurred.

With this PR, the diagnostic changes caused by PR #91205 are reverted.

2 years agoRollup merge of #90896 - jhpratt:stabilize_const_maybe_uninit, r=oli-obk
Matthias Krüger [Sun, 28 Nov 2021 09:42:38 +0000 (10:42 +0100)]
Rollup merge of #90896 - jhpratt:stabilize_const_maybe_uninit, r=oli-obk

Stabilize some `MaybeUninit` behavior as const

This stabilizes the `MaybeUninit::as_ptr`, `MaybeUninit::assume_init`, and `MaybeUninit::assume_init_ref` as `const fn`. `MaybeUninit::as_mut_ptr` has been moved to a new flag: `const_maybe_uninit_as_mut_ptr`, which is blocked on #57349. `MaybeUninit::slice_assume_init_ref` can be `const fn` when the method is stabilized in general.

The relevant intrinsic has been stabilized as `const` as well, though this isn't user-visible. Due to the seemingly unrelated feature name I performed `rg const_assert_type` and found no other instances of it being used.

r? `@oli-obk`

`@rustbot` label: +A-const-fn +S-waiting-on-review +T-libs-api

2 years agoAdd test for const `MaybeUninit`
Jacob Pratt [Wed, 17 Nov 2021 00:58:52 +0000 (19:58 -0500)]
Add test for const `MaybeUninit`

2 years agoStabilize some `MaybeUninit` behavior as const
Jacob Pratt [Sun, 14 Nov 2021 05:36:19 +0000 (00:36 -0500)]
Stabilize some `MaybeUninit` behavior as const

2 years agotypeck: Ensure proper bound vars passed to `add_bounds`.
Ben Reeves [Sun, 28 Nov 2021 05:10:18 +0000 (23:10 -0600)]
typeck: Ensure proper bound vars passed to `add_bounds`.

Fixes the ICE in #88586.

2 years agoAuto merge of #91301 - scottmcm:stabilize-nonzero-ipot, r=nagisa
bors [Sun, 28 Nov 2021 05:55:09 +0000 (05:55 +0000)]
Auto merge of #91301 - scottmcm:stabilize-nonzero-ipot, r=nagisa

Stabilize nonzero_is_power_of_two

Closes #81106
FCP has finished in the tracking issue

2 years agoUpdate libc to 0.2.108
Jubilee Young [Mon, 8 Nov 2021 01:28:04 +0000 (17:28 -0800)]
Update libc to 0.2.108

Changelog:
https://github.com/rust-lang/libc/releases/tag/0.2.107
https://github.com/rust-lang/libc/releases/tag/0.2.108
Primarily intended to pull in fd331f65f214ea75b6210b415b5fd8650be15c73
This should help with https://github.com/rust-lang/rust/pull/90044

2 years agoMiri: fix alignment check in array initialization
Ralf Jung [Sat, 27 Nov 2021 23:17:09 +0000 (18:17 -0500)]
Miri: fix alignment check in array initialization

2 years agoAuto merge of #91241 - dtolnay:firstchunk, r=oli-obk
bors [Sat, 27 Nov 2021 22:53:21 +0000 (22:53 +0000)]
Auto merge of #91241 - dtolnay:firstchunk, r=oli-obk

Eliminate an unreachable codepath from String::from_utf8_lossy

`Utf8Lossy`'s `Iterator` implementation ensures that only the **final** chunk has an empty slice for `broken`:

https://github.com/rust-lang/rust/blob/dd549dcab404ec4c7d07b5a83aca5bdd7171138f/library/core/src/str/lossy.rs#L46-L47

Thus the only way the **first** chunk could have an empty `broken` is if it is the **final** chunk, i.e. there is only one chunk total. And the only way that there could be one chunk total with an empty `broken` is if the whole input is valid utf8 and non-empty.

That condition has already been handled by an early return, so at the point that the first `REPLACEMENT` is being pushed, it's impossible for `first_broken` to be empty.

2 years agoStabilize nonzero_is_power_of_two
Scott McMurray [Sat, 27 Nov 2021 21:13:04 +0000 (13:13 -0800)]
Stabilize nonzero_is_power_of_two

Fixes 81106
FCP has finished in the tracking issue

2 years agoImprove error message for `E0659` if the source is not available
Fabian Wolff [Sat, 27 Nov 2021 17:42:49 +0000 (18:42 +0100)]
Improve error message for `E0659` if the source is not available

2 years agoOnly check for errors in predicate when skipping impl assembly
Aaron Hill [Fri, 26 Nov 2021 15:14:16 +0000 (09:14 -0600)]
Only check for errors in predicate when skipping impl assembly

Prior to PR #91205, checking for errors in the overall obligation
would check checking the `ParamEnv`, due to an incorrect
`super_visit_with` impl. With this bug fixed, we will now
bail out of impl candidate assembly if the `ParamEnv` contains
any error types.

In practice, this appears to be overly conservative - when an error
occurs early in compilation, we end up giving up early for some
predicates that we could have successfully evaluated without overflow.
By only checking for errors in the predicate itself, we avoid causing
additional spurious 'type annotations needed' errors after a 'real'
error has already occurred.

With this PR, the diagnostic changes caused by PR #91205 are reverted.

2 years agoUse intrinsic pointer methods
Alan Egerton [Sat, 27 Nov 2021 16:59:18 +0000 (16:59 +0000)]
Use intrinsic pointer methods

2 years agoDelegate from `map_id` to `try_map_id`
Alan Egerton [Sat, 27 Nov 2021 16:40:47 +0000 (16:40 +0000)]
Delegate from `map_id` to `try_map_id`

2 years agoVisit type in process_projection_elem.
Camille GILLOT [Sat, 16 Oct 2021 12:03:30 +0000 (14:03 +0200)]
Visit type in process_projection_elem.

2 years agoAvoid UB when short-circuiting try_map_id for Vec
Alan Egerton [Sat, 27 Nov 2021 14:19:24 +0000 (14:19 +0000)]
Avoid UB when short-circuiting try_map_id for Vec

2 years agoAuto merge of #91288 - matthiaskrgr:rollup-yp5h41r, r=matthiaskrgr
bors [Sat, 27 Nov 2021 14:29:12 +0000 (14:29 +0000)]
Auto merge of #91288 - matthiaskrgr:rollup-yp5h41r, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #83791 (Weaken guarantee around advancing underlying iterators in zip)
 - #90995 (Document non-guarantees for Hash)
 - #91057 (Expand `available_parallelism` docs in anticipation of cgroup quota support)
 - #91062 (rustdoc: Consolidate static-file replacement mechanism)
 - #91208 (Account for incorrect `where T::Assoc = Ty` bound)
 - #91266 (Use non-generic inner function for pointer formatting)

Failed merges:

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

2 years agoRemove erroneous merge conflict
Alan Egerton [Sat, 27 Nov 2021 11:53:00 +0000 (11:53 +0000)]
Remove erroneous merge conflict

2 years agoAuto merge of #89916 - the8472:advance_by-avoid-err-0, r=dtolnay
bors [Sat, 27 Nov 2021 11:31:26 +0000 (11:31 +0000)]
Auto merge of #89916 - the8472:advance_by-avoid-err-0, r=dtolnay

Fix Iterator::advance_by contract inconsistency

The `advance_by(n)` docs state that in the error case `Err(k)` that k is always less than n.
It also states that `advance_by(0)` may return `Err(0)` to indicate an exhausted iterator.
These statements are inconsistent.
Since only one implementation (Skip) actually made use of that I changed it to return Ok(()) in that case too.

While adding some tests I also found a bug in `Take::advance_back_by`.

2 years agoRollup merge of #91266 - jam1garner:fmt-ptr-fix, r=dtolnay
Matthias Krüger [Sat, 27 Nov 2021 10:46:45 +0000 (11:46 +0100)]
Rollup merge of #91266 - jam1garner:fmt-ptr-fix, r=dtolnay

Use non-generic inner function for pointer formatting

Previously, despite the implementation being type-unaware, `fmt::Pointer`'s implementation for `*const T` in monomorphized. This affects:

* `fmt::Debug` for `*const T`
* `fmt::Debug` for `*mut T`
* `fmt::Pointer` for `*const T`
* `fmt::Pointer` for `*mut T`

And since the implementation is non-trivial, this results in a large amount of LLVM bitcode being generated. For example, with a large bindgen project with Debug implementations enabled, it will generate a lot of calls to `fmt::Debug for *const T`, which in turn will perform codegen for a copy of this function for every type.

For example, in a real-world bindgen'd header I've been testing with (4,189,245 lines of bindgen Rust with layout tests disabled) the difference between a slightly old nightly (`rustc 1.58.0-nightly (e249ce6b2 2021-10-30)`) and this PR:

<details>
<summary>Nightly (Click to Expand)</summary>

```
  Lines           Copies         Function name
  -----           ------         -------------
  7256000 (100%)  216544 (100%)  (TOTAL)
  1815449 (25.0%)  24206 (11.2%) <*const T as core::fmt::Pointer>::fmt
   300248 (4.1%)   29579 (13.7%) <&T as core::fmt::Debug>::fmt
   290328 (4.0%)   24194 (11.2%) <*mut T as core::fmt::Pointer>::fmt
   217746 (3.0%)   24194 (11.2%) <*mut T as core::fmt::Debug>::fmt
   123329 (1.7%)    1486 (0.7%)  core::fmt::builders::DebugList::entries
    72790 (1.0%)    1486 (0.7%)  core::slice::iter::Iter<T>::post_inc_start
    71313 (1.0%)    1486 (0.7%)  core::slice::iter::Iter<T>::new
    68329 (0.9%)    1486 (0.7%)  <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::next
    38636 (0.5%)    1486 (0.7%)  <[T] as core::fmt::Debug>::fmt
    26874 (0.4%)    1493 (0.7%)  core::array::<impl core::fmt::Debug for [T; N]>::fmt
    22290 (0.3%)    1486 (0.7%)  core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
    19407 (0.3%)    1493 (0.7%)  core::array::<impl core::ops::index::Index<I> for [T; N]>::index
    19318 (0.3%)    1486 (0.7%)  core::slice::<impl [T]>::iter
    17832 (0.2%)    1486 (0.7%)  core::ptr::const_ptr::<impl *const T>::offset
    17832 (0.2%)    1486 (0.7%)  core::ptr::mut_ptr::<impl *mut T>::offset
    16346 (0.2%)    1486 (0.7%)  <core::ops::range::RangeFull as core::slice::index::SliceIndex<[T]>>::index
    13374 (0.2%)    1486 (0.7%)  <I as core::iter::traits::collect::IntoIterator>::into_iter
    13374 (0.2%)    1486 (0.7%)  core::ptr::const_ptr::<impl *const T>::add
    13371 (0.2%)    1486 (0.7%)  core::ptr::const_ptr::<impl *const T>::is_null
    13371 (0.2%)    1486 (0.7%)  core::ptr::mut_ptr::<impl *mut T>::is_null
    11888 (0.2%)    1486 (0.7%)  core::slice::<impl [T]>::as_ptr
    11879 (0.2%)    1486 (0.7%)  core::ptr::non_null::NonNull<T>::new_unchecked
     7421 (0.1%)    1486 (0.7%)  core::ptr::non_null::NonNull<T>::as_ptr

```

</details>

<details>
<summary>This PR (Click to Expand)</summary>

```
   Lines           Copies         Function name
  -----           ------         -------------
  5684504 (100%)  216542 (100%)  (TOTAL)
   300248 (5.3%)   29579 (13.7%) <&T as core::fmt::Debug>::fmt
   290328 (5.1%)   24194 (11.2%) <*mut T as core::fmt::Pointer>::fmt
   266265 (4.7%)   24206 (11.2%) <*const T as core::fmt::Pointer>::fmt
   217746 (3.8%)   24194 (11.2%) <*mut T as core::fmt::Debug>::fmt
   101039 (1.8%)    1486 (0.7%)  core::fmt::builders::DebugList::entries
    72790 (1.3%)    1486 (0.7%)  core::slice::iter::Iter<T>::post_inc_start
    71313 (1.3%)    1486 (0.7%)  core::slice::iter::Iter<T>::new
    68329 (1.2%)    1486 (0.7%)  <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::next
    38636 (0.7%)    1486 (0.7%)  <[T] as core::fmt::Debug>::fmt
    26874 (0.5%)    1493 (0.7%)  core::array::<impl core::fmt::Debug for [T; N]>::fmt
    22290 (0.4%)    1486 (0.7%)  core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
    19407 (0.3%)    1493 (0.7%)  core::array::<impl core::ops::index::Index<I> for [T; N]>::index
    19318 (0.3%)    1486 (0.7%)  core::slice::<impl [T]>::iter
    17832 (0.3%)    1486 (0.7%)  core::ptr::const_ptr::<impl *const T>::offset
    17832 (0.3%)    1486 (0.7%)  core::ptr::mut_ptr::<impl *mut T>::offset
    16346 (0.3%)    1486 (0.7%)  <core::ops::range::RangeFull as core::slice::index::SliceIndex<[T]>>::index
    13374 (0.2%)    1486 (0.7%)  <I as core::iter::traits::collect::IntoIterator>::into_iter
    13374 (0.2%)    1486 (0.7%)  core::ptr::const_ptr::<impl *const T>::add
    13371 (0.2%)    1486 (0.7%)  core::ptr::const_ptr::<impl *const T>::is_null
    13371 (0.2%)    1486 (0.7%)  core::ptr::mut_ptr::<impl *mut T>::is_null
    11888 (0.2%)    1486 (0.7%)  core::slice::<impl [T]>::as_ptr
    11879 (0.2%)    1486 (0.7%)  core::ptr::non_null::NonNull<T>::new_unchecked
     7421 (0.1%)    1486 (0.7%)  core::ptr::non_null::NonNull<T>::as_ptr

```

</details>

Output generated using `cargo llvm-lines` version 0.4.12.

Summary of differences:

| rustc Version | Total LLVM line count | `*const T as fmt::Pointer` LLVM lines | Compilation Time |
|-|-|-|-|
| `nightly` | 7256000 | 1815449 (25.0% of binary) | 537.014 |
| PR | 5684504 (-21.65%) | 266265 (4.7% of binary) (-85.3% from nightly) | 502.990 |

This results in a pretty noticeable as the majority of rustc's time is spent in either codegen or LLVM, in this case, and is significantly improved by disabling derives for `fmt::Debug`, as it prevents generating all this LLVM IR to be handled.

Here's a run time comparison with nightly on the same codebase (commit 454cc5fb built from source vs 37c8f25 from my PR built from source):

<details>
<summary>nightly (Click to Expand)</summary>

```
time:   2.370; rss:   56MB -> 1118MB (+1062MB) parse_crate
time:   0.000; rss: 1118MB -> 1118MB (   +0MB) attributes_injection
time:   0.000; rss: 1118MB -> 1118MB (   +0MB) incr_comp_prepare_session_directory
time:   0.000; rss: 1118MB -> 1118MB (   +0MB) incr_comp_garbage_collect_session_directories
time:   0.000; rss: 1120MB -> 1120MB (   +0MB) plugin_loading
time:   0.000; rss: 1120MB -> 1120MB (   +0MB) plugin_registration
time:   0.000; rss: 1120MB -> 1120MB (   +0MB) crate_injection
time:  13.897; rss: 1120MB -> 3147MB (+2027MB) expand_crate
time:   0.002; rss: 3147MB -> 3147MB (   +0MB) check_unused_macros
time:  13.900; rss: 1120MB -> 3147MB (+2027MB) macro_expand_crate
time:   0.002; rss: 3147MB -> 3147MB (   +0MB) maybe_building_test_harness
time:   0.503; rss: 3147MB -> 3147MB (   +0MB) AST_validation
time:   0.000; rss: 3147MB -> 3147MB (   +0MB) maybe_create_a_macro_crate
time:   0.002; rss: 3147MB -> 3147MB (   +0MB) finalize_imports
time:   0.502; rss: 3147MB -> 3153MB (   +6MB) finalize_macro_resolutions
time:   4.478; rss: 3153MB -> 3574MB ( +420MB) late_resolve_crate
time:   0.000; rss: 3574MB -> 3574MB (   +0MB) resolve_main
time:   0.332; rss: 3574MB -> 3574MB (   +0MB) resolve_check_unused
time:   0.000; rss: 3574MB -> 3574MB (   +0MB) resolve_report_errors
time:   0.279; rss: 3574MB -> 3574MB (   +0MB) resolve_postprocess
time:   5.595; rss: 3147MB -> 3574MB ( +427MB) resolve_crate
time:   0.382; rss: 3574MB -> 3574MB (   +0MB) complete_gated_feature_checking
time:  20.526; rss: 1120MB -> 3574MB (+2454MB) configure_and_expand
time:   0.000; rss: 3574MB -> 3574MB (   +0MB) prepare_outputs
time:   0.000; rss: 3574MB -> 3574MB (   +0MB) blocked_on_dep_graph_loading
time:  65.992; rss: 3574MB -> 6317MB (+2743MB) hir_lowering
time:   1.117; rss: 6317MB -> 6323MB (   +6MB) early_lint_checks
time:   1.447; rss: 6323MB -> 6271MB (  -52MB) drop_ast
time:   0.002; rss: 5838MB -> 5838MB (   +0MB) setup_global_ctxt
time:   0.000; rss: 5843MB -> 5843MB (   +0MB) looking_for_entry_point
time:   0.313; rss: 5843MB -> 5844MB (   +1MB) looking_for_derive_registrar
time:   9.652; rss: 5843MB -> 6065MB ( +222MB) misc_checking_1
time:   9.713; rss: 6065MB -> 6769MB ( +704MB) type_collecting
time:   0.665; rss: 6769MB -> 6769MB (   +0MB) impl_wf_inference
time:   0.064; rss: 6769MB -> 6769MB (   +0MB) unsafety_checking
time:   3.095; rss: 6769MB -> 6792MB (  +23MB) coherence_checking
time:  21.282; rss: 6792MB -> 7546MB ( +754MB) wf_checking
time:   5.404; rss: 7546MB -> 7681MB ( +135MB) item_types_checking
time:  79.665; rss: 7681MB -> 8075MB ( +394MB) item_bodies_checking
time: 120.166; rss: 6065MB -> 8081MB (+2016MB) type_check_crate
time:   2.038; rss: 8081MB -> 8085MB (   +4MB) match_checking
time:   1.300; rss: 8085MB -> 8113MB (  +28MB) liveness_and_intrinsic_checking
time:   3.338; rss: 8081MB -> 8113MB (  +32MB) misc_checking_2
time:  68.612; rss: 8113MB -> 9285MB (+1172MB) MIR_borrow_checking
time:   0.622; rss: 9285MB -> 9301MB (  +17MB) MIR_effect_checking
time:   0.000; rss: 9301MB -> 9301MB (   +0MB) layout_testing
time:   4.331; rss: 9383MB -> 9510MB ( +127MB) death_checking
time:   0.032; rss: 9510MB -> 9510MB (   +0MB) unused_lib_feature_checking
time:   4.444; rss: 9510MB -> 9568MB (  +58MB) crate_lints
time:  59.563; rss: 9568MB -> 9576MB (   +8MB) module_lints
time:  64.006; rss: 9510MB -> 9576MB (  +66MB) lint_checking
time:   4.127; rss: 9576MB -> 9639MB (  +62MB) privacy_checking_modules
time:  77.984; rss: 9301MB -> 9639MB ( +337MB) misc_checking_3
time:   0.311; rss: 10357MB -> 10357MB (   +0MB) monomorphization_collector_root_collections
time:  14.051; rss: 10357MB -> 10573MB ( +217MB) monomorphization_collector_graph_walk
time:   1.759; rss: 10573MB -> 10652MB (  +79MB) partition_and_assert_distinct_symbols
time:  28.518; rss: 9639MB -> 10711MB (+1072MB) generate_crate_metadata
time:   0.000; rss: 10711MB -> 10711MB (   +0MB) find_cgu_reuse
time:  63.408; rss: 10711MB -> 12272MB (+1560MB) codegen_to_LLVM_IR
time:  64.916; rss: 10711MB -> 12267MB (+1556MB) codegen_crate
time:   0.000; rss: 12261MB -> 12261MB (   +0MB) assert_dep_graph
time:   0.000; rss: 12261MB -> 12261MB (   +0MB) check_dirty_clean
time:   0.664; rss: 12230MB -> 12210MB (  -20MB) encode_query_results_for(rustc_query_impl::queries::type_of)
time:   2.111; rss: 12210MB -> 12043MB ( -167MB) encode_query_results_for(rustc_query_impl::queries::generics_of)
time:   0.108; rss: 12043MB -> 12057MB (  +14MB) encode_query_results_for(rustc_query_impl::queries::predicates_of)
time:   0.004; rss: 12057MB -> 12059MB (   +2MB) encode_query_results_for(rustc_query_impl::queries::mir_const_qualif)
time:   0.665; rss: 12059MB -> 12121MB (  +62MB) encode_query_results_for(rustc_query_impl::queries::mir_for_ctfe)
time:  16.149; rss: 12121MB -> 12148MB (  +28MB) encode_query_results_for(rustc_query_impl::queries::optimized_mir)
time:   0.000; rss: 12148MB -> 12148MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::covered_file_name)
time:   0.000; rss: 12148MB -> 12148MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::covered_code_regions)
time:   0.010; rss: 12148MB -> 12150MB (   +2MB) encode_query_results_for(rustc_query_impl::queries::promoted_mir)
time:   0.052; rss: 12150MB -> 12155MB (   +4MB) encode_query_results_for(rustc_query_impl::queries::unsafety_check_result)
time:   0.003; rss: 12155MB -> 12156MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::thir_check_unsafety)
time:  11.428; rss: 12156MB -> 11748MB ( -408MB) encode_query_results_for(rustc_query_impl::queries::typeck)
time:   0.000; rss: 11748MB -> 11748MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::diagnostic_only_typeck)
time:   0.094; rss: 11748MB -> 11756MB (   +8MB) encode_query_results_for(rustc_query_impl::queries::used_trait_imports)
time:   0.272; rss: 11756MB -> 11778MB (  +22MB) encode_query_results_for(rustc_query_impl::queries::mir_borrowck)
time:   0.054; rss: 11778MB -> 11778MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::eval_to_allocation_raw)
time:   0.005; rss: 11778MB -> 11779MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::eval_to_const_value_raw)
time:   0.021; rss: 11779MB -> 11784MB (   +5MB) encode_query_results_for(rustc_query_impl::queries::check_match)
time:   0.041; rss: 11784MB -> 11786MB (   +2MB) encode_query_results_for(rustc_query_impl::queries::symbol_name)
time:   0.743; rss: 11786MB -> 11815MB (  +29MB) encode_query_results_for(rustc_query_impl::queries::codegen_fn_attrs)
time:   0.043; rss: 11815MB -> 11816MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::codegen_fulfill_obligation)
time:   0.674; rss: 11816MB -> 11840MB (  +25MB) encode_query_results_for(rustc_query_impl::queries::specialization_graph_of)
time:   0.000; rss: 11840MB -> 11840MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::adt_drop_tys)
time:   0.000; rss: 11840MB -> 11840MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::adt_significant_drop_tys)
time:   0.005; rss: 11840MB -> 11841MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::unused_generic_params)
time:  33.153; rss: 12232MB -> 11841MB ( -390MB) encode_query_results
time:  88.943; rss: 11955MB -> 11783MB ( -173MB) LLVM_passes(crate)
time:  38.854; rss: 12259MB -> 10095MB (-2164MB) incr_comp_serialize_result_cache
time:  39.030; rss: 12261MB -> 10095MB (-2166MB) incr_comp_persist_result_cache
time:   0.000; rss: 10095MB -> 10095MB (   +0MB) incr_comp_persist_dep_graph
time:  39.064; rss: 12257MB -> 10095MB (-2162MB) serialize_dep_graph
time:  19.047; rss: 10095MB -> 10307MB ( +212MB) free_global_ctxt
time:   0.000; rss: 10307MB -> 10307MB (   +0MB) join_worker_thread
time:   0.519; rss: 10307MB -> 10307MB (   +0MB) copy_all_cgu_workproducts_to_incr_comp_cache_dir
time:   0.522; rss: 10307MB -> 10307MB (   +0MB) finish_ongoing_codegen
time:   0.000; rss: 10307MB -> 10307MB (   +0MB) llvm_dump_timing_file
time:   0.002; rss: 10307MB -> 10307MB (   +0MB) serialize_work_products
time:   0.001; rss: 9542MB -> 9542MB (   +0MB) incr_comp_finalize_session_directory
time:   0.000; rss: 9542MB -> 9542MB (   +0MB) link_binary_check_files_are_writeable
time:   7.835; rss: 9542MB -> 9544MB (   +2MB) link_rlib
time:   0.000; rss: 9544MB -> 9544MB (   +0MB) link_binary_remove_temps
time:   7.872; rss: 9542MB -> 9544MB (   +2MB) link_binary
time:   7.944; rss: 9542MB -> 9201MB ( -341MB) link_crate
time:   8.495; rss: 10307MB -> 9201MB (-1106MB) link
time: 537.014; rss:   33MB -> 3715MB (+3682MB) total
```

</details>

<details>
<summary>This PR (Click to Expand)</summary>

```
time:   2.379; rss:   51MB -> 1116MB (+1064MB) parse_crate
time:   0.003; rss: 1116MB -> 1116MB (   +0MB) attributes_injection
time:   0.002; rss: 1116MB -> 1116MB (   +0MB) incr_comp_prepare_session_directory
time:   0.000; rss: 1116MB -> 1116MB (   +0MB) incr_comp_garbage_collect_session_directories
time:   0.000; rss: 1116MB -> 1116MB (   +0MB) plugin_loading
time:   0.000; rss: 1116MB -> 1116MB (   +0MB) plugin_registration
time:   0.003; rss: 1118MB -> 1118MB (   +0MB) crate_injection
time:  13.376; rss: 1118MB -> 3143MB (+2025MB) expand_crate
time:   0.002; rss: 3143MB -> 3143MB (   +0MB) check_unused_macros
time:  13.379; rss: 1118MB -> 3143MB (+2025MB) macro_expand_crate
time:   0.002; rss: 3143MB -> 3143MB (   +0MB) maybe_building_test_harness
time:   0.479; rss: 3143MB -> 3143MB (   +0MB) AST_validation
time:   0.002; rss: 3143MB -> 3143MB (   +0MB) maybe_create_a_macro_crate
time:   0.005; rss: 3143MB -> 3143MB (   +0MB) finalize_imports
time:   0.520; rss: 3143MB -> 3125MB (  -18MB) finalize_macro_resolutions
time:   4.446; rss: 3125MB -> 3577MB ( +453MB) late_resolve_crate
time:   0.000; rss: 3577MB -> 3577MB (   +0MB) resolve_main
time:   0.336; rss: 3577MB -> 3577MB (   +0MB) resolve_check_unused
time:   0.000; rss: 3577MB -> 3577MB (   +0MB) resolve_report_errors
time:   0.295; rss: 3577MB -> 3578MB (   +0MB) resolve_postprocess
time:   5.602; rss: 3143MB -> 3578MB ( +435MB) resolve_crate
time:   0.388; rss: 3578MB -> 3578MB (   +0MB) complete_gated_feature_checking
time:  20.014; rss: 1116MB -> 3578MB (+2462MB) configure_and_expand
time:   0.000; rss: 3578MB -> 3578MB (   +0MB) prepare_outputs
time:   0.000; rss: 3578MB -> 3578MB (   +0MB) blocked_on_dep_graph_loading
time:  64.219; rss: 3578MB -> 6313MB (+2736MB) hir_lowering
time:   1.102; rss: 6313MB -> 6319MB (   +6MB) early_lint_checks
time:   1.426; rss: 6319MB -> 6268MB (  -52MB) drop_ast
time:   0.005; rss: 5834MB -> 5836MB (   +2MB) setup_global_ctxt
time:   0.000; rss: 5838MB -> 5838MB (   +0MB) looking_for_entry_point
time:   0.292; rss: 5838MB -> 5840MB (   +1MB) looking_for_derive_registrar
time:   9.553; rss: 5838MB -> 6060MB ( +222MB) misc_checking_1
time:   9.949; rss: 6060MB -> 6764MB ( +704MB) type_collecting
time:   0.630; rss: 6764MB -> 6764MB (   +0MB) impl_wf_inference
time:   0.060; rss: 6764MB -> 6764MB (   +0MB) unsafety_checking
time:   3.054; rss: 6764MB -> 6787MB (  +23MB) coherence_checking
time:  20.702; rss: 6787MB -> 7533MB ( +746MB) wf_checking
time:   5.194; rss: 7533MB -> 7668MB ( +135MB) item_types_checking
time:  74.677; rss: 7668MB -> 8062MB ( +394MB) item_bodies_checking
time: 114.497; rss: 6060MB -> 8068MB (+2008MB) type_check_crate
time:   1.891; rss: 8068MB -> 8072MB (   +4MB) match_checking
time:   1.292; rss: 8072MB -> 8100MB (  +28MB) liveness_and_intrinsic_checking
time:   3.183; rss: 8068MB -> 8100MB (  +32MB) misc_checking_2
time:  68.845; rss: 8100MB -> 9279MB (+1179MB) MIR_borrow_checking
time:   0.587; rss: 9279MB -> 9295MB (  +17MB) MIR_effect_checking
time:   0.000; rss: 9295MB -> 9295MB (   +0MB) layout_testing
time:   4.443; rss: 9377MB -> 9504MB ( +127MB) death_checking
time:   0.034; rss: 9504MB -> 9504MB (   +0MB) unused_lib_feature_checking
time:   4.409; rss: 9504MB -> 9562MB (  +58MB) crate_lints
time:  56.490; rss: 9562MB -> 9571MB (   +8MB) module_lints
time:  60.900; rss: 9504MB -> 9571MB (  +66MB) lint_checking
time:   4.147; rss: 9571MB -> 9633MB (  +62MB) privacy_checking_modules
time:  75.094; rss: 9295MB -> 9633MB ( +337MB) misc_checking_3
time:   0.315; rss: 10357MB -> 10357MB (   +0MB) monomorphization_collector_root_collections
time:  14.501; rss: 10357MB -> 10571MB ( +215MB) monomorphization_collector_graph_walk
time:   1.763; rss: 10571MB -> 10661MB (  +89MB) partition_and_assert_distinct_symbols
time:  29.035; rss: 9633MB -> 10706MB (+1073MB) generate_crate_metadata
time:   0.000; rss: 10706MB -> 10706MB (   +0MB) find_cgu_reuse
time:  30.913; rss: 10706MB -> 12150MB (+1444MB) codegen_to_LLVM_IR
time:  31.108; rss: 10706MB -> 12150MB (+1444MB) codegen_crate
time:   0.000; rss: 12150MB -> 12150MB (   +0MB) assert_dep_graph
time:   0.000; rss: 12150MB -> 12150MB (   +0MB) check_dirty_clean
time:   0.416; rss: 12152MB -> 12199MB (  +46MB) encode_query_results_for(rustc_query_impl::queries::type_of)
time:   1.259; rss: 12199MB -> 12211MB (  +12MB) encode_query_results_for(rustc_query_impl::queries::generics_of)
time:   0.095; rss: 12211MB -> 12193MB (  -18MB) encode_query_results_for(rustc_query_impl::queries::predicates_of)
time:   0.005; rss: 12193MB -> 12195MB (   +2MB) encode_query_results_for(rustc_query_impl::queries::mir_const_qualif)
time:   0.828; rss: 12195MB -> 12208MB (  +14MB) encode_query_results_for(rustc_query_impl::queries::mir_for_ctfe)
time:  17.880; rss: 12208MB -> 11987MB ( -222MB) encode_query_results_for(rustc_query_impl::queries::optimized_mir)
time:   0.000; rss: 11987MB -> 11987MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::covered_file_name)
time:   0.000; rss: 11987MB -> 11987MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::covered_code_regions)
time:   0.007; rss: 11987MB -> 11988MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::promoted_mir)
time:   0.049; rss: 11988MB -> 11992MB (   +4MB) encode_query_results_for(rustc_query_impl::queries::unsafety_check_result)
time:   0.002; rss: 11992MB -> 11994MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::thir_check_unsafety)
time:  38.049; rss: 11994MB -> 12093MB (  +99MB) encode_query_results_for(rustc_query_impl::queries::typeck)
time:   0.000; rss: 12093MB -> 12093MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::diagnostic_only_typeck)
time:   0.024; rss: 12093MB -> 12095MB (   +2MB) encode_query_results_for(rustc_query_impl::queries::used_trait_imports)
time:   0.372; rss: 12095MB -> 12053MB (  -42MB) encode_query_results_for(rustc_query_impl::queries::mir_borrowck)
time:   0.015; rss: 12053MB -> 12053MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::eval_to_allocation_raw)
time:   0.005; rss: 12053MB -> 12054MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::eval_to_const_value_raw)
time:   0.003; rss: 12054MB -> 12056MB (   +2MB) encode_query_results_for(rustc_query_impl::queries::check_match)
time:   0.037; rss: 12056MB -> 11899MB ( -157MB) encode_query_results_for(rustc_query_impl::queries::symbol_name)
time:   0.667; rss: 11899MB -> 11708MB ( -191MB) encode_query_results_for(rustc_query_impl::queries::codegen_fn_attrs)
time:   0.045; rss: 11708MB -> 11709MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::codegen_fulfill_obligation)
time:   0.295; rss: 11709MB -> 11734MB (  +25MB) encode_query_results_for(rustc_query_impl::queries::specialization_graph_of)
time:   0.000; rss: 11734MB -> 11734MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::adt_drop_tys)
time:   0.000; rss: 11734MB -> 11734MB (   +0MB) encode_query_results_for(rustc_query_impl::queries::adt_significant_drop_tys)
time:   0.005; rss: 11734MB -> 11734MB (   +1MB) encode_query_results_for(rustc_query_impl::queries::unused_generic_params)
time:  60.063; rss: 12152MB -> 11734MB ( -418MB) encode_query_results
time:  76.745; rss: 12007MB -> 11699MB ( -308MB) LLVM_passes(crate)
time:  61.634; rss: 12150MB -> 10557MB (-1593MB) incr_comp_serialize_result_cache
time:  61.637; rss: 12150MB -> 10557MB (-1593MB) incr_comp_persist_result_cache
time:   0.001; rss: 10557MB -> 10557MB (   +0MB) incr_comp_persist_dep_graph
time:  61.641; rss: 12150MB -> 10557MB (-1593MB) serialize_dep_graph
time:  15.601; rss: 10557MB -> 10242MB ( -315MB) free_global_ctxt
time:   0.000; rss: 10242MB -> 10242MB (   +0MB) join_worker_thread
time:   0.368; rss: 10242MB -> 10242MB (   +0MB) copy_all_cgu_workproducts_to_incr_comp_cache_dir
time:   0.375; rss: 10242MB -> 10242MB (   +0MB) finish_ongoing_codegen
time:   0.000; rss: 10242MB -> 10242MB (   +0MB) llvm_dump_timing_file
time:   0.002; rss: 10242MB -> 10242MB (   +0MB) serialize_work_products
time:   0.001; rss: 9668MB -> 9668MB (   +0MB) incr_comp_finalize_session_directory
time:   0.000; rss: 9668MB -> 9668MB (   +0MB) link_binary_check_files_are_writeable
time:   1.469; rss: 9668MB -> 9671MB (   +3MB) link_rlib
time:   0.000; rss: 9671MB -> 9671MB (   +0MB) link_binary_remove_temps
time:   1.506; rss: 9668MB -> 9671MB (   +3MB) link_binary
time:   1.622; rss: 9668MB -> 9329MB ( -339MB) link_crate
time:   2.037; rss: 10242MB -> 9329MB ( -913MB) link
time: 502.990; rss:   32MB -> 5888MB (+5855MB) total
```

</details>

(6.34% decrease in runtime, results are consistent across multiple runs)

2 years agoRollup merge of #91208 - estebank:eq-constraint, r=cjgillot
Matthias Krüger [Sat, 27 Nov 2021 10:46:44 +0000 (11:46 +0100)]
Rollup merge of #91208 - estebank:eq-constraint, r=cjgillot

Account for incorrect `where T::Assoc = Ty` bound

Provide suggestoin to constrain trait bound for associated type.
Revert incorrect changes to `missing-bounds` test.

Address part of #20041.

2 years agoRollup merge of #91062 - jsha:static-file-replace, r=jyn514,GuillaumeGomez
Matthias Krüger [Sat, 27 Nov 2021 10:46:43 +0000 (11:46 +0100)]
Rollup merge of #91062 - jsha:static-file-replace, r=jyn514,GuillaumeGomez

rustdoc: Consolidate static-file replacement mechanism

There were a few places in rustdoc where we would take static JS or CSS and rewrite it at doc generation time to insert values. This consolidates all the CSS instances into one CSS file and replaces the JS examples with data- attributes on the rustdoc-vars div.

Demo https://rustdoc.crud.net/jsha/static-file-replace/test_docs/

r? ``@GuillaumeGomez``