rust/tests
Matthias Krüger 7afed92749
Rollup merge of #109475 - scottmcm:simpler-shifts, r=WaffleLapkin
Simpler checked shifts in MIR building

Doing masking to check unsigned shift amounts is overcomplicated; just comparing the shift directly saves a statement and a temporary, as well as is much easier to read as a human.  And shifting by unsigned is the canonical case -- notably, all the library shifting methods (that don't support every type) take shift RHSs as `u32` -- so we might as well make that simpler since it's easy to do so.

This PR also changes *signed* shift amounts to `IntToInt` casts and then uses the same check as for unsigned.  The bit-masking is a nice trick, but for example LLVM actually canonicalizes it to an unsigned comparison anyway <https://rust.godbolt.org/z/8h59fMGT4> so I don't think it's worth the effort and the extra `Constant`.  (If MIR's `assert` was `assert_nz` then the masking might make sense, but when the `!=` uses another statement I think the comparison is better.)

To review, I suggest looking at 2ee0468c49 first -- that's the interesting code change and has a MIR diff.

My favourite part of the diff:
```diff
-        _20 = BitAnd(_19, const 340282366920938463463374607431768211448_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
-        _21 = Ne(move _20, const 0_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
-        assert(!move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44
+        _18 = Lt(_17, const 8_u128);     // scope 0 at $DIR/shifts.rs:+2:34: +2:44
+        assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44
```
2023-03-23 08:35:35 +01:00
..
assembly Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
auxiliary
codegen Auto merge of #109172 - scottmcm:move-codegen-issues-tests, r=WaffleLapkin 2023-03-23 04:11:47 +00:00
codegen-units Use unused_generic_params from crate metadata 2023-03-14 16:33:12 +00:00
debuginfo Bless debuginfo test. 2023-03-13 18:24:48 +00:00
incremental Rollup merge of #105793 - lukas-code:circular-deps, r=Mark-Simulacrum 2023-03-19 15:33:55 +05:30
mir-opt Rollup merge of #109475 - scottmcm:simpler-shifts, r=WaffleLapkin 2023-03-23 08:35:35 +01:00
pretty Auto merge of #108148 - parthopdas:master, r=oli-obk 2023-03-20 03:24:27 +00:00
run-make Update coverage info. 2023-03-09 17:51:38 +00:00
run-make-fulldeps Auto merge of #108262 - ChrisDenton:libntdll, r=Mark-Simulacrum 2023-03-21 02:23:27 +00:00
run-pass-valgrind
rustdoc Rollup merge of #109375 - clubby789:unescape-deprecated-doc, r=jsha 2023-03-20 07:10:35 +01:00
rustdoc-gui Add GUI test for "Auto-hide item contents for large items" setting 2023-03-20 20:25:35 +01:00
rustdoc-js rustdoc: implement bag semantics for function parameter search 2023-03-19 18:19:24 -07:00
rustdoc-js-std Rollup merge of #108875 - notriddle:notriddle/return-trait, r=GuillaumeGomez 2023-03-16 08:57:05 +01:00
rustdoc-json Add test for c_variadic in rustdoc-json 2023-03-18 17:59:29 +00:00
rustdoc-ui rustdoc: Cleanup parent module tracking for doc links 2023-03-21 17:36:57 +04:00
ui Rollup merge of #109462 - compiler-errors:alias-relate, r=BoxyUwU,lcnr 2023-03-23 08:35:35 +01:00
ui-fulldeps Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
COMPILER_TESTS.md