rustc: add ReErased to be used by trait selection, MIR and trans.
`ReErased` replaces `ReStatic` (i.e. `'static`) for erasing regions.
Using a distinct lifetime helps prevent accidental mix-ups between the two.
It also allows cleaner type printing (see test changes), including in symbol names:
```rust
str..pattern..CharSearcher$LT$$u27$static$GT$::drop.30560::h840c2f2afc03bbea // before
str..pattern..CharSearcher::drop.30561::h6bd31d2af614377a // after
```
Not that we should be producing symbols this way, but it's still better.
[MIR] Fix double-rounding of float constants and ignore NaN sign in tests.
Fixes#32805 by handling f32 and f64 separately in rustc_const_eval.
Also removes `#[rustc_no_mir]` from a couple libstd tests by ignoring NaN sign.
Turns out that runtime evaluation of `0.0 / 0.0` produces a NaN with the sign bit set,
whereas LLVM constant folds it to a NaN with the sign bit unset, which we were testing for.
Add error description for E0174
Reference for issue: #32777
r? @GuillaumeGomez
Hey Guillaume, sorry for taking too long to do it. I got some unexpected work during the week.
Waiting for your review :)
Unsupport wget
wget support was removed in #32942 (search for wget in diff), but configure wasn't updated. wget support was introduced in #7498 for Windows, but we now use PowerShell on Windows.
Makefile.in: dont use unnecessary escapes in echo
I don't know if `echo` allows escapes without `-e` on other systems, but on a GNU userland this outputs literal `\n` on the terminal. In this case there's an easy way to write this without escapes anyway.
r? @GuillaumeGomez
Makefile.in: dont use unnecessary escapes in echo
I don't know if `echo` allows escapes without `-e` on other systems, but on a GNU userland this outputs literal `\n` on the terminal. In this case there's an easy way to write this without escapes anyway.
r? @GuillaumeGomez
linkchecker: Treat directory links as errors
Directory links don't work well offline so they should be treated as errors.
All examples of this I know of are fixed in #34021.
[MIR] Implement overflow checking
The initial set of changes is from @Aatch's #33255 PR, rebased on master, plus:
Added an `Assert` terminator to MIR, to simplify working with overflow and bounds checks.
With this terminator, error cases can be accounted for directly, instead of looking for lang item calls.
It also keeps the MIR slimmer, with no extra explicit blocks for the actual panic calls.
Warnings can be produced when the `Assert` is known to always panic at runtime, e.g.:
```rust
warning: index out of bounds: the len is 1 but the index is 3
--> <anon>:1:14
1 |> fn main() { &[std::io::stdout()][3]; }
|> ^^^^^^^^^^^^^^^^^^^^^^
```
Generalized the `OperandValue::FatPtr` optimization to any aggregate pair of immediates.
This allows us to generate the same IR for overflow checks as old trans, not something worse.
For example, addition on `i16` calls `llvm.sadd.with.overflow.i16`, which returns `{i16, i1}`.
However, the Rust type `(i16, bool)`, has to be `{i16, i8}`, only an immediate `bool` is `i1`.
But if we split the pair into an `i16` and an `i1`, we can pass them around as such for free.
The latest addition is a rebase of #34054, updated to work for pairs too. Closes#34054, fixes#33873.
Last but not least, the `#[rustc_inherit_overflow_checks]` attribute was introduced to control the
overflow checking behavior of generic or `#[inline]` functions, when translated in another crate.
It is **not** intended to be used by crates other than `libcore`, which is in the unusual position of
being distributed as only an optimized build with no checks, even when used from debug mode.
Before MIR-based translation, this worked out fine, as the decision for overflow was made at
translation time, in the crate being compiled, but MIR stored in `rlib` has to contain the checks.
To avoid always generating the checks and slowing everything down, a decision was made to
use an attribute in the few spots of `libcore` that need it (see #33255 for previous discussion):
* `core::ops::{Add, Sub, Mul, Neg, Shl, Shr}` implementations for integers, which have `#[inline]` methods and can be used in generic abstractions from other crates
* `core::ops::{Add, Sub, Mul, Neg, Shl, Shr}Assign` same as above, for augmented assignment
* `pow` and `abs` methods on integers, which intentionally piggy-back on built-in multiplication and negation, respectively, to get overflow checks
* `core::iter::{Iterator, Chain, Peek}::count` and `core::iter::Enumerate::{next, nth}`, also documented as panicking on overflow, from addition, counting elements of an iterator in an `usize`
generate fewer basic blocks for variant switches
CC #33567
Adds a new field to TestKind::Switch that tracks the variants that are actually matched against. The other candidates target a common "otherwise" block.