bors [Wed, 1 Dec 2021 23:22:43 +0000 (23:22 +0000)]
Auto merge of #90446 - cjgillot:late-elided, r=jackh726
Lint elided lifetimes in path during lifetime resolution.
The lifetime elision lint is known to be brittle and can be redundant with later lifetime resolution errors. This PR aims to remove the redundancy by performing the lint after lifetime resolution.
This PR proposes to carry the information that an elision should be linted against by using a special `LifetimeName`. I am not certain this is the best solution, but it is certainly the easiest.
bors [Wed, 1 Dec 2021 20:14:07 +0000 (20:14 +0000)]
Auto merge of #91433 - matthiaskrgr:rollup-118ql06, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #88502 (Add slice take methods)
- #91313 (expand: Turn `ast::Crate` into a first class expansion target)
- #91424 (Update LLVM with patches for better llvm-cov diagnostics)
- #91425 (Include lint errors in error count for `-Ztreat-err-as-bug`)
- #91430 (Add tests for `normalize-docs` overflow errors)
Matthias Krüger [Wed, 1 Dec 2021 19:57:48 +0000 (20:57 +0100)]
Rollup merge of #91430 - jyn514:normalize-fallible, r=jackh726
Add tests for `normalize-docs` overflow errors
`@b-naber` do you understand why using `try_normalize_erasing_regions` doesn't silence these cycle errors? Rustdoc isn't emitting them, rustc is aborting before returning an error, even though the function has `try_` in the name.
cc https://github.com/rust-lang/rust/issues/82692, https://github.com/rust-lang/rust/pull/91255
Matthias Krüger [Wed, 1 Dec 2021 19:57:47 +0000 (20:57 +0100)]
Rollup merge of #91425 - jyn514:treat-lint-err-as-bug, r=oli-obk
Include lint errors in error count for `-Ztreat-err-as-bug`
This was a regression from https://github.com/rust-lang/rust/pull/87337;
the `panic_if_treat_err_as_bug` function only checked the number of hard
errors, not the number of lint errors.
These patches to LLVM were added to help debug occasional errors that
cause coverage reporting to fail. Prior to this patch, the only messaging
was that the coverage data was malformed. Hopefully the improved
messaging will help identify the root cause of these errors, when they
arise, so we can make corrections to coverage output from Rust.
Matthias Krüger [Wed, 1 Dec 2021 19:57:43 +0000 (20:57 +0100)]
Rollup merge of #91313 - petrochenkov:cratexp, r=Aaron1011
expand: Turn `ast::Crate` into a first class expansion target
And stop creating a fake `mod` item for the crate root when expanding a crate, thus addressing FIXMEs left in https://github.com/rust-lang/rust/pull/82238, and making a step towards a proper support for crate-level macro attributes (cc #54726).
I haven't added token collection support for the whole crate in this PR, maybe later.
r? `@Aaron1011`
bors [Wed, 1 Dec 2021 16:41:52 +0000 (16:41 +0000)]
Auto merge of #91275 - camelid:deny-test-warnings, r=jyn514
Deny warnings in rustdoc non-UI tests
These warnings were silently ignored since they did not appear in a
`.stderr` file and did not fail the test. With this change, warnings in
tests are denied, causing the tests to fail if they have warnings.
This change has already led me to find a bug in rustdoc (#91274) and a
useless test (`src/test/rustdoc/primitive/primitive-generic-impl.rs`,
though its uselessness is unrelated to its warnings).
Joshua Nelson [Wed, 1 Dec 2021 16:32:55 +0000 (16:32 +0000)]
Include lint errors in error count for `-Ztreat-err-as-bug`
This was a regression from https://github.com/rust-lang/rust/pull/87337;
the `panic_if_treat_err_as_bug` function only checked the number of hard
errors, not the number of lint errors.
These patches to LLVM were added to help debug occasional errors that
cause coverage reporting to fail. Prior to this patch, the only messaging
was that the coverage data was malformed. Hopefully the improved
messaging will help identify the root cause of these errors, when they
arise, so we can make corrections to coverage output from Rust.
Previously we called `normalize_erasing_regions` inside `layout_of`. `normalize_erasing_regions` assumes that the normalization succeeds. Since some `layout_of` calls happen before typecheck has finished, we introduce a new variant that allows for returning an error.
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.)
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`.
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.
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=.`
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.
`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`.
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)
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.
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=.`
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'.
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.
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.
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)
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—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.
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.
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)
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.
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`)
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.
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
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)