Skip to content

Commit e355415

Browse files
committed
Auto merge of rust-lang#97553 - nbdd0121:lib, r=Mark-Simulacrum
Add `#[inline]` to `Vec`'s `Deref/DerefMut` This should help rust-lang#97552 (although I haven't verified).
2 parents 4630aab + dbfc34c commit e355415

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

alloc/src/vec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2495,13 +2495,15 @@ impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
24952495
impl<T, A: Allocator> ops::Deref for Vec<T, A> {
24962496
type Target = [T];
24972497

2498+
#[inline]
24982499
fn deref(&self) -> &[T] {
24992500
unsafe { slice::from_raw_parts(self.as_ptr(), self.len) }
25002501
}
25012502
}
25022503

25032504
#[stable(feature = "rust1", since = "1.0.0")]
25042505
impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
2506+
#[inline]
25052507
fn deref_mut(&mut self) -> &mut [T] {
25062508
unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) }
25072509
}

0 commit comments

Comments
 (0)