about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-30 18:00:54 +0900
committerGitHub <noreply@github.com>2020-10-30 18:00:54 +0900
commitf8539221d073cf0f4b28ba3dff5cae8a63ae5243 (patch)
treeb21143b87edf2ca020bcfa464e98e99ae4848818 /src/tools
parent8111706c18aebe273457b0967e076bf5e105a382 (diff)
parenta15e0dc4991a6c06dd5108d72163fb9809db2b07 (diff)
downloadrust-f8539221d073cf0f4b28ba3dff5cae8a63ae5243.tar.gz
rust-f8539221d073cf0f4b28ba3dff5cae8a63ae5243.zip
Rollup merge of #78524 - tmiasko:source-files-borrow, r=Aaron1011
Avoid BorrowMutError with RUSTC_LOG=debug

```console
$ touch empty.rs
$ env RUSTC_LOG=debug rustc +stage1 --crate-type=lib empty.rs
```

Fails with a `BorrowMutError` because source map files are already
borrowed while `features_query` attempts to format a log message
containing a span.

Release the borrow before the query to avoid the issue.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/src/runtest.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index d85558ea2f5..666e5d402ef 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1775,6 +1775,11 @@ impl<'test> TestCx<'test> {
         let mut aux_rustc =
             aux_cx.make_compile_args(input_file, aux_output, EmitMetadata::No, AllowUnused::No);
 
+        for key in &aux_props.unset_rustc_env {
+            aux_rustc.env_remove(key);
+        }
+        aux_rustc.envs(aux_props.rustc_env.clone());
+
         let (dylib, crate_type) = if aux_props.no_prefer_dynamic {
             (true, None)
         } else if self.config.target.contains("cloudabi")