set the syntax edition in the driver's phase 1
This commit is contained in:
parent
fbb6275f4f
commit
0511b01506
@ -57,7 +57,7 @@ use syntax::ext::base::ExtCtxt;
|
||||
use syntax::fold::Folder;
|
||||
use syntax::parse::{self, PResult};
|
||||
use syntax::util::node_count::NodeCounter;
|
||||
use syntax_pos::FileName;
|
||||
use syntax_pos::{FileName, hygiene};
|
||||
use syntax_ext;
|
||||
|
||||
use derive_registrar;
|
||||
@ -670,6 +670,7 @@ pub fn phase_1_parse_input<'a>(
|
||||
) -> PResult<'a, ast::Crate> {
|
||||
sess.diagnostic()
|
||||
.set_continue_after_error(control.continue_parse_after_error);
|
||||
hygiene::set_default_edition(sess.edition());
|
||||
|
||||
if sess.profile_queries() {
|
||||
profile::begin(sess);
|
||||
|
@ -109,7 +109,7 @@ use syntax::ast;
|
||||
use syntax::codemap::{CodeMap, FileLoader, RealFileLoader};
|
||||
use syntax::feature_gate::{GatedCfg, UnstableFeatures};
|
||||
use syntax::parse::{self, PResult};
|
||||
use syntax_pos::{hygiene, DUMMY_SP, MultiSpan, FileName};
|
||||
use syntax_pos::{DUMMY_SP, MultiSpan, FileName};
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
@ -477,7 +477,6 @@ pub fn run_compiler<'a>(args: &[String],
|
||||
};
|
||||
|
||||
let (sopts, cfg) = config::build_session_options_and_crate_config(&matches);
|
||||
hygiene::set_default_edition(sopts.edition);
|
||||
|
||||
driver::spawn_thread_pool(sopts, |sopts| {
|
||||
run_compiler_with_pool(matches, sopts, cfg, callbacks, file_loader, emitter_dest)
|
||||
|
@ -37,7 +37,7 @@ use syntax::codemap::CodeMap;
|
||||
use syntax::edition::Edition;
|
||||
use syntax::feature_gate::UnstableFeatures;
|
||||
use syntax::with_globals;
|
||||
use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName, hygiene};
|
||||
use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName};
|
||||
use errors;
|
||||
use errors::emitter::ColorConfig;
|
||||
|
||||
@ -562,7 +562,6 @@ impl Collector {
|
||||
rustc_driver::in_named_rustc_thread(name, move || with_globals(move || {
|
||||
io::set_panic(panic);
|
||||
io::set_print(print);
|
||||
hygiene::set_default_edition(edition);
|
||||
run_test(&test,
|
||||
&cratename,
|
||||
&filename,
|
||||
|
24
src/test/rustdoc/async-fn.rs
Normal file
24
src/test/rustdoc/async-fn.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// edition:2018
|
||||
// compile-flags:-Z unstable-options
|
||||
|
||||
// FIXME: once `--edition` is stable in rustdoc, remove that `compile-flags` directive
|
||||
|
||||
#![feature(rust_2018_preview, async_await, futures_api)]
|
||||
|
||||
// @has async_fn/struct.S.html
|
||||
// @has - '//code' 'pub async fn f()'
|
||||
pub struct S;
|
||||
|
||||
impl S {
|
||||
pub async fn f() {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user