These are chat archives for rust-lang/rust

19th
Oct 2018
trsh
@trsh
Oct 19 2018 08:18
I recently updated my Ubuntu to 18.x version. Since then Im getting errors when using Bindgen command line -> rust-lang-nursery/rust-bindgen#1426 . Maybe someone has exp to help me out on this?
trsh
@trsh
Oct 19 2018 10:16
Maybe its more an linux clang question, but anyway..
trsh
@trsh
Oct 19 2018 11:51
NM
Sylwester Rąpała
@xoac
Oct 19 2018 13:44
  #[derive(Clone)]
  pub enum Value {
      One(OpcValue),
      Tree([OpcValue; 3]),
  }

  impl Value {
      fn into_json_value(self, dq: OpcQuality) -> serde_json::Value {
          match self {
              Value::One(v) => v.into_json_value(dq),
>>            Value::Tree([v1, v2, v3]) => {
                  vec![
                      v1.into_json_value(dq),
                      v2.into_json_value(dq),
                      v3.into_json_value(dq),
                  ].into()
              }
          }
      }
  }

error (in line >>):

error[E0382]: use of moved value: `(self as v0::Value::Tree).0[..]`
  --> src/v0/mod.rs:73:30
   |
73 |             Value::Tree([v1, v2, v3]) => {
   |                          --  ^^ value used here after move
   |                          |
   |                          value moved here
   |
   = note: move occurs because the value has type `v1::value::OpcValue`, which does not implement the `Copy` trait

Why this error occurs? Because I take first one element from array and then second (array is already moved?)

Denis Lisov
@tanriol
Oct 19 2018 13:56
A known bug with slice patterns (rust-lang/rust#26736), will be fixed with NLL in 2018 edition
Andrew Pennebaker
@mcandre
Oct 19 2018 14:56
Is rustc aware of cargo projects? I am interested in porting mage to Rust, and wondering if it’s easier to use cargo or rustc to build project-adjacent .RS scripts into .RLIB’s and run CLI task functions from them. I figure I could hack an example together with some Cargo.toml tweaking, but I prefer to do all the work as command line flags to rustc / cargo if possible.
Denis Lisov
@tanriol
Oct 19 2018 15:00
What "mage" do you refer to here? This name is not exactly searchable :-(
rustc does not know about cargo projects
Andrew Pennebaker
@mcandre
Oct 19 2018 15:04
mage, as in the awesome Go build tool that defines dependent tasks as Go functions! No more Linux/Windows breakages in ur build system due to shelling out
Denis Lisov
@tanriol
Oct 19 2018 15:12
I'd probably suggest adding a Cargo subcommand for running them like cargo trigger my-action-name or something like that...
Sylwester Rąpała
@xoac
Oct 19 2018 18:47
I would like to create a Stream that create in for_each new stream and close (send None) old stream (created in previous for_each call).
Vitaly
@Virtuos86
Oct 19 2018 19:06
Sounds good. Do it.
Sylwester Rąpała
@xoac
Oct 19 2018 21:14
Looks like shouldn't ask question when I am tired. It wasn't even question
Sebastian
@sertel
Oct 19 2018 21:27
Hi! I’m reading this doc on try! and ?: https://doc.rust-lang.org/std/macro.try.html
How does the Rust compiler convert exp?; into a try!(exp);?
Denis Lisov
@tanriol
Oct 19 2018 21:58
IIRC, it does not, they both expand to something.