Skip to content

Commit 3aca244

Browse files
committed
Add support for upstream's 'edition' flag
1 parent 1ccbcfe commit 3aca244

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/header.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ impl TestProps {
297297
.map(|s| s.to_owned()));
298298
}
299299

300+
if let Some(edition) = config.parse_edition(ln) {
301+
self.compile_flags.push(format!("--edition={}", edition));
302+
}
303+
300304
if let Some(r) = config.parse_revisions(ln) {
301305
self.revisions.extend(r);
302306
}
@@ -609,6 +613,10 @@ impl Config {
609613
fn parse_rustfix_only_machine_applicable(&self, line: &str) -> bool {
610614
self.parse_name_directive(line, "rustfix-only-machine-applicable")
611615
}
616+
617+
fn parse_edition(&self, line: &str) -> Option<String> {
618+
self.parse_name_value_directive(line, "edition")
619+
}
612620
}
613621

614622
pub fn lldb_version_to_int(version_string: &str) -> isize {

test-project/tests/ui/2018-edition.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// edition:2018
2+
// compile-pass
3+
4+
pub struct Foo;
5+
impl Foo {
6+
pub async fn foo(&mut self) {
7+
}
8+
}

0 commit comments

Comments
 (0)