Rollup merge of #110115 - jyn514:remap-path-prefix-ci, r=compiler-errors

compiletest: Use remap-path-prefix only in CI

This makes jump-to-definition work in most IDEs, as well as being easier to understand for contributors.

Fixes https://github.com/rust-lang/rust/issues/109725. cc `@TimNN`
This commit is contained in:
Dylan DPC 2023-04-10 14:13:15 +05:30 committed by GitHub
commit e327487bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::Command; use std::process::Command;
use build_helper::ci::CiEnv;
use tracing::*; use tracing::*;
use crate::common::{Config, Debugger, FailMode, Mode, PassMode}; use crate::common::{Config, Debugger, FailMode, Mode, PassMode};
@ -276,8 +277,12 @@ pub fn from_file(testfile: &Path, cfg: Option<&str>, config: &Config) -> Self {
/// `//[foo]`), then the property is ignored unless `cfg` is /// `//[foo]`), then the property is ignored unless `cfg` is
/// `Some("foo")`. /// `Some("foo")`.
fn load_from(&mut self, testfile: &Path, cfg: Option<&str>, config: &Config) { fn load_from(&mut self, testfile: &Path, cfg: Option<&str>, config: &Config) {
// Mode-dependent defaults. // In CI, we've sometimes encountered non-determinism related to truncating very long paths.
self.remap_src_base = config.mode == Mode::Ui && !config.suite.contains("rustdoc"); // Set a consistent (short) prefix to avoid issues, but only in CI to avoid regressing the
// contributor experience.
if CiEnv::is_ci() {
self.remap_src_base = config.mode == Mode::Ui && !config.suite.contains("rustdoc");
}
let mut has_edition = false; let mut has_edition = false;
if !testfile.is_dir() { if !testfile.is_dir() {