While it might *seem* that this does something, it actually doesn't.
`mut_borrow_of_mutable_ref` returns a `bool` that is ignored by the
let-else. This was basically
```rust
if !self.body.local_decls.get(local).is_some() {
return
}
```
Which is pretty useless
Don't transmute `&List<GenericArg>` <-> `&List<Ty>`
In #93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`.
While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see https://github.com/rust-lang/rust/pull/94799#issuecomment-1064340003, https://github.com/rust-lang/rust/pull/94841, https://github.com/rust-lang/rust/pull/110496#issuecomment-1513799140).
Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler).
Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc.
r? `@compiler-errors`
Missing blanket impl trait not public
Fixes#94183.
The problem was that we should have checked if the trait was reachable instead of only "directly public".
r? `@notriddle`
Fix `tests/run-make-translation` when download-rustc is enabled
When building locally, we never generate a `share` directory in the local sysroot. However, when we download the `rustc` component from ci, it includes a `share/man` directory in the sysroot. The `run-make/translation` test assumed that it didn't exist, and would create a link from `fakeroot` to the real share directory, and write symbolic links into it. Change it not to create the link, so that rustc doesn't try to load multiple copies of the same `.ftl` file.
Fixes https://github.com/rust-lang/rust/issues/110357.
Fix `x test lint-docs linkchecker` when download-rustc is enabled
Bootstrap was setting LD_LIBRARY_PATH for bootstrap tools in `tool_cmd`, and rustc inherited that environment. That broke when download-rustc was enabled; see the new comment for details.
Fixes https://github.com/rust-lang/rust/issues/110354
'./configure' now checks if 'config.toml' exists before writing to that destination
Fixes#110109
Instead of overwriting the current `config.toml` file, exit the `./configure` script with a message stating why.
This also makes some other minor cleanups:
- Suggest `python x.py` on windows instead of `./x.py`, which usually
doesn't work
- Move the "Configure and Make" section to a subsection of "Building on
Unix"
- Mention `config.toml` earlier
- Suggest `x.py setup user` on Windows, since `configure` won't work
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
When building locally, we never generate a `share` directory in the
local sysroot. However, when we download the `rustc` component from ci,
it includes a `share/man` directory in the sysroot. The
`run-make/translation` test assumed that it didn't exist, and would
create a link from `fakeroot` to the real share directory, and write
symbolic links into it. Change it not to create the link, so that rustc
doesn't try to load multiple copies of the same `.ftl` file.
Rollup of 7 pull requests
Successful merges:
- #110432 (Report more detailed reason why `Index` impl is not satisfied)
- #110451 (Minor changes to `IndexVec::ensure_contains_elem` & related methods)
- #110476 (Delay a good path bug on drop for `TypeErrCtxt` (instead of a regular delayed bug))
- #110498 (Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys`)
- #110507 (boostrap: print output during building tools)
- #110510 (Fix ICE for transmutability in candidate assembly)
- #110513 (make `non_upper_case_globals` lint not report trait impls)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
make `non_upper_case_globals` lint not report trait impls
We should not lint on trait `impl`s for `non_upper_case_globals`; the user doesn't have control over the name. This brings `non_upper_case_globals` into consistency with other `nonstandard_style` lints.
Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys`
Part of the work to finish https://github.com/rust-lang/rust/issues/105779.
This PR adds `EarlyBinder` to the return type of the `collect_return_position_impl_trait_in_trait_tys` query and removes `bound_return_position_impl_trait_in_trait_tys`.
r? `@lcnr`
Delay a good path bug on drop for `TypeErrCtxt` (instead of a regular delayed bug)
r? `@lcnr`
Perhaps we should just delete the `Drop` impl altogether though?
Fixesrust-lang/rust-clippy#10645
`@matthiaskrgr:` I don't know how to make a clippy test for this. Any idea? Clippy's UI tests run with `-D warnings` and I have no idea how to switch it off to make a test that triggers this ICE in the clippy test suite 🤣
Bootstrap was setting LD_LIBRARY_PATH for bootstrap tools in `tool_cmd`,
and rustc inherited that environment. That broke when download-rustc was
enabled; see the new comment for details.
Don't allocate on SimplifyCfg/Locals/Const on every MIR pass
Hey! 👋🏾 This is a first PR attempt to see if I could speed up some rustc internals.
Thought process:
```rust
pub struct SimplifyCfg {
label: String,
}
```
in [compiler/src/rustc_mir_transform/simplify.rs](7908a1d654/compiler/rustc_mir_transform/src/simplify.rs (L39)) fires multiple times per MIR analysis. This means that a likely string allocation is happening in each of these runs, which may add up, as they are not being lazily allocated or cached in between the different passes.
...yes, I know that adding a global static array is probably not the future-proof solution, but I wanted to lob this now as a proof of concept to see if it's worth shaving off a few cycles and then making more robust.