Hacker News
points by heavensteeth 3 days ago | 0 comments
This compiles:

   type NonZero = usize where self != 0;

   fn main() -> NonZero {
       let my_nonzero = NonZero(1);

       my_nonzero - 1
   }
Which doesn't feel right.

I also get a weird error message pointing into the stdlib trying to do this:

   fn main() {
       let s = std::string::String::new();
       let b = s.bytes;
       s.len();
   }
I assume because b takes ownership of s.bytes? Doing &s.bytes fixes it.
Aún no hay comentarios.
Hacker News