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

bump rustfmt 1x to rustc-ap v651 #4100

Merged

Conversation

calebcartwright
Copy link
Member

@calebcartwright calebcartwright commented Mar 28, 2020

Refs rust-lang/rust#70280

Feel free to change the target branch as needed, just pointing to 1.4.12 for now since that's the only one available with the latest 1.x.

This updates the rustc-ap-* dependencies to v651 which should get rustfmt working again on nightly, and also backports the syntux module from rustfmt 2.x/master to be more consistent and minimize the amount of parser changes required.

I tried to do only the minimal amount of refactoring to the parser and mod resolver needed to get rustfmt working with the upstream parser/expansion changes. It can certainly be improved and I believe some of these upstream changes will ultimately help us implement some of the mod resolver changes we've been eyeing (like #3930). However, IMO those would be better addressed in follow up PRs since rustfmt has been broken for a while and this PR is a decent size already.

cc @Centril @Manishearth @matthiaskrgr

@calebcartwright
Copy link
Member Author

This was working with v650 of the rustc-ap* crates as of rustc 1.44.0-nightly (02046a5d4 2020-03-24) though obviously failing again with the latest nightly.

I'm guessing that means we'll need the changes from rust-lang/rust#68004 and a v651 of the crates

error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now

    --> /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_span-650.0.0/symbol.rs:1281:6

     |

1281 | impl !Send for SymbolStr {}

     |      ^^^^^

     |

     = note: see issue #68318 <https://github.com/rust-lang/rust/issues/68318> for more information

     = help: add `#![feature(negative_impls)]` to the crate attributes to enable

src/attr.rs Outdated
Comment on lines 21 to 29
pub(crate) fn get_attrs_from_stmt(stmt: &ast::Stmt) -> Option<&[ast::Attribute]> {
match stmt.kind {
ast::StmtKind::Local(ref local) => &local.attrs,
ast::StmtKind::Item(ref item) => &item.attrs,
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => &expr.attrs,
ast::StmtKind::Mac(ref mac) => &mac.2,
ast::StmtKind::Local(ref local) => Some(&local.attrs),
ast::StmtKind::Item(ref item) => Some(&item.attrs),
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => Some(&expr.attrs),
ast::StmtKind::MacCall(ref mac) => Some(&mac.2),
ast::StmtKind::Empty => None,
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks! I didn't know that existed. Have updated to leverage that accordingly

@Manishearth
Copy link
Member

Thank you so much for working on this! I usually don't review rustfmt PRs, r? @topecongiro @nrc

@calebcartwright calebcartwright changed the title bump rustfmt 1x to rustc-ap v650 bump rustfmt 1x to rustc-ap v651 Mar 30, 2020
@Manishearth
Copy link
Member

@bors r+

actually going to r+ this early so nightly rustfmt is fixed. the reviewers of rustfmt can make changes later if they wish

@calebcartwright
Copy link
Member Author

actually going to r+ this early so nightly rustfmt is fixed. the reviewers of rustfmt can make changes later if they wish

Excellent thank you! I don't believe rustfmt has bors enabled.

I know @topecongiro had been busy and unavailable for a while. It's actually been a good stretch since we've heard from anyone on the rustfmt team, but obviously things around the world have been pretty crazy lately.

The PR queue has been backing up however so if there's any one that could help that would be greatly appreciated!

@Manishearth Manishearth merged commit 5ca3d02 into rust-lang:rustfmt-1.4.12 Mar 30, 2020
@Manishearth
Copy link
Member

Huh, surprised there's no bors, but that explains why there was no bors comment!

I can temporarily review stuff here if needed, but perhaps we need to grow a new team.

@calebcartwright
Copy link
Member Author

I've got to make similar rustc-ap updates over in Racer so that rustfmt and RLS can be fixed on nightly, but afterwards will need to open a PR to make the rustc-ap updates on rustfmt's master branch as well.

If we can at least get that PR merged to fix master that would be fantastic.

@topecongiro
Copy link
Contributor

@calebcartwright @Manishearth @Centril Thank you for your works and my apologies for the absence.

I will bump the version as soon as possible.

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 this pull request may close these issues.

4 participants