1
Fork 0

use --edition for doctests, rather than just the crate

This commit is contained in:
QuietMisdreavus 2018-03-28 13:54:05 +02:00
parent a0e48dde7c
commit d9bf37a5ae
3 changed files with 17 additions and 8 deletions

View file

@ -123,7 +123,8 @@ pub fn run(input_path: &Path,
maybe_sysroot,
Some(codemap),
None,
linker);
linker,
edition);
{
let map = hir::map::map_crate(&sess, &cstore, &mut hir_forest, &defs);
@ -183,8 +184,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
externs: Externs,
should_panic: bool, no_run: bool, as_test_harness: bool,
compile_fail: bool, mut error_codes: Vec<String>, opts: &TestOptions,
maybe_sysroot: Option<PathBuf>,
linker: Option<PathBuf>) {
maybe_sysroot: Option<PathBuf>, linker: Option<PathBuf>, edition: Edition) {
// the test harness wants its own `main` & top level functions, so
// never wrap the test in `fn main() { ... }`
let (test, line_offset) = make_test(test, Some(cratename), as_test_harness, opts);
@ -210,6 +210,10 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
},
test: as_test_harness,
unstable_features: UnstableFeatures::from_environment(),
debugging_opts: config::DebuggingOptions {
edition,
..config::basic_debugging_options()
},
..config::basic_options().clone()
};
@ -473,13 +477,14 @@ pub struct Collector {
codemap: Option<Lrc<CodeMap>>,
filename: Option<PathBuf>,
linker: Option<PathBuf>,
edition: Edition,
}
impl Collector {
pub fn new(cratename: String, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
use_headers: bool, opts: TestOptions, maybe_sysroot: Option<PathBuf>,
codemap: Option<Lrc<CodeMap>>, filename: Option<PathBuf>,
linker: Option<PathBuf>) -> Collector {
linker: Option<PathBuf>, edition: Edition) -> Collector {
Collector {
tests: Vec::new(),
names: Vec::new(),
@ -494,6 +499,7 @@ impl Collector {
codemap,
filename,
linker,
edition,
}
}
@ -513,6 +519,7 @@ impl Collector {
let opts = self.opts.clone();
let maybe_sysroot = self.maybe_sysroot.clone();
let linker = self.linker.clone();
let edition = self.edition;
debug!("Creating test {}: {}", name, test);
self.tests.push(testing::TestDescAndFn {
desc: testing::TestDesc {
@ -543,7 +550,8 @@ impl Collector {
error_codes,
&opts,
maybe_sysroot,
linker)
linker,
edition)
}))
} {
Ok(()) => (),