diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-12-07 00:28:51 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-12-07 10:56:55 +0000 |
| commit | fd98a8d795b17b76ea6d1edcae55d4450efd466f (patch) | |
| tree | ae51c9d40290d78d68ab07675747205eacfd8768 /src/libsyntax/parse/parser.rs | |
| parent | daf8c1dfce3b448fc581cc319f64632ec22bd0e1 (diff) | |
| download | rust-fd98a8d795b17b76ea6d1edcae55d4450efd466f.tar.gz rust-fd98a8d795b17b76ea6d1edcae55d4450efd466f.zip | |
macros: fix the expected paths for a non-inline module matched by an `item` fragment.
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(); } |
