Rustfmt: Installing on Rust nightly fails with "expected unit struct/variant or constant, found tuple variant `RangeEnd::Included`"

Created on 28 Sep 2017  路  10Comments  路  Source: rust-lang/rustfmt

% rustc --version
rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
% cargo install --force rustfmt-nightly
    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing rustfmt-nightly v0.2.7
   Compiling void v1.0.2
   Compiling log v0.3.8
   Compiling num-traits v0.1.40
   Compiling term v0.4.6
   Compiling getopts v0.2.15
   Compiling utf8-ranges v1.0.0
   Compiling quote v0.3.15
   Compiling rustfmt-nightly v0.2.7
   Compiling regex-syntax v0.4.1
   Compiling unicode-segmentation v1.2.0
   Compiling lazy_static v0.2.8
   Compiling unicode-xid v0.0.4
   Compiling serde v1.0.15
   Compiling dtoa v0.4.2
   Compiling itoa v0.3.4
   Compiling libc v0.2.31
   Compiling diff v0.1.10
   Compiling unreachable v1.0.0
   Compiling strings v0.1.0
   Compiling synom v0.11.3
   Compiling memchr v1.0.1
   Compiling thread_local v0.3.4
   Compiling syn v0.11.11
   Compiling aho-corasick v0.6.3
   Compiling serde_json v1.0.3
   Compiling toml v0.4.5
   Compiling regex v0.2.2
   Compiling serde_derive_internals v0.16.0
   Compiling serde_derive v1.0.15
   Compiling env_logger v0.4.3
error[E0532]: expected unit struct/variant or constant, found tuple variant `RangeEnd::Included`
  --> /Users/fsouza/.cargo/registry/src/github.com-1ecc6299db9ec823/rustfmt-nightly-0.2.7/src/patterns.rs:62:17
   |
62 |                 RangeEnd::Included => rewrite_pair(
   |                 ^^^^^^^^^^--------
   |                           |
   |                           did you mean `Excluded`?

error: aborting due to previous error

error: failed to compile `rustfmt-nightly v0.2.7`, intermediate artifacts can be found at `/var/folders/t4/s5cn564x04j7s6nz7w_8cd3c0000gp/T/cargo-install.JyUUZ62SqT36`

Caused by:
  Could not compile `rustfmt-nightly`.

To learn more, run the command again with --verbose.

Installing rustfmt from master works, maybe it needs a new release?

bug p-high

All 10 comments

Same exact issue here, with some info on my environment:

$ rustup show
Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin
stable-x86_64-unknown-linux-gnu
nightly-x86_64-apple-darwin (default)

installed targets for active toolchain
--------------------------------------

aarch64-apple-ios
aarch64-linux-android
arm-linux-androideabi
armv7-linux-androideabi
i686-linux-android
x86_64-apple-darwin
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-apple-darwin (default)
rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)

$ rustc --version
rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)

$ cargo --version
cargo 0.23.0-nightly (8118b02ac 2017-09-14)

Running MacOS 10.12.6

Published 0.2.8.

There doesn't seem to be a nightly-0.2.8 tag and crates.io still shows the version of rustfmt-nightly as 0.2.7. Do I just need to wait longer or does something else need to be done?

Yeah, I'm still getting 0.2.7 as well:

% cargo install --force rustfmt-nightly
    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing rustfmt-nightly v0.2.7
   Compiling serde v1.0.15
   Compiling getopts v0.2.15
   Compiling num-traits v0.1.40
   Compiling term v0.4.6
   Compiling void v1.0.2
   Compiling libc v0.2.31
   Compiling regex-syntax v0.4.1
   Compiling unicode-xid v0.0.4
   Compiling diff v0.1.10
   Compiling dtoa v0.4.2
   Compiling log v0.3.8
   Compiling quote v0.3.15
   Compiling lazy_static v0.2.8
   Compiling rustfmt-nightly v0.2.7
   Compiling unicode-segmentation v1.2.0
   Compiling utf8-ranges v1.0.0
   Compiling itoa v0.3.4
   Compiling unreachable v1.0.0
   Compiling memchr v1.0.1
   Compiling synom v0.11.3
   Compiling strings v0.1.0
   Compiling thread_local v0.3.4
   Compiling aho-corasick v0.6.3
   Compiling syn v0.11.11
   Compiling serde_json v1.0.3
   Compiling toml v0.4.5
   Compiling regex v0.2.2
   Compiling serde_derive_internals v0.16.0
   Compiling serde_derive v1.0.15
   Compiling env_logger v0.4.3
error[E0532]: expected unit struct/variant or constant, found tuple variant `RangeEnd::Included`
  --> /Users/fsouza/.cargo/registry/src/github.com-1ecc6299db9ec823/rustfmt-nightly-0.2.7/src/patterns.rs:62:17
   |
62 |                 RangeEnd::Included => rewrite_pair(
   |                 ^^^^^^^^^^--------
   |                           |
   |                           did you mean `Excluded`?

error: aborting due to previous error

error: failed to compile `rustfmt-nightly v0.2.7`, intermediate artifacts can be found at `/var/folders/t4/s5cn564x04j7s6nz7w_8cd3c0000gp/T/cargo-install.jkVr74XN3lsC`

Caused by:
  Could not compile `rustfmt-nightly`.

To learn more, run the command again with --verbose.

@topecongiro can you double check?

Sorry for the inconvinience. For now, could you please install from source?

git clone https://github.com/rust-lang-nursery/rustfmt
cd rustfmt
cargo install --force

@topecongiro that doesn't seem to work for me. Thoughts? (new to using rustfmt and general Rust newbie)

$ cargo install --force                                                                 ~/Code/play/rustfmt
  Installing rustfmt-nightly v0.2.8 (file:///home/isaac/Code/play/rustfmt)
   Compiling rustfmt-nightly v0.2.8 (file:///home/isaac/Code/play/rustfmt)
error[E0432]: unresolved import `syntax::ast::RangeSyntax`
  --> src/patterns.rs:11:72
   |
11 | use syntax::ast::{self, BindingMode, FieldPat, Pat, PatKind, RangeEnd, RangeSyntax};
   |                                                                        ^^^^^^^^^^^ no `RangeSyntax` in `ast`

error[E0532]: expected tuple struct/variant, found unit variant `RangeEnd::Included`
  --> src/patterns.rs:63:21
   |
63 |                     RangeEnd::Included(RangeSyntax::DotDotDot) => "...",
   |                     ^^^^^^^^^^^^^^^^^^ not a tuple struct/variant
   |
help: possible better candidate is found in another module, you can import it into scope
   |
74 | use std::collections::Bound::Included;
   |

error[E0532]: expected tuple struct/variant, found unit variant `RangeEnd::Included`
  --> src/patterns.rs:64:21
   |
64 |                     RangeEnd::Included(RangeSyntax::DotDotEq) => "..=",
   |                     ^^^^^^^^^^^^^^^^^^ not a tuple struct/variant
   |
help: possible better candidate is found in another module, you can import it into scope
   |
74 | use std::collections::Bound::Included;
   |

error[E0554]: #[feature] may not be used on the stable release channel
  --> src/lib.rs:11:1
   |
11 | #![feature(rustc_private)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

error: failed to compile `rustfmt-nightly v0.2.8 (file:///home/isaac/Code/play/rustfmt)`, intermediate artifacts can be found at `/home/isaac/Code/play/rustfmt/target`

Caused by:
  Could not compile `rustfmt-nightly`.

@topecongiro sure, source works fine. Thanks!

@isaacaggrey You appear to be trying to compile using the stable compiler. Do you want to try the following commands?

rustup install nightly
cargo +nightly build

It looks like rustfmt-nightly 0.28 is now on crates.io (cargo +nightly install --force rustfmt-nightly) now works for me, at least).

Indeed it works here as well, thank you! :D

Was this page helpful?
0 / 5 - 0 ratings