@@ -37,28 +37,23 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
37
37
p
38
38
}
39
39
40
- #[lang = "exchange_free"]
41
- unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) {
42
- libc::free(ptr as *mut libc::c_void)
43
- }
44
-
45
40
#[lang = "box_free"]
46
41
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
47
- deallocate (ptr as *mut u8, ::core::mem::size_of_val(&*ptr), ::core::mem::align_of_val(&*ptr));
42
+ libc::free (ptr as *mut libc::c_void)
48
43
}
49
44
50
45
#[start]
51
- fn main(argc : isize, argv : *const *const u8) -> isize {
52
- let x = box 1;
46
+ fn main(_argc : isize, _argv : *const *const u8) -> isize {
47
+ let _x = box 1;
53
48
54
49
0
55
50
}
56
51
57
52
#[lang = "eh_personality"] extern fn rust_eh_personality() {}
58
53
#[lang = "panic_fmt"] extern fn rust_begin_panic() -> ! { unsafe { intrinsics::abort() } }
59
- # # [lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
60
- # # [no_mangle] pub extern fn rust_eh_register_frames () {}
61
- # # [no_mangle] pub extern fn rust_eh_unregister_frames () {}
54
+ #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
55
+ #[no_mangle] pub extern fn rust_eh_register_frames () {}
56
+ #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
62
57
```
63
58
64
59
Note the use of ` abort ` : the ` exchange_malloc ` lang item is assumed to
@@ -80,7 +75,7 @@ Other features provided by lang items include:
80
75
81
76
Lang items are loaded lazily by the compiler; e.g. if one never uses
82
77
` Box ` then there is no need to define functions for ` exchange_malloc `
83
- and ` exchange_free ` . ` rustc ` will emit an error when an item is needed
78
+ and ` box_free ` . ` rustc ` will emit an error when an item is needed
84
79
but not found in the current crate or any that it depends on.
85
80
86
81
Most lang items are defined by ` libcore ` , but if you're trying to build
@@ -318,4 +313,4 @@ the source code.
318
313
- ` phantom_data ` : ` libcore/marker.rs `
319
314
- ` freeze ` : ` libcore/marker.rs `
320
315
- ` debug_trait ` : ` libcore/fmt/mod.rs `
321
- - ` non_zero ` : ` libcore/nonzero.rs `
316
+ - ` non_zero ` : ` libcore/nonzero.rs `
0 commit comments