Repository: intellij-rust/intellij-rust
Issue: Can't debug on Windows

## Environment

* **IntelliJ Rust plugin version:** 0.2.103.SNAPSHOT-192
* **Rust toolchain version:** 1.39.0-nightly (4cf767307 2019-08-18) x86_64-pc-windows-gnu
* **IDE name and version:** CL-192.5728.100
* **Operating system:** Windows 10 10.0

## Problem description

^ title

In internal mode plugin throws the exception:
```
java.lang.IllegalStateException: Long running operation invoked on UI thread
	at org.rust.openapiext.UtilsKt.checkIsBackgroundThread(utils.kt:88)
	at org.rust.cargo.toolchain.RustToolchain.queryVersions(RustToolchain.kt:25)
	at org.rust.cargo.runconfig.CargoRunStateBase.rustVersion(CargoRunStateBase.kt:44)
	at org.rust.debugger.runconfig.RsDebugRunner.checkToolchainSupported(RsDebugRunner.kt:53)
	at org.rust.cargo.runconfig.RsExecutableRunner.execute(RsExecutableRunner.kt:48)
	at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:46)
	at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:35)
	at com.intellij.execution.ProgramRunnerUtil.executeConfigurationAsync(ProgramRunnerUtil.java:92)
	at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:40)
	at com.intellij.execution.impl.ExecutionManagerImpl.restart(ExecutionManagerImpl.java:94)
	at com.intellij.execution.impl.ExecutionManagerImpl.access$300(ExecutionManagerImpl.java:45)
	at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:470)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:231)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:368)
	at com.intellij.util.Alarm$Request.run(Alarm.java:355)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:224)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:312)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:873)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:822)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:461)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:460)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```

## Steps to reproduce

Try to debug on Windows.

Note: new build toolwindow should be enabled.    

Changed files:
debugger/src/main/kotlin/org/rust/debugger/runconfig/RsDebugRunner.kt

diff --git a/debugger/src/main/kotlin/org/rust/debugger/runconfig/RsDebugRunner.kt b/debugger/src/main/kotlin/org/rust/debugger/runconfig/RsDebugRunner.kt
index aafaa5f2e..ee7e20705 100644
--- a/debugger/src/main/kotlin/org/rust/debugger/runconfig/RsDebugRunner.kt
+++ b/debugger/src/main/kotlin/org/rust/debugger/runconfig/RsDebugRunner.kt
@@ -23,6 +23,7 @@ import com.jetbrains.cidr.cpp.toolchains.CPPToolchainsConfigurable
 import com.jetbrains.cidr.toolchains.OSType
 import org.rust.cargo.runconfig.CargoRunStateBase
 import org.rust.cargo.runconfig.RsExecutableRunner
+import org.rust.openapiext.computeWithCancelableProgress
 
 private const val ERROR_MESSAGE_TITLE: String = "Unable to run debugger"
 
@@ -50,7 +51,11 @@ class RsDebugRunner : RsExecutableRunner(DefaultDebugExecutor.EXECUTOR_ID, ERROR
     }
 
     override fun checkToolchainSupported(project: Project, state: CargoRunStateBase): Boolean {
-        if (CPPToolchains.getInstance().osType == OSType.WIN && "msvc" in state.rustVersion().rustc?.host.orEmpty()) {
+        if (CPPToolchains.getInstance().osType != OSType.WIN) return true
+        val isMsvc = project.computeWithCancelableProgress("Checking if toolchain is supported...") {
+            "msvc" in state.rustVersion().rustc?.host.orEmpty()
+        }
+        if (isMsvc) {
             project.showErrorDialog("MSVC toolchain is not supported. Please use GNU toolchain.")
             return false
         }
@@ -59,6 +64,7 @@ class RsDebugRunner : RsExecutableRunner(DefaultDebugExecutor.EXECUTOR_ID, ERROR
 
     override fun checkToolchainConfigured(project: Project): Boolean {
         val toolchains = CPPToolchains.getInstance()
+        // TODO: Fix synchronous execution on EDT
         val toolchain = toolchains.defaultToolchain
         if (toolchain == null) {
             val option = Messages.showDialog(