Skip to content

Fix the documentation of the unstable_features option. #5647

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ reorder_imports = false
```

Each configuration option is either stable or unstable.
Stable options can always be used, while unstable options are only available on a nightly toolchain and must be opted into.
To enable unstable options, set `unstable_features = true` in `rustfmt.toml` or pass `--unstable-features` to rustfmt.
Stable options can always be used, while unstable options are only available on a nightly toolchain.

# Configuration Options

Expand Down Expand Up @@ -2734,7 +2733,7 @@ fn lorem<Ipsum: Dolor+Sit=Amet>() {

## `unstable_features`

Enable unstable features on the unstable channel.
**Deperacted and ignored.** Formerly used to enable unstable features on the unstable channel. Unstable features are now activated regardless of whether this option is present or not.
Comment on lines -2737 to +2736
Copy link
Contributor

Choose a reason for hiding this comment

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

I did some digging and it turns out that the --unstable_features flag turns on whether or not you can pass --skip-children, --error-on-unformatted or --file-lines via the command line. Here's the reference in the source code

Try running: rustfmt +nightly --skip-children --error-on-unformatted --file-lines "[]" and you'll get the following output:

Unstable options (`--skip-children`, `--error-on-unformatted`, `--file-lines`) used without `--unstable-features`

Also note the (unstable) output for these options using of rustfmt +nightly --help (emphasis with '*' added by me):

        --file-lines JSON
                        Format specified line ranges. Run with
                        `--help=file-lines` for more detail **(unstable)**.
        --error-on-unformatted 
                        Error if unable to get comments or string literals
                        within max_width, or they are left with trailing
                        whitespaces **(unstable)**.
        --skip-children 
                        Don't reformat child modules **(unstable)**.

Trying to run rustfmt +stable --skip-children, rustfmt +stable --error-on-unformatted, or rustfmt +stable --file-lines "[]" results in an error because these options are only added to the command line interface on nightly :

Unrecognized option: 'skip-children'
Unrecognized option: 'error-on-unformatted'
Unrecognized option: 'file-lines'


- **Default value**: `false`
- **Possible values**: `true`, `false`
Expand Down