diff --git a/src/test/ui/update-references.sh b/src/test/ui/update-references.sh index c2c842fcc49..cfe9a43707c 100755 --- a/src/test/ui/update-references.sh +++ b/src/test/ui/update-references.sh @@ -33,6 +33,7 @@ shift while [[ "$1" != "" ]]; do STDERR_NAME="${1/%.rs/.stderr}" + STDERR_NLL_NAME="${1/%.rs/.nll.stderr}" STDOUT_NAME="${1/%.rs/.stdout}" shift if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ @@ -45,4 +46,9 @@ while [[ "$1" != "" ]]; do echo updating $MYDIR/$STDERR_NAME cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME fi + if [ -f $BUILD_DIR/$STDERR_NLL_NAME ] && \ + ! (diff $BUILD_DIR/$STDERR_NLL_NAME $MYDIR/$STDERR_NLL_NAME >& /dev/null); then + echo updating $MYDIR/$STDERR_NLL_NAME + cp $BUILD_DIR/$STDERR_NLL_NAME $MYDIR/$STDERR_NLL_NAME + fi done diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index e79aefb7236..c16dbd0272a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2811,7 +2811,7 @@ impl<'test> TestCx<'test> { normalized } - fn load_expected_output(&self, kind: &str) -> String { + fn expected_output_path(&self, kind: &str) -> PathBuf { let mut path = expected_output_path(&self.testpaths, self.revision, &self.config.compare_mode, @@ -2822,6 +2822,11 @@ impl<'test> TestCx<'test> { path = expected_output_path(&self.testpaths, self.revision, &None, kind); } + path + } + + fn load_expected_output(&self, kind: &str) -> String { + let path = self.expected_output_path(kind); if path.exists() { match self.load_expected_output_from_path(&path) { Ok(x) => x, @@ -2875,7 +2880,8 @@ impl<'test> TestCx<'test> { } } - let output_file = self.output_base_name().with_extension(kind); + let expected_output_path = self.expected_output_path(kind); + let output_file = self.output_base_name().with_file_name(&expected_output_path); match File::create(&output_file).and_then(|mut f| f.write_all(actual.as_bytes())) { Ok(()) => {} Err(e) => self.fatal(&format!(