Skip to content

Commit 10a71fc

Browse files
authored
fix: Miri error on invalidated mut borrow (#443)
1 parent 685257a commit 10a71fc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/stage2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ impl<'de> Deserializer<'de> {
111111
stack.clear();
112112
stack.reserve(structural_indexes.len());
113113

114+
// Safety: Must NOT advance input pointer as part of logic, since we only get the pointer once.
115+
// Use idx in order to advance through the input.
116+
let input_ptr = input.as_mut_ptr();
114117
let res_ptr = res.as_mut_ptr();
115118
let stack_ptr = stack.as_mut_ptr();
116119

@@ -185,10 +188,7 @@ impl<'de> Deserializer<'de> {
185188
macro_rules! insert_str {
186189
() => {
187190
insert_res!(Node::String(s2try!(Self::parse_str_(
188-
input.as_mut_ptr(),
189-
&input2,
190-
buffer,
191-
idx
191+
input_ptr, &input2, buffer, idx
192192
))));
193193
};
194194
}

0 commit comments

Comments
 (0)