Merge branch 'fix_read_to_end' into 'master'

Add back Drop impl for Guard to fix Read::read_to_end

See merge request redox-os/relibc!446
This commit is contained in:
Jeremy Soller
2024-01-08 05:00:02 +00:00
+6
View File
@@ -292,6 +292,12 @@ struct Guard<'a> {
len: usize,
}
impl<'a> Drop for Guard<'a> {
fn drop(&mut self) {
unsafe { self.buf.set_len(self.len); }
}
}
// A few methods below (read_to_string, read_line) will append data into a
// `String` buffer, but we need to be pretty careful when doing this. The
// implementation will just call `.as_mut_vec()` and then delegate to a