about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-02-05 17:48:46 +0000
committerbors <bors@rust-lang.org>2021-02-05 17:48:46 +0000
commita507c27660d05f37307369d30bee9e82ce3a11e1 (patch)
treed36e6a1b1ffb4647fa021ec3b72a820b9c896380
parent89f266a0825bd73fcc05e3a6d5991c0b5adafcb0 (diff)
parent79dbf10736defbfee05ba95083ba6e2a012f6cef (diff)
downloadrust-a507c27660d05f37307369d30bee9e82ce3a11e1.tar.gz
rust-a507c27660d05f37307369d30bee9e82ce3a11e1.zip
Auto merge of #6679 - flip1995:ra_setup_abs_path, r=Manishearth
Use absolute path to Rust repo in ra_setup

This will convert the path to the Rust repo to an absolute path. This is
important for the clippy_lints/Cargo.toml file. Otherwise if a relative
path is passed, rst-analyzer won't find the Rust repo, because it starts
the relative path search from the clippy_lints dir, not the
rust-clippy dir where the ra_setup command was run from.

changelog: none
-rw-r--r--clippy_dev/src/ra_setup.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/clippy_dev/src/ra_setup.rs b/clippy_dev/src/ra_setup.rs
index a3c329b578b..d0e2193ddc5 100644
--- a/clippy_dev/src/ra_setup.rs
+++ b/clippy_dev/src/ra_setup.rs
@@ -13,7 +13,9 @@ use std::path::{Path, PathBuf};
 /// Panics if `rustc_path` does not lead to a rustc repo or the files could not be read
 pub fn run(rustc_path: Option<&str>) {
     // we can unwrap here because the arg is required by clap
-    let rustc_path = PathBuf::from(rustc_path.unwrap());
+    let rustc_path = PathBuf::from(rustc_path.unwrap())
+        .canonicalize()
+        .expect("failed to get the absolute repo path");
     assert!(rustc_path.is_dir(), "path is not a directory");
     let rustc_source_basedir = rustc_path.join("compiler");
     assert!(