proc_macro/bridge: Remove dead code Slice type
See https://github.com/rust-lang/rust/pull/85390#discussion_r662464868
This commit is contained in:
parent
64de4979e8
commit
0b3fedc8df
@ -5,35 +5,6 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
struct Slice<'a, T> {
|
|
||||||
data: &'a [T; 0],
|
|
||||||
len: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl<'a, T: Sync> Sync for Slice<'a, T> {}
|
|
||||||
unsafe impl<'a, T: Sync> Send for Slice<'a, T> {}
|
|
||||||
|
|
||||||
impl<T> Copy for Slice<'a, T> {}
|
|
||||||
impl<T> Clone for Slice<'a, T> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
*self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> From<&'a [T]> for Slice<'a, T> {
|
|
||||||
fn from(xs: &'a [T]) -> Self {
|
|
||||||
Slice { data: unsafe { &*(xs.as_ptr() as *const [T; 0]) }, len: xs.len() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Deref for Slice<'a, T> {
|
|
||||||
type Target = [T];
|
|
||||||
fn deref(&self) -> &[T] {
|
|
||||||
unsafe { slice::from_raw_parts(self.data.as_ptr(), self.len) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Buffer<T: Copy> {
|
pub struct Buffer<T: Copy> {
|
||||||
data: *mut T,
|
data: *mut T,
|
||||||
|
Loading…
Reference in New Issue
Block a user