File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1184,9 +1184,34 @@ impl PlaceContext {
1184
1184
PlaceContext :: MutatingUse (
1185
1185
MutatingUseContext :: Store
1186
1186
| MutatingUseContext :: Call
1187
+ | MutatingUseContext :: Yield
1187
1188
| MutatingUseContext :: AsmOutput ,
1188
1189
) => true ,
1189
1190
_ => false ,
1190
1191
}
1191
1192
}
1193
+
1194
+ /// Returns `true` if this context could read the contents of the place.
1195
+ pub fn is_read ( & self ) -> bool {
1196
+ match * self {
1197
+ PlaceContext :: MutatingUse (
1198
+ MutatingUseContext :: Store | MutatingUseContext :: Call | MutatingUseContext :: Yield ,
1199
+ )
1200
+ | PlaceContext :: NonUse ( _) => false ,
1201
+
1202
+ PlaceContext :: MutatingUse ( _) | PlaceContext :: NonMutatingUse ( _) => true ,
1203
+ }
1204
+ }
1205
+
1206
+ /// Returns `true` if this context does not read from this place but does write to it.
1207
+ ///
1208
+ /// This is relevant for inline assembly, which has read/write parameters.
1209
+ pub fn is_write_only ( & self ) -> bool {
1210
+ matches ! (
1211
+ self ,
1212
+ PlaceContext :: MutatingUse (
1213
+ MutatingUseContext :: Store | MutatingUseContext :: Call | MutatingUseContext :: Yield
1214
+ )
1215
+ )
1216
+ }
1192
1217
}
You can’t perform that action at this time.
0 commit comments