File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1140,7 +1140,8 @@ fn detect_same_item_push<'tcx>(
1140
1140
walk_expr ( & mut same_item_push_visitor, body) ;
1141
1141
if same_item_push_visitor. should_lint {
1142
1142
if let Some ( ( vec, pushed_item) ) = same_item_push_visitor. vec_push {
1143
- let ty = cx. typeck_results ( ) . expr_ty ( pushed_item) ;
1143
+ let vec_ty = cx. typeck_results ( ) . expr_ty ( vec) ;
1144
+ let ty = vec_ty. walk ( ) . nth ( 1 ) . unwrap ( ) . expect_ty ( ) ;
1144
1145
if cx
1145
1146
. tcx
1146
1147
. lang_items ( )
Original file line number Diff line number Diff line change @@ -100,4 +100,15 @@ fn main() {
100
100
for _ in 0 ..10 {
101
101
vec14. push ( std:: fs:: File :: open ( "foobar" ) . unwrap ( ) ) ;
102
102
}
103
+ // Fix #5979
104
+ #[ derive( Clone ) ]
105
+ struct S { }
106
+
107
+ trait T { }
108
+ impl T for S { }
109
+
110
+ let mut vec15: Vec < Box < dyn T > > = Vec :: new ( ) ;
111
+ for _ in 0 ..10 {
112
+ vec15. push ( Box :: new ( S { } ) ) ;
113
+ }
103
114
}
You can’t perform that action at this time.
0 commit comments