Skip to content

Commit c0db1aa

Browse files
committed
Rollup merge of #52385 - GuillaumeGomez:pass-edition-to-parser, r=QuietMisdreavus
Pass edition flags to compiler from rustdoc as expected Fixes #52357.
2 parents c052a49 + 65e6b2b commit c0db1aa

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/librustdoc/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use syntax::codemap::CodeMap;
3737
use syntax::edition::Edition;
3838
use syntax::feature_gate::UnstableFeatures;
3939
use syntax::with_globals;
40-
use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName};
40+
use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName, hygiene};
4141
use errors;
4242
use errors::emitter::ColorConfig;
4343

@@ -561,6 +561,7 @@ impl Collector {
561561
rustc_driver::in_rustc_thread(move || with_globals(move || {
562562
io::set_panic(panic);
563563
io::set_print(print);
564+
hygiene::set_default_edition(edition);
564565
run_test(&test,
565566
&cratename,
566567
&filename,

src/test/rustdoc/edition-flag.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:--test -Z unstable-options
12+
// edition:2018
13+
14+
#![feature(async_await)]
15+
16+
/// ```rust
17+
/// #![feature(async_await)]
18+
/// fn main() {
19+
/// let _ = async { };
20+
/// }
21+
/// ```
22+
fn main() {
23+
let _ = async { };
24+
}

0 commit comments

Comments
 (0)