Rollup merge of #83020 - hi-rustin:rustin-patch-enum, r=lcnr

Emit the enum range assumption if the range only contains one element

close https://github.com/rust-lang/rust/issues/82871
This commit is contained in:
Yuki Okushi 2021-03-13 09:44:44 +09:00 committed by GitHub
commit 04e24ae67e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -325,7 +325,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let er = scalar.valid_range_exclusive(bx.cx());
if er.end != er.start
&& scalar.valid_range.end() > scalar.valid_range.start()
&& scalar.valid_range.end() >= scalar.valid_range.start()
{
// We want `table[e as usize ± k]` to not
// have bound checks, and this is the most