Migrate most of `rustc_builtin_macros` to diagnostic impls
cc #100717
This is a couple of days work, but I decided to stop for now before the PR becomes too big. There's around 50 unresolved failures when `rustc::untranslatable_diagnostic` is denied, which I'll finish addressing once this PR goes thtough
A couple of outputs have changed, but in all instances I think the changes are an improvement/are more consistent with other diagnostics (although I'm happy to revert any which seem worse)
Links to README.md files must actually be links to index.md files,
because of the inner workings of `mdbook`.
Also use the latest mdbook version in CI.
rustc_metadata: Filter encoded data more aggressively using `DefKind`
I focused on data that contains spans, because spans are expensive to encode/decode/hash, but also touched `should_encode_visibility` too.
One incorrect use of impl visibility in diagnostics is also replaced with trait visibility.
These don't optimize with debug assertions. For one of them, this
is due to the new alignment checks, for the other I'm not sure
what specifically blocks it.
this test was added for rust 0.4 and doesn't test anything specific.
The repro originally relied on extern functions which are now just
ordinary methods. It's also a run pass test even though `main` has
been commented out.
Rollup of 8 pull requests
Successful merges:
- #109527 (Set up standard library path substitution in rust-gdb and gdbgui)
- #109752 (Stall auto trait assembly in new solver for int/float vars)
- #109860 (Add support for RISC-V relax target feature)
- #109923 (Update `error [E0449]: unnecessary visibility qualifier` to be more clear)
- #110070 (The `wrapping_neg` example for unsigned types shouldn't use `i8`)
- #110146 (fix(doc): do not parse inline when output is json for external crate)
- #110147 (Add regression test for #104916)
- #110149 (Update books)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
There's a bad pattern matching confusion present in this function.
`_anon` gets assigned to, and then `_anon` is used as an unbound
variable in the pattern, which is unrelated to the first `_anon`.
If the `_anon` didn't start with `_` the compiler would give warnings.
This was introduced in #104239.
I have rewritten the function to remove the confusion and preserve the
existing behaviour. This seems safest, because the original intent is
not clear.
Update books
## rust-lang/book
1 commits in 0510ca84c2ce6bf93c4ccf9248756e9e4fd00b12..c06006157b14b3d47b5c716fc392b77f3b2e21ce
2023-04-03 15:31:55 UTC to 2023-04-03 15:31:55 UTC
- Fix grammar (rust-lang/book#3600)
## rust-lang/reference
3 commits in 3c47807a3131b3c7cacb508f52632078d253cd0a..1f8dc727e94ae4ef92adf70df979521a1ea1143e
2023-04-09 14:04:53 UTC to 2023-03-29 13:21:47 UTC
- Explain typos in `asm!` can be unsound (rust-lang/reference#1344)
- Fix coding style in example: add space between module name and bracket (rust-lang/reference#1347)
- redundant word removed (rust-lang/reference#1346)
## rust-lang/rust-by-example
1 commits in ba84bf35d0f17d404003349309201654d25f61af..31961fe22521a779070a44a8f30a2b00a20b6212
2023-04-10 13:06:34 UTC to 2023-04-10 13:06:34 UTC
- Add clarity to name of file being used in library example. (rust-lang/rust-by-example#1697)
## rust-lang/rustc-dev-guide
8 commits in fca8af6c154c6cde2512f1331cf2704f214a818e..6337ed17fb8dcd918d78b7d97d213e923530337c
2023-04-10 14:23:05 UTC to 2023-04-06 00:29:18 UTC
- fix markup (rust-lang/rustc-dev-guide#1670)
- Reorganize "Getting Started" and add a "What should I work on?" section (rust-lang/rustc-dev-guide#1665)
- Clarify cfg(bootstrap) docs (rust-lang/rustc-dev-guide#1669)
- Link to forge instead of duplicating toolstate info (rust-lang/rustc-dev-guide#1664)
- Improve the landing page for contributing to the libstd docs (rust-lang/rustc-dev-guide#1666)
- Various improvements to `check_line_lengths.sh` (rust-lang/rustc-dev-guide#1667)
- Document how to ignore specific files in a diff (rust-lang/rustc-dev-guide#1668)
- mention `git clone --depth 1` (rust-lang/rustc-dev-guide#1663)
Add regression test for #104916Closes#104916
I haven't tested if it still passes with debug assertions enabled so it'd be better to wait for CI to be green.
r? compiler-errors
Update `error [E0449]: unnecessary visibility qualifier` to be more clear
This updates the error message `error[E0449]: unnecessary visibility qualifier` by clearly indicating that visibility qualifiers already inherit their visibility from a parent item. The error message previously implied that the qualifiers were permitted, which is not the case anymore.
Resolves#109822.
Add support for RISC-V relax target feature
This adds `relax` as an allowed RISC-V target feature. The relax feature in LLVM enables [linker relaxation](https://www.sifive.com/blog/all-aboard-part-3-linker-relaxation-in-riscv-toolchain), an optimization specific to RISC-V that allows global variable accesses to be resolved by the linker by using the global pointer (`gp`) register (rather than constructing the addresses from scratch for each access). Enabling `relax` will cause LLVM to emit relocations in the object file that support this. The feature can be enabled in rustc with `-C target-feature=+relax`.
Currently this feature is disabled by default, but maybe it should be enabled by default since it is an easy performance improvement (but requires the `gp` register to be set up properly). GCC/Clang enable this feature by default (for both hosted/bare-metal targets), and include the `-mno-relax` flag to disable it (see [here](466d554dca/clang/lib/Driver/ToolChains/Arch/RISCV.cpp (L145)) for the code that enables it in Clang). I think it would make sense to enable by default, at least for all hosted targets since the `gp` register should be automatically set up by the runtime. For bare-metal targets, `gp` must be set up manually, so it is probably best to leave off by default to avoid breaking existing applications that do not set up `gp`. Leaving it disabled by default for all targets is also reasonable though.
Let me know your thoughts. Thanks!
Fixes#109426.
Set up standard library path substitution in rust-gdb and gdbgui
Fixes#62945
---
Only lightly tested (in release mode, where the paths are a bit of a mess) because my `gdb` appears to crash with `internal-error: inside_main_func: Assertion 'block != nullptr' failed.` and I don't have `gdbgui`. Please review carefully my shell syntax.
There's also `rust-lldb`, but I don't know the equivalent for it.