You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This part is from https://github.com/rust-lang/rust/blob/a91f7d72f12efcc00ecf71591f066c534d45ddf7/compiler/rustc_expand/src/expand.rs#L402-L409 (fn expand_crate)
84
+
// Extract crate base path from the filename path.
85
+
let file_path = match sm.span_to_filename(sp){
86
+
FileName::Real(name) => name
87
+
.into_local_path()
88
+
.expect("attempting to resolve a file path in an external file"),
89
+
other => PathBuf::from(other.prefer_local().to_string()),
90
+
};
91
+
92
+
// Root path contains the topmost sources directory of the crate.
93
+
// I.e., for `project` with sources in `src` and tests in `tests` folders
94
+
// (no matter how many nested folders lie inside),
95
+
// there will be two different root paths: `/project/src` and `/project/tests`.
96
+
let root_path = file_path.parent().unwrap_or(&file_path).to_owned();
97
+
98
+
// The next part matches logic in https://github.com/rust-lang/rust/blob/a91f7d72f12efcc00ecf71591f066c534d45ddf7/compiler/rustc_builtin_macros/src/test.rs#L526 (fn test_type)
99
+
// Integration tests are under /tests directory in the crate root_path we determined above.
0 commit comments