summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2018-05-28 15:30:02 -0300
committerSantiago Pastorino <spastorino@gmail.com>2018-05-30 14:03:31 -0300
commit9df0a41321b8dd3fc48da9b34b3f79b0c37051b7 (patch)
tree56a1a5bd485370000fc0be0571b47fa6d1208e18
parentAuto merge of #50955 - steveklabnik:update-libbacktrace, r=alexcrichton (diff)
downloadgrust-9df0a41321b8dd3fc48da9b34b3f79b0c37051b7.tar.gz
grust-9df0a41321b8dd3fc48da9b34b3f79b0c37051b7.tar.bz2
grust-9df0a41321b8dd3fc48da9b34b3f79b0c37051b7.tar.xz
Add polonius compare mode
-rw-r--r--src/tools/compiletest/src/common.rs3
-rw-r--r--src/tools/compiletest/src/runtest.rs13
2 files changed, 14 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index b2ce5ce52f..951a72fec6 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -99,18 +99,21 @@ impl fmt::Display for Mode {
99#[derive(Clone, PartialEq)] 99#[derive(Clone, PartialEq)]
100pub enum CompareMode { 100pub enum CompareMode {
101 Nll, 101 Nll,
102 Polonius,
102} 103}
103 104
104impl CompareMode { 105impl CompareMode {
105 pub(crate) fn to_str(&self) -> &'static str { 106 pub(crate) fn to_str(&self) -> &'static str {
106 match *self { 107 match *self {
107 CompareMode::Nll => "nll", 108 CompareMode::Nll => "nll",
109 CompareMode::Polonius => "polonius",
108 } 110 }
109 } 111 }
110 112
111 pub fn parse(s: String) -> CompareMode { 113 pub fn parse(s: String) -> CompareMode {
112 match s.as_str() { 114 match s.as_str() {
113 "nll" => CompareMode::Nll, 115 "nll" => CompareMode::Nll,
116 "polonius" => CompareMode::Polonius,
114 x => panic!("unknown --compare-mode option: {}", x), 117 x => panic!("unknown --compare-mode option: {}", x),
115 } 118 }
116 } 119 }
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 9ff80cc1d3..f1e0c2bea0 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1729,6 +1729,9 @@ impl<'test> TestCx<'test> {
1729 Some(CompareMode::Nll) => { 1729 Some(CompareMode::Nll) => {
1730 rustc.args(&["-Zborrowck=mir", "-Ztwo-phase-borrows"]); 1730 rustc.args(&["-Zborrowck=mir", "-Ztwo-phase-borrows"]);
1731 } 1731 }
1732 Some(CompareMode::Polonius) => {
1733 rustc.args(&["-Zpolonius", "-Zborrowck=mir", "-Ztwo-phase-borrows"]);
1734 }
1732 None => {} 1735 None => {}
1733 } 1736 }
1734 1737
@@ -2898,8 +2901,14 @@ impl<'test> TestCx<'test> {
2898 &self.config.compare_mode, 2901 &self.config.compare_mode,
2899 kind, 2902 kind,
2900 ); 2903 );
2901 if !path.exists() && self.config.compare_mode.is_some() { 2904
2902 // fallback! 2905 if !path.exists() {
2906 if let Some(CompareMode::Polonius) = self.config.compare_mode {
2907 path = expected_output_path(&self.testpaths, self.revision, &Some(CompareMode::Nll), kind);
2908 }
2909 }
2910
2911 if !path.exists() {
2903 path = expected_output_path(&self.testpaths, self.revision, &None, kind); 2912 path = expected_output_path(&self.testpaths, self.revision, &None, kind);
2904 } 2913 }
2905 2914