... if they use arbitrary enum discriminant. Code like
```rust
enum Enum {
Foo = 1,
Bar(),
Baz{}
}
```
seems to be unintentionally allowed so we couldn't disallow them now,
but we could disallow them if arbitrary enum discriminant is used before
1.56 hits stable.
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
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.
r? `@oli-obk`
Update LLVM with patches for better llvm-cov diagnostics
Cherry-picks
ee88b8d63e
and
126e7611c7
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.
r? `@tmandry`
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`
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).
r? `@jyn514`
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.
Cherry-picks
ee88b8d63e
and
126e7611c7
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.
Add test for pattern_type_mismatch.
This issue has been fixed by [commit](8c1c763c2d)
This PR is used for close #7946(Fixes#7946).
changelog: Add test for pattern_type_mismatch.
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
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`.
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.
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=.`
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.
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.
`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`.
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
Instead we run `RemoveFalseEdges` and `RemoveUninitDrops` at the
appropriate time. The extra `SimplifyCfg` avoids visiting unreachable
blocks during `RemoveUninitDrops`.
Otherwise dataflow state will propagate along false edges and cause
things to be marked as maybe init unnecessarily. These should be
separate, since `SimplifyBranches` also makes `if true {} else {}` into
a `goto`, which means we wouldn't lint anything in the `else` block.
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.