rust-lang / rust-lang/rustfmt

`unstable_features` does absolutely nothing

Open
#5,169 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-config P-low
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

rustfmt 1.4.37-stable (59eed8a2 2021-11-01)

Given a rustfmt.toml that looks like

unstable_features = <val>
imports_layout = "Vertical" # Some unstable feature

Files are formatted according to the following table

+stable +nightly
unstable_features = true ignores unstable features uses unstable features
unstable_features = false ignores unstable features uses unstable features

So the value of unstable_features does absolutely nothing except cause rustfmt to emit one of the following warnings when using a stable toochain

Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = false`, unstable features are only available in nightly channel.

which is ridiculous.

Either this key should allow you to enable unstable formatting settings for stable toolchains, or it should allow you to disable unstable formatting settings for nightly toolchains. Preferably both. It currently has no effect at all.

There is a bug here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the rustfmt.toml configuration with unstable_features and imports_layout on the stable and nightly toolchains described in the issue. Trace how unstable_features is handled and verify the chosen behavior against both toolchain cases; done means the setting has an observable, documented effect or is removed with its misleading warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.