These are chat archives for rust-lang/rust

5th
Feb 2017
Sasha Hilton
@sashahilton00
Feb 05 2017 02:58
anyone up atm?
Alexander Ronald Altman
@pthariensflame
Feb 05 2017 04:51
I’m up, if you need something.
Tomer Margalit
@matomer
Feb 05 2017 14:10
Hi, I'm trying to figure out an error https://doc.rust-lang.org/error-index.html#E0207
got it for
```

trait AA {

    fn aa(&self);
}
trait AB<T> {
    fn ab(&self);
}
trait AC {
    fn ac(&self);
}

impl <T : AA, TT : AB<T> > AC for TT {
    fn ac(&self) {}
}
for T
and can't figure out why I get it
Denis Lisov
@tanriol
Feb 05 2017 14:26
Probably because you don't know enough about T
Tomer Margalit
@matomer
Feb 05 2017 14:26
is there a rule here?
can I assume that type parameters from the impl can't be used inside bounds of other type parameters
?
Tomer Margalit
@matomer
Feb 05 2017 14:32
was able to trick it with this:

impl <T : AA, TT : AB<T> > AC<T> for TT {
    fn ac(&self) {}
}
and added a type parameter to AC
Denis Lisov
@tanriol
Feb 05 2017 14:40
IIUC, the exact implementation to be used must be known from (a) the trait and its parameters and (b) the Self type and its parameters.
So all type parameters have to be mentioned there.
Tomer Margalit
@matomer
Feb 05 2017 14:44
I think you can go around that by adding a type parameter to the interface you're implementing
Denis Lisov
@tanriol
Feb 05 2017 14:44
Exactly, that's one of the options :-)
Sasha Hilton
@sashahilton00
Feb 05 2017 16:40
Could someone provide some insight as to how one might go about improving this pseudo-code:
    let mut welcome = String::new();

    welcome.push_str("This string displays variables ");
    welcome.push_str(lib::variable_1());
    welcome.push_str(" and ");
    welcome.push_str(lib::variable_2());

    self.send(welcome)
I can't believe that this is how one forms a String from str and functions that return str's? Is there nothing like String::from("This string displays variables ", lib::variable_1(), etc.) or some such similar line that doesn't involve pushing each fragment to a String in a separate line?
Jarred Nicholls
@jnicholls
Feb 05 2017 16:49
@sashahilton00 format! Macro is what you are looking for
See std::fmt for more info on the syntax
Sasha Hilton
@sashahilton00
Feb 05 2017 16:53
fantastic. Thanks for pointing me to what Google could not :)
Michal 'vorner' Vaner
@vorner
Feb 05 2017 18:17
Hello. If the nightly compiler crashed on me, where do I report it? https://travis-ci.org/vorner/tokio-jsonrpc/jobs/198610271
Ups, sorry, it even told me O:-)
Jeroen Bollen
@Binero
Feb 05 2017 18:18
@vorner You beat me by a second. :)
vorner @vorner should read, not panic