Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #106347 (More accurate spans for arg removal suggestion) - #108057 (Prevent some attributes from being merged with others on reexports) - #108090 (`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`) - #108092 (note issue for feature(packed_bundled_libs)) - #108099 (use chars instead of strings where applicable) - #108115 (Do not ICE on unmet trait alias bounds) - #108125 (Add new people to the compiletest review rotation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
9a7cc6c32f
92 changed files with 677 additions and 558 deletions
|
@ -319,7 +319,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
// See the notes for `ExprKind::Array` in `as_rvalue` and for
|
||||
// `ExprKind::Borrow` above.
|
||||
let is_union = adt_def.is_union();
|
||||
let active_field_index = if is_union { Some(fields[0].name.index()) } else { None };
|
||||
let active_field_index = is_union.then(|| fields[0].name.index());
|
||||
|
||||
let scope = this.local_scope();
|
||||
|
||||
|
|
|
@ -563,14 +563,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let not_contained =
|
||||
self.values_not_contained_in_range(&*range, options).unwrap_or(false);
|
||||
|
||||
if not_contained {
|
||||
not_contained.then(|| {
|
||||
// No switch values are contained in the pattern range,
|
||||
// so the pattern can be matched only if this test fails.
|
||||
let otherwise = options.len();
|
||||
Some(otherwise)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
options.len()
|
||||
})
|
||||
}
|
||||
|
||||
(&TestKind::SwitchInt { .. }, _) => None,
|
||||
|
|
|
@ -172,7 +172,7 @@ impl IntRange {
|
|||
ty: Ty<'tcx>,
|
||||
end: &RangeEnd,
|
||||
) -> Option<IntRange> {
|
||||
if Self::is_integral(ty) {
|
||||
Self::is_integral(ty).then(|| {
|
||||
// Perform a shift if the underlying types are signed,
|
||||
// which makes the interval arithmetic simpler.
|
||||
let bias = IntRange::signed_bias(tcx, ty);
|
||||
|
@ -182,10 +182,8 @@ impl IntRange {
|
|||
// This should have been caught earlier by E0030.
|
||||
bug!("malformed range pattern: {}..={}", lo, (hi - offset));
|
||||
}
|
||||
Some(IntRange { range: lo..=(hi - offset), bias })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
IntRange { range: lo..=(hi - offset), bias }
|
||||
})
|
||||
}
|
||||
|
||||
// The return value of `signed_bias` should be XORed with an endpoint to encode/decode it.
|
||||
|
|
|
@ -203,11 +203,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
|||
if !lower_overflow && !higher_overflow {
|
||||
self.tcx.sess.emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
|
||||
span,
|
||||
teach: if self.tcx.sess.teach(&error_code!(E0030)) {
|
||||
Some(())
|
||||
} else {
|
||||
None
|
||||
},
|
||||
teach: self.tcx.sess.teach(&error_code!(E0030)).then_some(()),
|
||||
});
|
||||
}
|
||||
PatKind::Wild
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue