Skip to content

Commit fa3a4ae

Browse files
committed
Implement AsRef<[T]> for List<T>
1 parent e413dc3 commit fa3a4ae

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc/ty/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,13 @@ impl<T> Deref for List<T> {
700700
type Target = [T];
701701
#[inline(always)]
702702
fn deref(&self) -> &[T] {
703+
self.as_ref()
704+
}
705+
}
706+
707+
impl<T> AsRef<[T]> for List<T> {
708+
#[inline(always)]
709+
fn as_ref(&self) -> &[T] {
703710
unsafe {
704711
slice::from_raw_parts(self.data.as_ptr(), self.len)
705712
}

0 commit comments

Comments
 (0)