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

cargo fmt fails with half_open_range_patterns #4009

Closed
JohnTitor opened this issue Jan 11, 2020 · 2 comments · Fixed by #4044
Closed

cargo fmt fails with half_open_range_patterns #4009

JohnTitor opened this issue Jan 11, 2020 · 2 comments · Fixed by #4044
Labels
blocked Blocked on rustc, an RFC, etc. bug Panic, non-idempotency, invalid code, etc.

Comments

@JohnTitor
Copy link
Member

JohnTitor commented Jan 11, 2020

This example compiles fine with latest nightly, but cargo fmt fails. The failure also occurs on clippy's CI (https://travis-ci.com/rust-lang/rust-clippy/jobs/274511513).
Probably we need rustup and update submodule on rust-lang/rust?

#![feature(half_open_range_patterns)]
#![feature(exclusive_range_pattern)]

fn main() {
    match 54 {
        5.. => println!("yay!"),
        _ => (),
    }
}

error log:

error: `X..` range patterns are not supported
 --> main.rs:6:9
  |
6 |         5.. => println!("yay!"),
  |         ^^^ help: try using the maximum value for the type: `5..MAX`
@calebcartwright
Copy link
Member

Yeah I believe the underlying problem is that ATM rustfmt is using a pretty old version of the rustc internals (v610 of the rustc-ap-* crates, including the one for libsyntax).

The refactoring/splitting of libsyntax over the last couple months has created some challenges in upgrading the rustc-ap-* versions within rustfmt, but I think that all of our blockers will be removed once rust-lang/rust#68135 is merged (and then gets published in rustc-ap)

Centril added a commit to Centril/rust that referenced this issue Jan 12, 2020
…ities, r=Centril

restore some rustc_parse visibilities for rustfmt

In rust-lang@c189565 some visibilities were reduced on the parse mod (which now resides in the rustc_parse crate) as part of some refactoring and splitting up of libsyntax. However, rustfmt needs access to a few of those items that are no longer visible.

This restores the visibility on those items rustfmt depends on.

rust-lang/rustfmt#3903 (comment)
rust-lang/rustfmt#4009

cc @topecongiro
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jan 12, 2020
…ities, r=Centril

restore some rustc_parse visibilities for rustfmt

In rust-lang@c189565 some visibilities were reduced on the parse mod (which now resides in the rustc_parse crate) as part of some refactoring and splitting up of libsyntax. However, rustfmt needs access to a few of those items that are no longer visible.

This restores the visibility on those items rustfmt depends on.

rust-lang/rustfmt#3903 (comment)
rust-lang/rustfmt#4009

cc @topecongiro
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jan 13, 2020
…ities, r=Centril

restore some rustc_parse visibilities for rustfmt

In rust-lang@c189565 some visibilities were reduced on the parse mod (which now resides in the rustc_parse crate) as part of some refactoring and splitting up of libsyntax. However, rustfmt needs access to a few of those items that are no longer visible.

This restores the visibility on those items rustfmt depends on.

rust-lang/rustfmt#3903 (comment)
rust-lang/rustfmt#4009

cc @topecongiro
@topecongiro topecongiro added blocked Blocked on rustc, an RFC, etc. bug Panic, non-idempotency, invalid code, etc. labels Jan 14, 2020
@calebcartwright
Copy link
Member

calebcartwright commented Feb 10, 2020

@topecongiro - this can be closed with #4043 being merged actually probably best to close this as part of #4044

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on rustc, an RFC, etc. bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants