Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit a6a6cb7

Browse files
authored
Merge pull request #185 from msrd0/remove-src-path-env-var
2 parents 6f32773 + 30beb90 commit a6a6cb7

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

lib/index.js

+2-30
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,6 @@ function shouldIgnoreProjectPath(projectPath) {
142142
.some(path => path === projectPath.trim().replace(/[/\\]*$/, ''))
143143
}
144144

145-
/**
146-
* @param {string} [toolchain]
147-
* @param {string} [cwd]
148-
* @return {Promise<string>} `rustc --print sysroot` stdout
149-
*/
150-
async function rustcSysroot(toolchain, cwd) {
151-
try {
152-
let { stdout } = await rustupRun(toolchain, "rustc --print sysroot", { cwd })
153-
return stdout.trim()
154-
} catch (e) {
155-
// make an attempt to use system rustc
156-
try {
157-
let { stdout } = await exec(`rustc --print sysroot`, { cwd })
158-
return stdout.trim()
159-
} catch (sys_e) {
160-
throw e
161-
}
162-
}
163-
}
164-
165145
/** @return {string} environment variable path */
166146
let envPath = () => {
167147
// Make sure the cargo directory is in PATH
@@ -172,11 +152,9 @@ let envPath = () => {
172152
}
173153

174154
/**
175-
* @param {string} [toolchain]
176-
* @param {string} [cwd]
177155
* @return {Promise<object>} environment vars
178156
*/
179-
async function serverEnv(toolchain, cwd) {
157+
function serverEnv() {
180158
const env = process.env
181159
env.PATH = envPath()
182160
env.RUST_BACKTRACE = env.RUST_BACKTRACE || "1"
@@ -185,12 +163,6 @@ async function serverEnv(toolchain, cwd) {
185163
// env.RUST_LOG = 'info'
186164
// }
187165

188-
try {
189-
let sysroot = await rustcSysroot(toolchain, cwd)
190-
env.RUST_SRC_PATH = path.join(sysroot, "/lib/rustlib/src/rust/src/")
191-
} catch (e) {
192-
console.warn("Failed to find sysroot: " + e)
193-
}
194166
return env
195167
}
196168

@@ -546,7 +518,7 @@ class RustLanguageClient extends AutoLanguageClient {
546518
clearIdeRustNotifications("ide-rust.langServerCommand")
547519

548520
return logSuspiciousStdout(cp.spawn(languageServerCmd, {
549-
env: await serverEnv(configToolchain()),
521+
env: serverEnv(),
550522
shell: true,
551523
cwd: projectPath
552524
}))

0 commit comments

Comments
 (0)