News for hackers. Stuff that matters.
Re:Windows has a new wormable vulnerability, with no patch by lonelappde on Friday March 13, 2020 @09:18AM (#22567009)
How do you copy data from one array of structs to another in rust?

Also, if foo is a non-shared pointer that copy doesn't seem safe.

Re:Windows has a new wormable vulnerability, with no patch by steveklabnik on Friday March 13, 2020 @10:26AM (#22567475)
> How do you copy data from one array of structs to another in rust?

Depends on exactly what you mean; if you're trying to say, replace one part of an array with another, you would use copy_from_slice https://play.rust-lang.org/?version=stable&mode=debug&editio... (or clone_from_slice if your struct isn't Copy)

Also, your parent is just plain incorrect, Rust does let you do that https://play.rust-lang.org/?version=stable&mode=debug&editio...

Re:Windows has a new wormable vulnerability, with no patch by IshKebab on Sunday March 15, 2020 @05:25PM (#22586898)
Sorry, you are correct. I was thinking of situations like this:

  fn assign(a: &mut Bar, b: &Bar) {
    a.foo = b.foo;
  }
    
    assign(&mut a[0], &a[1]);
Bit contrived - next time Rust stops me doing something simple I will note it down!

Again to be clear, I'm not saying that there's anything wrong with Rust here.

Re:Windows has a new wormable vulnerability, with no patch by steveklabnik on Monday March 16, 2020 @09:30AM (#22592469)
Ah yeah, you can split_at_mut here, but you're right that that's an actual error. My bad!