These are chat archives for rust-lang/rust

May 2018
Hans W. Uhlig
May 18 2018 00:14
@brandonros looks like the only way is still
Brandon Ros
May 18 2018 03:25
would ODBC be performant?
May 18 2018 06:46
Hi guys! Is there some way do debug a macro?
For Extern crate?
May 18 2018 06:51
"note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)" > could not find any usable info how to do this
Michal 'vorner' Vaner
May 18 2018 06:56
cargo-expand could maybe help
May 18 2018 06:56
When I try it says > error: unknown -Z flag specified: external-macro-backtrace
Michal 'vorner' Vaner
May 18 2018 06:56
depends on how serious the error is
May 18 2018 06:56
It's ajoke?
One error message suggests and flag, another says one is not real
Michal 'vorner' Vaner
May 18 2018 06:57
The -Z one is only on nightly
May 18 2018 06:57
@vorner I looked into cargo-expand, and don't understand how to use it
cargo +nightly run -Z external-macro-backtrace
error: unknown `-Z` flag specified: external-macro-backtrace
this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Michal 'vorner' Vaner
May 18 2018 06:58
You install it, then say cargo expand and it produces source code after all the macros expanded
May 18 2018 06:59
Rust devs ar making April fools?
@vorner where it's produced?
cargo expand
error: extra arguments to `rustc` can only be passed to one target, consider filtering
the package by passing e.g. `--lib` or `--bin NAME` to specify a single target
cat: /tmp/cargo-expand1cPzfc/expanded: No such file or directory
May 18 2018 07:08
@trsh I don't use cargo expand but that error has been reportend on their github issue tracker:
(not sure if related to your case)
May 18 2018 07:09
cargo expand --lib manu
   Compiling manu v0.1.0 (file:///home/trsh/manu/backEnd2/manu)
error: the option `Z` is only accepted on the nightly compiler
So nightly again
A now one of libs dies with nightly rust
Dead end
May 18 2018 07:15
Put an answer for that issue 24
May 18 2018 09:12
Denis Lisov
May 18 2018 09:30
@trsh external-macro-backtrace is a rustc option, while you're trying to use it directly with cargo. It should be used as
cargo +nightly rustc -- -Z external-macro-backtrace
May 18 2018 09:41
@tanriol ok. Tnx
@girng hello godot face
Denis Lisov
May 18 2018 09:51
@trsh Submitted an issue rust-lang/cargo#5546 to suggest a working syntax for rustc unstable options
May 18 2018 10:09
@berkus how to make simpler?
May 18 2018 12:54
Hi, I want to split a BytesMut from bytes crate at the position of last b"\r\n". Does anyone know how can I do this efficiently
@tanriol thanks
May 18 2018 13:51
Hey guys, I think that's also a general potential rust question.
I'm having an issue with moving out of borrowed content
Which is in itself already a problem but I can't think of a solution right now
 --> src/
72 |           
   |                     ^^^^ borrowed value does not live long enough
73 |                 })
   |                 - `lock` dropped here while still borrowed
   = note: values in a scope are dropped in the opposite order they are created

error[E0507]: cannot move out of borrowed content
  --> src/
72 |           
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content

error: aborting due to 2 previous errors

Current server future is

    let server = listener
        .map(move |socket| {
            let lock = shared_channels.clone();
            println!("accepted socket; addr={:?}", socket.peer_addr().unwrap());

            io::read_exact(socket, [0_u8; 10])
                .map(|(_, buf)| buf)
                .map(|buf| {
                    let rec_str = str::from_utf8(&buf).unwrap();
                    println!("Received: {:?}", &rec_str);
                .map( move |data| {

        .for_each(|_| Ok(()))
        .map_err(|err| {
            println!("accept error = {:?}", err);

This will be spawned as a 'server' on a threadpool with several 'clients'. lock is Arc<RwLock<HashMap<i32, mpsc::Sender<String>>>>, my senders to the receivers therefore.

Maciej Gorywoda
May 18 2018 13:59
@apiraino I moved to Berlin from Warsaw a year ago and I'm also trying to learn German. English and French are sooo much easier :)
May 18 2018 14:00
I think I understand why that could be a problem but thought I had properly dealt with it.
lock is cloned, e.g. the ref counter is increased and I create a 'thread-local' reference to it with lock and should not be borrowed. This is passed via moveinto the most inner map. But here the compiler complains that I move lock out there again...?
Andreas Rottmann
May 18 2018 14:23
I have a question about reference mutability in a C API wrapper: erickt/rust-zmq#216. Anyone care to give a second opinion?
Andy Bell
May 18 2018 15:40

having an issue with Hyper requests from a client. Code:

let uri = "".parse().unwrap();
let mut req = Request::new(Method::Post, uri);
req.headers_mut().set(ContentLength(json.len() as u64));

let work = client.request(req).and_then(|res{
    //do things with response

error I get is:

^^^^^^^^ the trait `std::ops::FnOnce<(hyper::Response,)>` is not implemented for `()`
this code seems to be the same as in the “advanced client” example for hyper (
Berkus Decker
May 18 2018 17:48
@tanriol hmm.. yeah, only i can't figure how owning_ref would work here; any hint/tutorial?
@trsh just switch to a slightly older nightly version
Berkus Decker
May 18 2018 17:53
@tandrysyawaludin something like use supplier_module; ... .mount("/suppliers", routes![supplier_module::read_all_suppliers]...
David James
May 18 2018 22:44
BTW, is broken (at least for me)
Hmm, when I go back and follow the front-page link, I see that works (with the final "l")