These are chat archives for rust-lang/rust

6th
Feb 2019
John
@onFireForGod_gitlab
Feb 06 01:58
When importing packages in heavily nested modules, how can I refer to the “root” module and start from the top instead of inserting super::super::super...
matrixbot
@matrixbot
Feb 06 02:24
bspeice If you're using Rust 2018, the crate prefix works well, otherwise a leading :: (as in ::something_in_lib) should accomplish what you need.
John
@onFireForGod_gitlab
Feb 06 02:32
also is there a way to turn on rust linting?
I am using ItelliJIDEA
matrixbot
@matrixbot
Feb 06 02:33
bspeice Not sure in IntelliJ. The style guides are on by default, but linting is handled through clippy
John
@onFireForGod_gitlab
Feb 06 02:35
Thanks!
Achala_Bhatt
@AchalaSB
Feb 06 09:15
How to solve this error error: can't perform LTO when compiling incrementally
I'm running on ubuntu, and I setted lto=true in my cargo.toml it required for my code
I tried cargo update also but getting same issue
Denis Lisov
@tanriol
Feb 06 10:01
You can put incremental = false in there, but compile times may be not good. Why do you need lto in debug?
Achala_Bhatt
@AchalaSB
Feb 06 10:24
Enabling lto, or link-time optimizations, allows the compiler to prune or inline parts of the code at link-time.
Michal 'vorner' Vaner
@vorner
Feb 06 10:25
Yes, we know that. The question wasn't what it does, but why do you need it in the debug build.
Debug build is for fast iteration (therefore, it has optimisations turned off ‒ fast to build, but slow to run)
Achala_Bhatt
@AchalaSB
Feb 06 10:32
The thing is I added lto for the optimization and then i compiled my code it gives me proper result in Ubuntu
And then I tried to compile it in other ubuntu machine it gives above error even in mac same error
Arnaud Esteve
@aesteve
Feb 06 10:45
Hi everyone, could someone help me with lifetimes ? I'm still completely lost
I have such a function : pub fn create_record(info: &some_info_i_need_to_read, topic: &String, msg: the_msg) -> Option<Record<String, String>> {
Capture d’écran 2019-02-06 à 11.47.31.png
whatever I try to write (even a silly &'static Option<&'static Record<&'static String, &'static String>>), the compiler keeps saying lifetime is missing
it's impossible to create a function that has two references as parameters ?
Denis Lisov
@tanriol
Feb 06 11:19
What is a Record here?
Arnaud Esteve
@aesteve
Feb 06 11:20
Kafka record from kafka-rs library
Denis Lisov
@tanriol
Feb 06 11:38
Have you tried Option<Record<'static, String, String>>?
Arnaud Esteve
@aesteve
Feb 06 14:35
no I did not actulally, I'll give this a try
Kelly Thomas Kline
@kellytk
Feb 06 22:01
I'm attempting to learn how to handle error compatibility that's causing the errors at https://ghostbin.com/paste/vnmx3 beginning on line 106. Where and how should they be solved?
Denis Lisov
@tanriol
Feb 06 22:25
Looks like line 136 should have been something like Box::new(then.into_future())?
Kelly Thomas Kline
@kellytk
Feb 06 22:30
I've updated it with the new error in https://ghostbin.com/paste/ga5y2
tanriol @tanriol went diving into Actix docs
Kelly Thomas Kline
@kellytk
Feb 06 22:48
Where would I begin resolving the new error?
Kelly Thomas Kline
@kellytk
Feb 06 22:54
I'm not seeking the answer as much as a walk-through of the logic I can learn from. It's an intersection of several categories of problem to me that the complexity is stumping me and I know a bit of a nudge would help quite a bit
Denis Lisov
@tanriol
Feb 06 22:54
Looks like I was wrong to suggest that change :-) and also looks like I really need to understand where the Send part comes from.
Actually now I see one suspicious place, but I cannot test it as the code is incomplete.
Kelly Thomas Kline
@kellytk
Feb 06 23:02
I'll fill it out
Denis Lisov
@tanriol
Feb 06 23:02

You have

impl Handler<WorkerRequest> for WorkerActor {
    type Result = ResponseFuture<Foo, rusqlite::Error>;
    /* ... */
}

#[derive(Message)]
#[rtype(result="ResponseFuture<Result<Foo, rusqlite::Error>, actix::MailboxError>")]
pub enum WorkerRequest { /* ... */ }

and I'd really guess these two types have to match.

Kelly Thomas Kline
@kellytk
Feb 06 23:06
I apologize that was a typo. Updated if you reload and the errors remain the same