diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2022-03-26 18:29:37 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2022-03-26 18:29:37 +0100 |
| commit | bbff48e09463618dde1627883a350b7427ae6d44 (patch) | |
| tree | 84d7f352faf7b9dc8f37d379b9f79311160bf7fe /compiler/rustc_codegen_gcc/example | |
| parent | 1fca19c8ca4ae5e71e8b17a82c3acfeb78c48891 (diff) | |
| parent | 39683d8eb7a32a74bea96ecbf1e87675d3338506 (diff) | |
| download | rust-bbff48e09463618dde1627883a350b7427ae6d44.tar.gz rust-bbff48e09463618dde1627883a350b7427ae6d44.zip | |
Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_gcc-2022-03-26
Diffstat (limited to 'compiler/rustc_codegen_gcc/example')
| -rw-r--r-- | compiler/rustc_codegen_gcc/example/mini_core.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index 1067cee8814..a8435287d9f 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs @@ -14,6 +14,9 @@ unsafe extern "C" fn _Unwind_Resume() { #[lang = "sized"] pub trait Sized {} +#[lang = "destruct"] +pub trait Destruct {} + #[lang = "unsize"] pub trait Unsize<T: ?Sized> {} @@ -59,6 +62,7 @@ unsafe impl Copy for i16 {} unsafe impl Copy for i32 {} unsafe impl Copy for isize {} unsafe impl Copy for f32 {} +unsafe impl Copy for f64 {} unsafe impl Copy for char {} unsafe impl<'a, T: ?Sized> Copy for &'a T {} unsafe impl<T: ?Sized> Copy for *const T {} @@ -443,12 +447,22 @@ pub trait Deref { fn deref(&self) -> &Self::Target; } +pub trait Allocator { +} + +pub struct Global; + +impl Allocator for Global {} + #[lang = "owned_box"] -pub struct Box<T: ?Sized>(*mut T); +pub struct Box< + T: ?Sized, + A: Allocator = Global, +>(*mut T, A); impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {} -impl<T: ?Sized> Drop for Box<T> { +impl<T: ?Sized, A: Allocator> Drop for Box<T, A> { fn drop(&mut self) { // drop is currently performed by compiler. } @@ -468,7 +482,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { } #[lang = "box_free"] -unsafe fn box_free<T: ?Sized>(ptr: *mut T) { +unsafe fn box_free<T: ?Sized, A: Allocator>(ptr: *mut T, alloc: A) { libc::free(ptr as *mut u8); } |
