]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #54350 - Munksgaard:support-edition-in-doc-test, r=steveklabnik
authorPietro Albini <pietro@pietroalbini.org>
Sat, 22 Sep 2018 07:56:30 +0000 (09:56 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Sep 2018 07:56:30 +0000 (09:56 +0200)
Support specifying edition in doc test

Fixes #52623

r? @QuietMisdreavus

1  2 
src/librustdoc/test.rs

diff --combined src/librustdoc/test.rs
index 8a9ca924ee1ab997e06c3f74c55890c3a7553ec5,c33888d1a49e505bc104ae458b98f16ffba528b6..dbebc3ab393977a0e226e20dabeb03607e0d757a
@@@ -545,7 -545,7 +545,7 @@@ impl Collector 
          let opts = self.opts.clone();
          let maybe_sysroot = self.maybe_sysroot.clone();
          let linker = self.linker.clone();
-         let edition = self.edition;
+         let edition = config.edition.unwrap_or(self.edition);
          debug!("Creating test {}: {}", name, test);
          self.tests.push(testing::TestDescAndFn {
              desc: testing::TestDesc {
@@@ -775,7 -775,7 +775,7 @@@ fn main() 
  assert_eq!(2+2, 4);
  }".to_string();
          let output = make_test(input, None, false, &opts);
 -        assert_eq!(output, (expected.clone(), 2));
 +        assert_eq!(output, (expected, 2));
      }
  
      #[test]
@@@ -973,7 -973,7 +973,7 @@@ fn main() 
  assert_eq!(2+2, 4);
  }".to_string();
          let output = make_test(input, None, false, &opts);
 -        assert_eq!(output, (expected.clone(), 2));
 +        assert_eq!(output, (expected, 2));
      }
  
      #[test]
@@@ -988,7 -988,7 +988,7 @@@ assert_eq!(2+2, 4);"
  //Ceci n'est pas une `fn main`
  assert_eq!(2+2, 4);".to_string();
          let output = make_test(input, None, true, &opts);
 -        assert_eq!(output, (expected.clone(), 1));
 +        assert_eq!(output, (expected, 1));
      }
  
      #[test]
  assert_eq!(2+2, 4);
  }".to_string();
          let output = make_test(input, None, false, &opts);
 -        assert_eq!(output, (expected.clone(), 1));
 +        assert_eq!(output, (expected, 1));
      }
  }