rust/tests/ui/suggestions/issue-68049-1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
336 B
Rust
Raw Normal View History

2021-05-09 00:56:59 +00:00
use std::alloc::{GlobalAlloc, Layout};
struct Test(u32);
unsafe impl GlobalAlloc for Test {
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
2021-05-11 04:20:43 +00:00
self.0 += 1; //~ ERROR cannot assign
2021-05-09 00:56:59 +00:00
0 as *mut u8
}
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
unimplemented!();
}
}
fn main() { }