Rustfmt and unstable features

I tried to set trailing_comma = "Never" in rustfmt.toml. trailing_comma is not a stable function yet, so I set unstable_features = true as well. But when I run rustfmt it doesn't seem to have any effect. I tried the same thing with the beta toolchain, and got the same results. When I run nightly it works though.

The reason I find this somewhat peculiar is because stable and beta seem to recognize the keyword, and the feature itself seems to have been around for a while. And the documentation hints that unstable features should be available in stable and beta as long as unstable_features is set to true.

(We don't want to use nightly as two of our development systems at the office are unable to install nightly's rustfmt on Windows).

Should trailing_comma + unstable_features be working on stable and beta?


I'm surprised that trying to run stable rustfmt with unstable_features = true doesn't error. In general the Rust toolchain doesn't allow access to unstable features on the stable/beta channels, you need to opt-in to them by using nightly to make it explicit that the feature could just disappear or change behaviour at any time.

1 Like

Looks like rustfmt is planning to allow access to unstable features on stable with an opt-in from v2 :confused: , but it's still at v1.4 at the moment so that doesn't work yet.

1 Like

I'd also like to use an unstable feature of rustfmt but have been unable to. After a brief search it looks like there has been talk of rustfmt 2.0 going back at least two years. So is there any hope there's going to be a 2.0 any time soon? Or that we can use unstable features on stable? Or that unstable rustfmt features will become stable?

That's the normal progression. For any tool, unstable features are experimental. They progress to stable only when there is confidence that that portion of the feature space has been adequately explored and that the ultimately-selected form of the feature is a reasonably-good fit for the tool.

1 Like

Well, yeah, I know how stable and unstable work. That wasn't my point.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.