File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,9 @@ impl<'tcx> MirLint<'tcx> for ConstProp {
49
49
}
50
50
51
51
let def_id = body. source . def_id ( ) . expect_local ( ) ;
52
- let is_fn_like = tcx. def_kind ( def_id) . is_fn_like ( ) ;
53
- let is_assoc_const = tcx. def_kind ( def_id) == DefKind :: AssocConst ;
52
+ let def_kind = tcx. def_kind ( def_id) ;
53
+ let is_fn_like = def_kind. is_fn_like ( ) ;
54
+ let is_assoc_const = def_kind == DefKind :: AssocConst ;
54
55
55
56
// Only run const prop on functions, methods, closures and associated constants
56
57
if !is_fn_like && !is_assoc_const {
@@ -59,10 +60,9 @@ impl<'tcx> MirLint<'tcx> for ConstProp {
59
60
return ;
60
61
}
61
62
62
- let is_generator = tcx. type_of ( def_id. to_def_id ( ) ) . instantiate_identity ( ) . is_generator ( ) ;
63
63
// FIXME(welseywiser) const prop doesn't work on generators because of query cycles
64
64
// computing their layout.
65
- if is_generator {
65
+ if let DefKind :: Generator = def_kind {
66
66
trace ! ( "ConstProp skipped for generator {:?}" , def_id) ;
67
67
return ;
68
68
}
You can’t perform that action at this time.
0 commit comments