Skip to content

Sysroot for rust src - #251

Merged
Boddlnagg merged 3 commits into
PistonDevelopers:masterfrom
Vbif:sysroot_for_rust_src
Oct 31, 2016
Merged

Boddlnagg merged 3 commits into
PistonDevelopers:masterfrom
Vbif:sysroot_for_rust_src

Conversation

@Vbif

@Vbif Vbif commented Oct 29, 2016

Copy link
Copy Markdown
Contributor

Added options for enable rust source auto discovery through --print sysroot commad


}

private static String GetRustcSysroot()

Copy link
Copy Markdown
Contributor

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() .

Copy link
Copy Markdown
Contributor Author

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.

@Boddlnagg Boddlnagg Oct 29, 2016 •

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@xilec xilec Oct 30, 2016 •

Copy link
Copy Markdown
Contributor

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.

@Boddlnagg Boddlnagg Oct 30, 2016 •

Copy link
Copy Markdown
Contributor

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().

@Boddlnagg
Boddlnagg merged commit 57bfb59 into PistonDevelopers:master Oct 31, 2016
@Vbif
Vbif deleted the sysroot_for_rust_src branch October 31, 2016 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants