From 4aec3b3d7888373f36b86a2dce3dea15e00c9f17 Mon Sep 17 00:00:00 2001 From: Alice Maz Date: Wed, 23 Dec 2015 01:35:53 -0500 Subject: [PATCH] Add unsafe to Unique::new previously compile would fail with E0133 --- posts/2015-10-23-printing-to-screen.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posts/2015-10-23-printing-to-screen.md b/posts/2015-10-23-printing-to-screen.md index 78f3bba4..b3884623 100644 --- a/posts/2015-10-23-printing-to-screen.md +++ b/posts/2015-10-23-printing-to-screen.md @@ -185,7 +185,7 @@ pub fn print_something() { let mut writer = Writer { column_position: 0, color_code: ColorCode::new(Color::LightGreen, Color::Black), - buffer: Unique::new(0xb8000 as *mut _), + buffer: unsafe { Unique::new(0xb8000 as *mut _) }, } writer.write_byte(b'H'); @@ -285,7 +285,7 @@ To provide a global writer that can used as an interface from other modules, we pub static WRITER: Writer = Writer { column_position: 0, color_code: ColorCode::new(Color::LightGreen, Color::Black), - buffer: Unique::new(0xb8000 as *mut _), + buffer: unsafe { Unique::new(0xb8000 as *mut _) }, }; ```