Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracking issue for rustc parser changes #4013

Closed
calebcartwright opened this issue Jan 13, 2020 · 0 comments · Fixed by #4106
Closed

tracking issue for rustc parser changes #4013

calebcartwright opened this issue Jan 13, 2020 · 0 comments · Fixed by #4106

Comments

@calebcartwright
Copy link
Member

Looks like there's going to be some changes in the rustc parser that will involve the removal of parts of the parser interface that rustfmt uses today (default_submod_path and I'd guess submod_path_from_attr too).

rust-lang/rust#68135 (comment)

Note that methods like default_submod_path are going to be removed from the parser when we fix #64197, so making those public will likely be short-lived. (cc petrochenkov)

Not sure what the changes will entail, but opening this to help keep track of the pending upstream changes in the parser.

Places in rustfmt that'll probably be impacted by those upstream changes:

pub(crate) fn default_submod_path(
&self,
id: ast::Ident,
relative: Option<ast::Ident>,
dir_path: &Path,
) -> syntax::parse::parser::ModulePath {
syntax::parse::parser::Parser::default_submod_path(
id,
relative,
dir_path,
self.parse_sess.source_map(),
)
}

match self
.parse_sess
.default_submod_path(mod_name, relative, &self.directory.path)
.result

pub(crate) fn submod_path_from_attr(attrs: &[ast::Attribute], path: &Path) -> Option<PathBuf> {
syntax::parse::parser::Parser::submod_path_from_attr(attrs, path)
}

if let Some(path) = Parser::submod_path_from_attr(attrs, &self.directory.path) {
return Ok(SubModKind::External(
path,
DirectoryOwnership::Owned { relative: None },
));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant