rename BorrowKind::Shallow
to Fake
· rust-lang/rust@992d93f (original) (raw)
`@@ -846,7 +846,7 @@ use self::ReadOrWrite::{Activation, Read, Reservation, Write};
`
846
846
`#[derive(Copy, Clone, PartialEq, Eq, Debug)]
`
847
847
`enum ArtificialField {
`
848
848
`ArrayLength,
`
849
``
`-
ShallowBorrow,
`
``
849
`+
FakeBorrow,
`
850
850
`}
`
851
851
``
852
852
`#[derive(Copy, Clone, PartialEq, Eq, Debug)]
`
`@@ -1085,18 +1085,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
1085
1085
`Control::Continue
`
1086
1086
`}
`
1087
1087
``
1088
``
`-
(Read(_), BorrowKind::Shared | BorrowKind::Shallow)
`
1089
``
`-
| (Read(ReadKind::Borrow(BorrowKind::Shallow)), BorrowKind::Mut { .. }) => {
`
``
1088
`+
(Read(_), BorrowKind::Shared | BorrowKind::Fake)
`
``
1089
`+
| (Read(ReadKind::Borrow(BorrowKind::Fake)), BorrowKind::Mut { .. }) => {
`
1090
1090
`Control::Continue
`
1091
1091
`}
`
1092
1092
``
1093
``
`-
(Reservation(_), BorrowKind::Shallow | BorrowKind::Shared) => {
`
``
1093
`+
(Reservation(_), BorrowKind::Fake | BorrowKind::Shared) => {
`
1094
1094
`// This used to be a future compatibility warning (to be
`
1095
1095
`// disallowed on NLL). See rust-lang/rust#56254
`
1096
1096
`Control::Continue
`
1097
1097
`}
`
1098
1098
``
1099
``
`-
(Write(WriteKind::Move), BorrowKind::Shallow) => {
`
``
1099
`+
(Write(WriteKind::Move), BorrowKind::Fake) => {
`
1100
1100
`// Handled by initialization checks.
`
1101
1101
`Control::Continue
`
1102
1102
`}
`
`@@ -1204,8 +1204,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
1204
1204
`match rvalue {
`
1205
1205
`&Rvalue::Ref(_ /rgn/, bk, place) => {
`
1206
1206
`let access_kind = match bk {
`
1207
``
`-
BorrowKind::Shallow => {
`
1208
``
`-
(Shallow(Some(ArtificialField::ShallowBorrow)), Read(ReadKind::Borrow(bk)))
`
``
1207
`+
BorrowKind::Fake => {
`
``
1208
`+
(Shallow(Some(ArtificialField::FakeBorrow)), Read(ReadKind::Borrow(bk)))
`
1209
1209
`}
`
1210
1210
`BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))),
`
1211
1211
`BorrowKind::Mut { .. } => {
`
`@@ -1226,7 +1226,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
1226
1226
` flow_state,
`
1227
1227
`);
`
1228
1228
``
1229
``
`-
let action = if bk == BorrowKind::Shallow {
`
``
1229
`+
let action = if bk == BorrowKind::Fake {
`
1230
1230
`InitializationRequiringAction::MatchOn
`
1231
1231
`} else {
`
1232
1232
`InitializationRequiringAction::Borrow
`
`@@ -1583,7 +1583,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
1583
1583
``
1584
1584
`// only mutable borrows should be 2-phase
`
1585
1585
`assert!(match borrow.kind {
`
1586
``
`-
BorrowKind::Shared | BorrowKind::Shallow => false,
`
``
1586
`+
BorrowKind::Shared | BorrowKind::Fake => false,
`
1587
1587
`BorrowKind::Mut { .. } => true,
`
1588
1588
`});
`
1589
1589
``
`@@ -2142,14 +2142,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
2142
2142
` | WriteKind::Replace
`
2143
2143
` | WriteKind::StorageDeadOrDrop
`
2144
2144
` | WriteKind::MutableBorrow(BorrowKind::Shared)
`
2145
``
`-
| WriteKind::MutableBorrow(BorrowKind::Shallow),
`
``
2145
`+
| WriteKind::MutableBorrow(BorrowKind::Fake),
`
2146
2146
`)
`
2147
2147
` | Write(
`
2148
2148
`WriteKind::Move
`
2149
2149
` | WriteKind::Replace
`
2150
2150
` | WriteKind::StorageDeadOrDrop
`
2151
2151
` | WriteKind::MutableBorrow(BorrowKind::Shared)
`
2152
``
`-
| WriteKind::MutableBorrow(BorrowKind::Shallow),
`
``
2152
`+
| WriteKind::MutableBorrow(BorrowKind::Fake),
`
2153
2153
`) => {
`
2154
2154
`if self.is_mutable(place.as_ref(), is_local_mutation_allowed).is_err()
`
2155
2155
` && !self.has_buffered_errors()
`
`@@ -2173,7 +2173,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
2173
2173
`return false;
`
2174
2174
`}
`
2175
2175
`Read(
`
2176
``
`-
ReadKind::Borrow(BorrowKind::Mut { .. } | BorrowKind::Shared | BorrowKind::Shallow)
`
``
2176
`+
ReadKind::Borrow(BorrowKind::Mut { .. } | BorrowKind::Shared | BorrowKind::Fake)
`
2177
2177
` | ReadKind::Copy,
`
2178
2178
`) => {
`
2179
2179
`// Access authorized
`