Rustup to rust-lang/rust#67258
This commit is contained in:
parent
43ac9416d9
commit
1d7d4e9217
@ -713,16 +713,18 @@ fn all_ranges<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arms: &'tcx [Arm<'_>]) -> Ve
|
|||||||
} = *arm
|
} = *arm
|
||||||
{
|
{
|
||||||
if let PatKind::Range(ref lhs, ref rhs, ref range_end) = pat.kind {
|
if let PatKind::Range(ref lhs, ref rhs, ref range_end) = pat.kind {
|
||||||
let lhs = constant(cx, cx.tables, lhs)?.0;
|
if let (Some(l), Some(r)) = (lhs, rhs) {
|
||||||
let rhs = constant(cx, cx.tables, rhs)?.0;
|
let lhs = constant(cx, cx.tables, l)?.0;
|
||||||
let rhs = match *range_end {
|
let rhs = constant(cx, cx.tables, r)?.0;
|
||||||
RangeEnd::Included => Bound::Included(rhs),
|
let rhs = match *range_end {
|
||||||
RangeEnd::Excluded => Bound::Excluded(rhs),
|
RangeEnd::Included => Bound::Included(rhs),
|
||||||
};
|
RangeEnd::Excluded => Bound::Excluded(rhs),
|
||||||
return Some(SpannedRange {
|
};
|
||||||
span: pat.span,
|
return Some(SpannedRange {
|
||||||
node: (lhs, rhs),
|
span: pat.span,
|
||||||
});
|
node: (lhs, rhs),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let PatKind::Lit(ref value) = pat.kind {
|
if let PatKind::Lit(ref value) = pat.kind {
|
||||||
|
@ -617,9 +617,13 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
|
|||||||
start_pat, end_pat, end_kind, current
|
start_pat, end_pat, end_kind, current
|
||||||
);
|
);
|
||||||
self.current = start_pat;
|
self.current = start_pat;
|
||||||
self.visit_expr(start);
|
if let Some(expr) = start {
|
||||||
|
self.visit_expr(expr);
|
||||||
|
}
|
||||||
self.current = end_pat;
|
self.current = end_pat;
|
||||||
self.visit_expr(end);
|
if let Some(expr) = end {
|
||||||
|
self.visit_expr(expr);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
PatKind::Slice(ref start, ref middle, ref end) => {
|
PatKind::Slice(ref start, ref middle, ref end) => {
|
||||||
let start_pat = self.next("start");
|
let start_pat = self.next("start");
|
||||||
|
@ -195,7 +195,10 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
|
|||||||
ls == rs && over(l, r, |l, r| self.eq_pat(l, r))
|
ls == rs && over(l, r, |l, r| self.eq_pat(l, r))
|
||||||
},
|
},
|
||||||
(&PatKind::Range(ref ls, ref le, ref li), &PatKind::Range(ref rs, ref re, ref ri)) => {
|
(&PatKind::Range(ref ls, ref le, ref li), &PatKind::Range(ref rs, ref re, ref ri)) => {
|
||||||
self.eq_expr(ls, rs) && self.eq_expr(le, re) && (*li == *ri)
|
if let (Some(ls), Some(rs), Some(le), Some(re)) = (ls, rs, le, re) {
|
||||||
|
return self.eq_expr(ls, rs) && self.eq_expr(le, re) && (*li == *ri);
|
||||||
|
}
|
||||||
|
false
|
||||||
},
|
},
|
||||||
(&PatKind::Ref(ref le, ref lm), &PatKind::Ref(ref re, ref rm)) => lm == rm && self.eq_pat(le, re),
|
(&PatKind::Ref(ref le, ref lm), &PatKind::Ref(ref re, ref rm)) => lm == rm && self.eq_pat(le, re),
|
||||||
(&PatKind::Slice(ref ls, ref li, ref le), &PatKind::Slice(ref rs, ref ri, ref re)) => {
|
(&PatKind::Slice(ref ls, ref li, ref le), &PatKind::Slice(ref rs, ref ri, ref re)) => {
|
||||||
|
@ -483,8 +483,12 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, indent: usize) {
|
|||||||
},
|
},
|
||||||
hir::PatKind::Range(ref l, ref r, ref range_end) => {
|
hir::PatKind::Range(ref l, ref r, ref range_end) => {
|
||||||
println!("{}Range", ind);
|
println!("{}Range", ind);
|
||||||
print_expr(cx, l, indent + 1);
|
if let Some(expr) = l {
|
||||||
print_expr(cx, r, indent + 1);
|
print_expr(cx, expr, indent + 1);
|
||||||
|
}
|
||||||
|
if let Some(expr) = r {
|
||||||
|
print_expr(cx, expr, indent + 1);
|
||||||
|
}
|
||||||
match *range_end {
|
match *range_end {
|
||||||
hir::RangeEnd::Included => println!("{} end included", ind),
|
hir::RangeEnd::Included => println!("{} end included", ind),
|
||||||
hir::RangeEnd::Excluded => println!("{} end excluded", ind),
|
hir::RangeEnd::Excluded => println!("{} end excluded", ind),
|
||||||
|
Loading…
Reference in New Issue
Block a user