Add test case for same_item_push

This commit is contained in:
Takayuki Nakata 2020-07-19 23:43:35 +09:00
parent 1e8ada3cab
commit 161f475100
2 changed files with 13 additions and 0 deletions

View File

@ -1114,6 +1114,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ForPatternVisitor<'a, 'tcx> {
| ExprKind::Cast(expr, _)
| ExprKind::Type(expr, _)
| ExprKind::AddrOf(_, _, expr)
| ExprKind::Field(expr, _)
| ExprKind::Struct(_, _, Some(expr)) => self.visit_expr(expr),
_ => {
// Exploration cannot continue ... calculate the hir_id of the current

View File

@ -74,4 +74,16 @@ fn main() {
for _ in 0..5 {
println!("Same Item Push");
}
struct A {
kind: u32,
}
let mut vec_a: Vec<A> = Vec::new();
for i in 0..30 {
vec_a.push(A{kind: i});
}
let mut vec12: Vec<u8> = Vec::new();
for a in vec_a {
vec12.push(2u8.pow(a.kind));
}
}