Update LLVM to 21.1.3
Fixes https://github.com/rust-lang/rust/issues/146742.
After rust-lang/rust#146124, we need more space to run x86_64-gnu-distcheck if building LLVM from source. According to the building log, the space freed by `free-disk-space-linux.sh` is not entirely available.
```
You are running out of disk space.
The runner will stop working when the machine runs out of disk space.
Free space left: 98 MB
disk usage:
Filesystem Size Used Avail Use% Mounted on
/dev/root 72G 43G 29G 60% /
tmpfs 7.9G 84K 7.9G 1% /dev/shm
tmpfs 3.2G 1.2M 3.2G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda16 881M 60M 760M 8% /boot
/dev/sda15 105M 6.2M 99M 6% /boot/efi
/dev/sdb1 74G 28K 70G 1% /mnt
tmpfs 1.6G 12K 1.6G 1% /run/user/1001
```
Add a config option `inherent-impl-lint-scope` to the lint
`multiple_inherent_impl` to target a different scope according to
people's needs. It can take three values: `module`, `file`, and `crate`
(default).
- `module` is the weakest option. It lints if there are two or more
impls in the same module.
- `file` is a bit stronger, since it lints if there are two or more
impls in the same file. So, this triggers the lint (where it did not
with module):
- `crate` is the strongest of them; it triggers as soon as there are two
or more impls anywhere in the crate. It is the current behaviour of the
lint, so it's the default option.
changelog: [`multiple_inherent_impl`] : Add config option (`module`,
`file` or `crate`) to target specific scope
fixesrust-lang/rust-clippy#14867
Fix normalization overflow ICEs in monomorphization
Fixesrust-lang/rust#92004Fixesrust-lang/rust#92470Fixesrust-lang/rust#95134Fixesrust-lang/rust#105275Fixesrust-lang/rust#105937
Fixes rust-lang/rust#117696-2
Fixesrust-lang/rust#118590Fixesrust-lang/rust#122823Fixesrust-lang/rust#131342Fixesrust-lang/rust#139659
## Analysis:
The causes of these issues are similar. They contain generic recursive functions that can be instantiated with different args infinitely at monomorphization stage.
Ideally this should be caught by the [`check_recursion_limit`](c0bb3b98bb/compiler/rustc_monomorphize/src/collector.rs (L468)) function. The reality is that normalization can reach recursion limit earlier than monomorphization's check because they calculate depths in different ways.
Since normalization is called everywhere, ICEs appear in different locations.
## Fix:
If we abort on overflow with `TypingMode::PostAnalysis` in the trait solver, it would also catch these errors.
The main challenge is providing good diagnostics for them. So it's quite natural to put the check right before these normalization happening.
I first tried to check the whole MIR body's normalization and `references_error`. (As elaborate_drop handles normalization failure by [returning `ty::Error`](c0bb3b98bb/compiler/rustc_mir_transform/src/elaborate_drop.rs (L514-L519)).)
It turns out that checking all `Local`s seems sufficient.
These types are gonna be normalized anyway. So with cache, these checks shouldn't be expensive.
This fixes these ICEs for both the next and old solver, though I'm not sure the change I made to the old solver is proper. Its overflow handling looks convoluted thus I didn't try to fix it more "upstream".
`tracing` at the time of writing has a feature (?) in its Filter
implementation, so that filters like EnvFilter are consulted for status
of a span or event and whether it is marked as interesting for logging.
Combining a Filter with another layer through the `with_filter`
combinator produces a filtered layer that enables an event unless it is
statically determined that the event is uninteresting.
However, if the filter is dynamic, because of filtering on span names or
field values as an example, events are **always** enabled.
There is an `event_enabled` predicate on `EnvFilter` implementation but
it falls back to default and, thus, the dynamic filters are **unused**.
This patch re-enables span- and field-based filters.
These tests capture the behaviour that the decision to include/exclude
runtime contract assertions is determined on a per-crate basis,
i.e. by the flags used to compile each crate.
Add tidy to the target of ./x check
## Context
Discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/tidy.20isn't.20in.20.2E.2Fx.20check/with/544323712
Currently `tidy` (src/tools/tidy) is not included in the list of `./x check`. It means that rust-analyzer doesn't work for codes in the directory if you use `./x check` as the analyzer on your IDE.
## Change
This PR adds src/tools/tidy into the target of `./x check`. It enables rust-analyzer highlight errors/warns on all codes in the directory.
Note that since tidy is implicitly checked by `./x test tidy`, this new check is off by default.
Don't unconditionally build alloc for `no-std` targets
It's possible for targets to only support `core` and not `alloc`. Instead of building alloc unconditionally, pass a list of crates to build into `std_cargo`, and only pass `-p alloc` if the list of crates wasn't already filtered to a subset.
The original use case was to reuse `std_cargo` for a rustc_driver that doesn't emit metadata. But this seems like a reasonable change regardless.
Not all ARMv7-A CPUs have a double-precision FPU. So adjust the CFLAGS
from `+vfpv3` (which assumes 32 double-precision registers) to `+fp`
(which only assumes 16 double-precision registers).
Perform unused assignment and unused variables lints on MIR.
Rebase of https://github.com/rust-lang/rust/pull/101500
Fixes https://github.com/rust-lang/rust/issues/51003.
The first commit moves detection of uninhabited types from the current liveness pass to MIR building.
In order to keep the same level of diagnostics, I had to instrument MIR a little more:
- keep for which original local a guard local is created;
- store in the `VarBindingForm` the list of introducer places and whether this was a shorthand pattern.
I am not very proud of the handling of self-assignments. The proposed scheme is in two parts: first detect probable self-assignments, by pattern matching on MIR, and second treat them specially during dataflow analysis. I welcome ideas.
Please review carefully the changes in tests. There are many small changes to behaviour, and I'm not sure all of them are desirable.
Note that the code in `LLVMRustDIBuilderCreateStaticVariable` that tried to
downcast `InitVal` appears to have been dead, because `llvm::ConstantInt` and
`llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`.
Replace `LLVMRustContextCreate` with normal LLVM-C API calls
Since `LLVMRustContextCreate` can easily be replaced with a call to `LLVMContextCreate` and `LLVMContextSetDiscardValueNames`.
Work towards https://github.com/rust-lang/rust/issues/46437
Extract most code from `define_feedable!`
This PR extracts most of the non-trivial code from the `define_feedable!` macro (which defines the `TyCtxtFeed::$query` methods), and moves it to a helper function `query_feed_inner` written in ordinary non-macro code.
Doing so should make that code easier to read and modify, because it now gets proper IDE support and has explicit trait bounds.
---
There should be no change in compiler behaviour.
I've structured the commits so that the actual extraction part is mostly just whitespace changes, making it easier to review individually with whitespace changes hidden.
Add an ACP list item to the library tracking issue template
Most new API has an associated ACP that is useful to reference, but it doesn't appear anywhere on the template for new tracking issues. Update this template to include a link to the ACP.
Save x.py's help text for saving output time
Fixrust-lang/rust#141903
Currently x.py help (--help) builds bootstrap binary everytime, so it takes some seconds to print help.
This PR does:
- Saves current help text into a file (x.py run generate-help)
- Changes bootstrap.py to print the help in the saved file and to exit without touching bootstrap binary
- Modifies x.py test bootstrap to check if the help file is up-to-date
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#4 of Batch #2]
Part of rust-lang/rust#133895
Methodology:
1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer
Inspired by the methodology that `@Kivooeo` was using.
r? `@jieyouxu`
core: simplify `Extend` for tuples
This is an alternative to https://github.com/rust-lang/rust/pull/137400. The current macro is incredibly complicated and introduces subtle bugs like calling the `extend_one` of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from https://github.com/rust-lang/rust/pull/137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized `Extend` implementations of the individual collection.
This commit adds src/tools/tidy into `./x check`. It enables rust-analyzer hightlights errors/warns on all codes in src/tools/tidy.
Since tidy is implicitly checked by `./x test tidy`, this new check is off by default.