mirror of
https://github.com/rust-lang/rust
synced 2024-10-04 15:50:51 +00:00
inner truncate methods for UEFI platforms
This commit is contained in:
parent
2155c6c477
commit
b08cd69684
|
@ -557,6 +557,11 @@ pub fn leak<'a>(self) -> &'a mut OsStr {
|
||||||
pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
|
pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
|
||||||
self.inner.as_mut_vec_for_path_buf()
|
self.inner.as_mut_vec_for_path_buf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub(crate) fn truncate(&mut self, len: usize) {
|
||||||
|
self.inner.truncate(len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ fn _push(&mut self, path: &Path) {
|
||||||
|
|
||||||
// absolute `path` replaces `self`
|
// absolute `path` replaces `self`
|
||||||
if path.is_absolute() || path.prefix().is_some() {
|
if path.is_absolute() || path.prefix().is_some() {
|
||||||
self.as_mut_vec().truncate(0);
|
self.inner.truncate(0);
|
||||||
|
|
||||||
// verbatim paths need . and .. removed
|
// verbatim paths need . and .. removed
|
||||||
} else if comps.prefix_verbatim() && !path.inner.is_empty() {
|
} else if comps.prefix_verbatim() && !path.inner.is_empty() {
|
||||||
|
@ -1350,7 +1350,7 @@ fn _push(&mut self, path: &Path) {
|
||||||
// `path` has a root but no prefix, e.g., `\windows` (Windows only)
|
// `path` has a root but no prefix, e.g., `\windows` (Windows only)
|
||||||
} else if path.has_root() {
|
} else if path.has_root() {
|
||||||
let prefix_len = self.components().prefix_remaining();
|
let prefix_len = self.components().prefix_remaining();
|
||||||
self.as_mut_vec().truncate(prefix_len);
|
self.inner.truncate(prefix_len);
|
||||||
|
|
||||||
// `path` is a pure relative path
|
// `path` is a pure relative path
|
||||||
} else if need_sep {
|
} else if need_sep {
|
||||||
|
@ -1383,7 +1383,7 @@ fn _push(&mut self, path: &Path) {
|
||||||
pub fn pop(&mut self) -> bool {
|
pub fn pop(&mut self) -> bool {
|
||||||
match self.parent().map(|p| p.as_u8_slice().len()) {
|
match self.parent().map(|p| p.as_u8_slice().len()) {
|
||||||
Some(len) => {
|
Some(len) => {
|
||||||
self.as_mut_vec().truncate(len);
|
self.inner.truncate(len);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
None => false,
|
None => false,
|
||||||
|
|
|
@ -207,6 +207,11 @@ pub fn into_rc(&self) -> Rc<Slice> {
|
||||||
pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
|
pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
|
||||||
&mut self.inner
|
&mut self.inner
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub(crate) fn truncate(&mut self, len: usize) {
|
||||||
|
self.inner.truncate(len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Slice {
|
impl Slice {
|
||||||
|
|
Loading…
Reference in a new issue