We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3e09cc commit b46ac03Copy full SHA for b46ac03
src/librustc_mir/transform/const_prop.rs
@@ -286,7 +286,12 @@ impl CanConstProp {
286
found_assignment: IndexVec::from_elem(false, &mir.local_decls),
287
};
288
for (local, val) in cpv.can_const_prop.iter_enumerated_mut() {
289
- *val = mir.local_kind(local) != LocalKind::Arg;
+ // cannot use args at all
290
+ // cannot use locals because if x < y { y - x } else { x - y } would
291
+ // lint for x != y
292
+ // FIXME(oli-obk): lint variables until they are used in a condition
293
+ // FIXME(oli-obk): lint if return value is constant
294
+ *val = mir.local_kind(local) == LocalKind::Temp;
295
}
296
cpv.visit_mir(mir);
297
cpv.can_const_prop
0 commit comments