diff options
| author | bors <bors@rust-lang.org> | 2016-12-17 06:43:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-17 06:43:16 +0000 |
| commit | f99d4dfef2cf3cbbf5699e44fddf019695e1d00d (patch) | |
| tree | 260767f07070b84f1c19a19eae4c0adc682f9afa /src/libsyntax/parse/parser.rs | |
| parent | d250169cb5a96481a3e7c8f9fe05de49f60e5ae5 (diff) | |
| parent | fd98a8d795b17b76ea6d1edcae55d4450efd466f (diff) | |
| download | rust-f99d4dfef2cf3cbbf5699e44fddf019695e1d00d.tar.gz rust-f99d4dfef2cf3cbbf5699e44fddf019695e1d00d.zip | |
Auto merge of #38205 - jseyfried:fix_module_directory_regression, r=eddyb
macros: fix the expected paths for a non-inline module matched by an `item` fragment Fixes #38190. r? @nrc
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bdd1606805f..4367f933485 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -267,12 +267,11 @@ impl From<P<Expr>> for LhsExpr { } impl<'a> Parser<'a> { - pub fn new(sess: &'a ParseSess, rdr: Box<Reader+'a>) -> Self { - Parser::new_with_doc_flag(sess, rdr, false) - } - - pub fn new_with_doc_flag(sess: &'a ParseSess, rdr: Box<Reader+'a>, desugar_doc_comments: bool) - -> Self { + pub fn new(sess: &'a ParseSess, + rdr: Box<Reader+'a>, + directory: Option<Directory>, + desugar_doc_comments: bool) + -> Self { let mut parser = Parser { reader: rdr, sess: sess, @@ -298,7 +297,9 @@ impl<'a> Parser<'a> { let tok = parser.next_tok(); parser.token = tok.tok; parser.span = tok.sp; - if parser.span != syntax_pos::DUMMY_SP { + if let Some(directory) = directory { + parser.directory = directory; + } else if parser.span != syntax_pos::DUMMY_SP { parser.directory.path = PathBuf::from(sess.codemap().span_to_filename(parser.span)); parser.directory.path.pop(); } |
