-
Notifications
You must be signed in to change notification settings - Fork 70
Sysroot for rust src #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sysroot for rust src #251
Conversation
|
||
} | ||
|
||
private static String GetRustcSysroot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried to use the already existing GetSysrootAsync()
method that I mentioned in the issue? Probably it's a bit hard to use here directly, because it requires an async
context. I think the whole of Racer.Exec()
should be async, but I can file that as a follow-up issue if you aren't able to do this now. In that case, please add a TODO
comment here to eventually switch to using Cargo.GetSysrootAsync()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried and failed. Simple call GetSysrootAsync().Result
freezes forever whole VS, and async propagation looks like a bad idea. I will try to make racer async.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way to call an async method synchronously is to use .GetAwaiter().GetResult()
. But this might also deadlock/freeze, so you have to be careful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make all async not work =) The ICompletionSource is synchronious interface. And I cannot find any example to make it async.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use await
keyword for getting value from method GetSysrootAsync()
in non-blocking mode. But it requires mark caller method async
and change return type as Task<T>
, where T is current type of returning value. Thus caller method will became "async-method" (by convention you should add Async suffix to his name) and you should use await
keyword to call it new "async-method" and so on. On the top call-level of methods you can leave void
return-type from method but you need to be careful with synchronization of synchronized mutable state. Task-based returning type is needed for supporting asynchronous calls of this methods and error handling of them. I hope it helps you.
More info here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xilec Unfortunately it's not that easy.
@Vbif Yeah, I can't find any help in that direction either. So, if .GetAwaiter().GetResult()
doesn't work, then just leave the code as is (including the synchronous GetRustcSysroot()
method) and add a TODO
comment to eventually replace this with Cargo.GetSysrootAsync()
.
Added options for enable rust source auto discovery through
--print sysroot
commad