These are chat archives for rust-lang/rust

Jul 2018
Jul 17 2018 03:28
Hey, does anyone know how I can get rls work with emacs lsp-mode
is there any elisp snippet I can take advantage of
I've tried to look for things in the github repo for lsp-mode and lsp-rust and I only found some fragmented stuffs
Judson Lester
Jul 17 2018 15:52
Judson Lester
Jul 17 2018 16:00
(a struct field is Shared<Box<Future>>)
Judson Lester
Jul 17 2018 16:48
Especially confusing is that the expected type is futures::future::Shared<std::boxed::Box<futures::Future<Error=futures::future::SharedError<failure::Compat<failure::Error>>, Item=hyper::Client<test::TestConnect>> + 'static>> It's not declared as a SharedError, and hyper::Client has 2 type parameters...
Denis Lisov
Jul 17 2018 17:35
@nyarly (a) you have an incorrect error type, (b) looks like you have to force unsizing
Judson Lester
Jul 17 2018 17:36
a) I don't understand why the Error is SharedError - that's not how it's declared...?
b) force unsizing because of the 'static?
Denis Lisov
Jul 17 2018 17:39
In the struct definition you have Future<Item = Client<TestConnect, Body>, Error = future::SharedError<CompatError>>. The SharedError here seems to be a mistake.
I don't remember the exact list of situations when Rust coerces Box<impl Trait> to Box<dyn Trait>, but here it does not do so without an explicit command. This seems to be enough
        let connect: Box<Future<Item=_, Error=_> + Send + Sync> = Box::new(
            cs.and_then(|stream| future::ok(TestConnect { stream }))
                .and_then(|co| Ok(Client::builder().build(co)))
                .map_err(|e| Error::from(e).compat()),

        Ok(TestClient {
            connect: connect.shared(),
            test_server: self.clone(),
Judson Lester
Jul 17 2018 17:57
Okay. Thanks very much.
SharedError was definitely a mistake - not sure why I added that?
The latter distinction I'm not sure I follow yet.