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 d203b9c commit 18f65ddCopy full SHA for 18f65dd
src/librustc/mir/repr.rs
@@ -1062,6 +1062,23 @@ impl UnOp {
1062
}
1063
1064
1065
+impl<'tcx> Rvalue<'tcx> {
1066
+ pub fn is_pure(&self) -> bool {
1067
+ use self::Rvalue::*;
1068
+ match *self {
1069
+ // Arbitrary side effects
1070
+ InlineAsm { .. } |
1071
+ // Side effect: allocation
1072
+ Box(_) |
1073
+ // Side effect: assertion
1074
+ CheckedBinaryOp(..) => false,
1075
+ // No side effects
1076
+ Use(_) | Repeat(..) | Len(_) | Cast(..) | BinaryOp(..) | UnaryOp(..) |
1077
+ Ref(..) | Aggregate(..) => true
1078
+ }
1079
1080
+}
1081
+
1082
impl<'tcx> Debug for Rvalue<'tcx> {
1083
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
1084
use self::Rvalue::*;
0 commit comments