sos-os / kernel

The Stupid Operating System
Apache License 2.0
264 stars 17 forks source link

Error compiling when re-referencing ptr::Unique to ptr::NonNull #118

Open SnailShea opened 6 years ago

SnailShea commented 6 years ago
┌─╼[~/Projects/sos-kernel] [master*]
└────╼ make kernel
   Compiling vga v0.1.0 (file:///Users/shea/Projects/sos-kernel/vga)
error[E0277]: the trait bound `core::ptr::NonNull<[[Char; 80]; 25]>: core::marker::Send` is not satisfied in `Terminal`
  --> vga/src/lib.rs:91:1
   |
91 | / pub static CONSOLE: Mutex<Terminal>
92 | |     = Mutex::new(unsafe { Terminal::new(
93 | |          Palette::new(Color::LightGrey, Color::Black )
94 | |        , 0xB8000
95 | |     )});
   | |________^ `core::ptr::NonNull<[[Char; 80]; 25]>` cannot be sent between threads safely
   |
   = help: within `Terminal`, the trait `core::marker::Send` is not implemented for `core::ptr::NonNull<[[Char; 80]; 25]>`
   = note: required because it appears within the type `Terminal`
   = note: required because of the requirements on the impl of `core::marker::Sync` for `spin::Mutex<Terminal>`
   = note: shared static variables must have a type that implements `Sync`

error: aborting due to previous error

error: Could not compile `vga`.

To learn more, run the command again with --verbose.
make: *** [target/x86_64-sos-kernel-gnu/debug/sos_kernel] Error 101
hawkw commented 6 years ago

yeah, this is because Unique makes Send + Sync guarantees that NotNull doesn't, I forgot about this when I opened the issue to rename them. I need to add markers there.