Skip to content

Commit 9f5d31e

Browse files
committed
clear DefId when an expression's type changes to non-adt
1 parent 124e68b commit 9f5d31e

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎clippy_utils/src/ty/type_certainty/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty {
9090
ifletSome(def_id) = adt_def_id(expr_ty){
9191
certainty.with_def_id(def_id)
9292
}else{
93-
certainty
93+
certainty.clear_def_id()
9494
}
9595
}
9696

‎tests/ui/crashes/ice-12585.rs‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![allow(clippy::unit_arg)]
2+
3+
structOne{
4+
x:i32,
5+
}
6+
structTwo{
7+
x:i32,
8+
}
9+
10+
structProduct{}
11+
12+
implProduct{
13+
pubfna_method(self, _:()){}
14+
}
15+
16+
fnfrom_array(_:[i32;2]) -> Product{
17+
todo!()
18+
}
19+
20+
pubfnmain(){
21+
let one = One{x:1};
22+
let two = Two{x:2};
23+
24+
let product = from_array([one.x, two.x]);
25+
product.a_method(<()>::default());
26+
}

0 commit comments

Comments
 (0)