Skip to content

Commit

Permalink
Auto merge of #98572 - pietroalbini:pa-1.63.0-beta, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
[beta] Prepare beta 1.63.0

This PR switches the channel of `beta` after the force-push, and backports the following PRs:

*  #98488
*  #98412

r? `@ghost`
  • Loading branch information
bors committed Jun 28, 2022
2 parents fdca237 + 1445c6c commit 6c1f142
Show file tree
Hide file tree
Showing 43 changed files with 538 additions and 11,638 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3101,7 +3101,6 @@ name = "racer"
version = "2.2.2"
dependencies = [
"bitflags",
"clap 2.34.0",
"derive_more",
"env_logger 0.7.1",
"humantime 2.0.1",
Expand Down Expand Up @@ -3325,7 +3324,7 @@ dependencies = [
"difference",
"env_logger 0.9.0",
"futures 0.3.19",
"heck 0.3.1",
"heck 0.4.0",
"home",
"itertools",
"jsonrpc-core",
Expand Down Expand Up @@ -4712,7 +4711,7 @@ dependencies = [

[[package]]
name = "rustfmt-nightly"
version = "1.5.0"
version = "1.5.1"
dependencies = [
"annotate-snippets 0.9.1",
"anyhow",
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ def bootstrap(help_triggered):
env = os.environ.copy()
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable
env["RUSTC_BOOTSTRAP"] = '1'
run(args, env=env, verbose=build.verbose, is_bootstrap=True)


Expand Down
2 changes: 1 addition & 1 deletion src/ci/channel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly
beta
14 changes: 2 additions & 12 deletions src/tools/rustfmt/.github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,5 @@ jobs:
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.target }}
- name: build
run: |
rustc -Vv
cargo -V
cargo build
env:
RUSTFLAGS: '-D warnings'

- name: test
run: cargo test
env:
RUSTFLAGS: '-D warnings'
- name: Build and Test
run: ./ci/build_and_test.sh
10 changes: 2 additions & 8 deletions src/tools/rustfmt/.github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,5 @@ jobs:
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.target }}
- name: build
run: |
rustc -Vv
cargo -V
cargo build
- name: test
run: cargo test
- name: Build and Test
run: ./ci/build_and_test.sh
11 changes: 2 additions & 9 deletions src/tools/rustfmt/.github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ jobs:
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
shell: bash

- name: build
run: |
rustc -Vv
cargo -V
cargo build
shell: cmd

- name: test
run: cargo test
- name: Build and Test
shell: cmd
run: ci\build_and_test.bat
26 changes: 24 additions & 2 deletions src/tools/rustfmt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,29 @@

## [Unreleased]

## [1.5.0] 2022-06-13
## [1.5.1] 2022-06-24

**N.B** A bug was introduced in v1.5.0/nightly-2022-06-15 which modified formatting. If you happened to run rustfmt over your code with one of those ~10 nightlies it's possible you may have seen formatting changes, and you may see additional changes after this fix since that bug has now been reverted.

### Fixed

- Correct an issue introduced in v1.5.0 where formatting changes were unintentionally introduced in a few cases with a large/long construct in a right hand side position (e.g. a large chain on the RHS of a local/assignment statement)
- `cargo fmt --version` properly displays the version value again [#5395](https://github.com/rust-lang/rustfmt/issues/5395)

### Changed

- Properly sort imports containing raw identifiers [#3791](https://github.com/rust-lang/rustfmt/issues/3791) (note this is change version gated, and not applied by default)

### Added

- Add new configuration option, `doc_comment_code_block_width`, which allows for setting a shorter width limit to use for formatting code snippets in doc comments [#5384](https://github.com/rust-lang/rustfmt/issues/5384)

### Install/Download Options
- **rustup (nightly)** - nightly-2022-06-24
- **GitHub Release Binaries** - [Release v1.5.1](https://github.com/rust-lang/rustfmt/releases/tag/v1.5.0)
- **Build from source** - [Tag v1.5.1](https://github.com/rust-lang/rustfmt/tree/v1.5.1), see instructions for how to [install rustfmt from source][install-from-source]

## [1.5.0] 2022-06-14

### Changed

Expand Down Expand Up @@ -75,7 +97,7 @@
- Improved performance when formatting large and deeply nested expression trees, often found in generated code, which have many expressions that exceed `max_width` [#5128](https://github.com/rust-lang/rustfmt/issues/5128), [#4867](https://github.com/rust-lang/rustfmt/issues/4867), [#4476](https://github.com/rust-lang/rustfmt/issues/4476), [#5139](https://github.com/rust-lang/rustfmt/pull/5139)

### Install/Download Options
- **rustup (nightly)** - *pending*
- **rustup (nightly)** - nightly-2022-06-15
- **GitHub Release Binaries** - [Release v1.5.0](https://github.com/rust-lang/rustfmt/releases/tag/v1.5.0)
- **Build from source** - [Tag v1.5.0](https://github.com/rust-lang/rustfmt/tree/v1.5.0), see instructions for how to [install rustfmt from source][install-from-source]

Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ dependencies = [

[[package]]
name = "rustfmt-nightly"
version = "1.5.0"
version = "1.5.1"
dependencies = [
"annotate-snippets",
"anyhow",
Expand Down
6 changes: 5 additions & 1 deletion src/tools/rustfmt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "rustfmt-nightly"
version = "1.5.0"
version = "1.5.1"
description = "Tool to find and fix Rust formatting issues"
repository = "https://github.com/rust-lang/rustfmt"
readme = "README.md"
Expand Down Expand Up @@ -65,3 +65,7 @@ rustfmt-config_proc_macro = { version = "0.2", path = "config_proc_macro" }
rustc-workspace-hack = "1.0.0"

# Rustc dependencies are loaded from the sysroot, Cargo doesn't know about them.

[package.metadata.rust-analyzer]
# This package uses #[feature(rustc_private)]
rustc_private = true
8 changes: 8 additions & 0 deletions src/tools/rustfmt/Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,14 @@ fn add_one(x: i32) -> i32 {
}
```

## `doc_comment_code_block_width`

Max width for code snippets included in doc comments. Only used if [`format_code_in_doc_comments`](#format_code_in_doc_comments) is true.

- **Default value**: `100`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: No (tracking issue: [#5359](https://github.com/rust-lang/rustfmt/issues/5359))

## `format_generated_files`

Format generated files. A file is considered generated
Expand Down
14 changes: 14 additions & 0 deletions src/tools/rustfmt/ci/build_and_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set "RUSTFLAGS=-D warnings"

:: Print version information
rustc -Vv || exit /b 1
cargo -V || exit /b 1

:: Build and test main crate
cargo build --locked || exit /b 1
cargo test || exit /b 1

:: Build and test other crates
cd config_proc_macro || exit /b 1
cargo build --locked || exit /b 1
cargo test || exit /b 1
18 changes: 18 additions & 0 deletions src/tools/rustfmt/ci/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euo pipefail

export RUSTFLAGS="-D warnings"

# Print version information
rustc -Vv
cargo -V

# Build and test main crate
cargo build --locked
cargo test

# Build and test other crates
cd config_proc_macro
cargo build --locked
cargo test
2 changes: 1 addition & 1 deletion src/tools/rustfmt/ci/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -ex
# it again.
#
#which cargo-fmt || cargo install --force
CFG_RELEASE=nightly CFG_RELEASE_CHANNEL=nightly cargo install --path . --force
CFG_RELEASE=nightly CFG_RELEASE_CHANNEL=nightly cargo install --path . --force --locked

echo "Integration tests for: ${INTEGRATION}"
cargo fmt -- --version
Expand Down
44 changes: 22 additions & 22 deletions src/tools/rustfmt/config_proc_macro/Cargo.lock
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "proc-macro2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid",
]

[[package]]
name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
]

[[package]]
name = "rustfmt-config_proc_macro"
version = "0.1.2"
version = "0.2.0"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
"quote",
"serde",
"syn",
]

[[package]]
name = "serde"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
dependencies = [
"serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "syn"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
"quote",
"unicode-xid",
]

[[package]]
name = "unicode-xid"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[metadata]
"checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
4 changes: 4 additions & 0 deletions src/tools/rustfmt/config_proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub fn config_type(_args: TokenStream, input: TokenStream) -> TokenStream {
/// Used to conditionally output the TokenStream for tests that need to be run on nightly only.
///
/// ```rust
/// # use rustfmt_config_proc_macro::nightly_only_test;
///
/// #[nightly_only_test]
/// #[test]
/// fn test_needs_nightly_rustfmt() {
Expand All @@ -49,6 +51,8 @@ pub fn nightly_only_test(_args: TokenStream, input: TokenStream) -> TokenStream
/// Used to conditionally output the TokenStream for tests that need to be run on stable only.
///
/// ```rust
/// # use rustfmt_config_proc_macro::stable_only_test;
///
/// #[stable_only_test]
/// #[test]
/// fn test_needs_stable_rustfmt() {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2022-06-06"
channel = "nightly-2022-06-21"
components = ["rustc-dev"]
3 changes: 2 additions & 1 deletion src/tools/rustfmt/src/cargo-fmt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::str;

use clap::{CommandFactory, Parser};
use clap::{AppSettings, CommandFactory, Parser};

#[path = "test/mod.rs"]
#[cfg(test)]
mod cargo_fmt_tests;

#[derive(Parser)]
#[clap(
global_setting(AppSettings::NoAutoVersion),
bin_name = "cargo fmt",
about = "This utility formats all bin and lib files of \
the current crate using rustfmt."
Expand Down
4 changes: 4 additions & 0 deletions src/tools/rustfmt/src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,10 @@ impl<'a> CommentRewrite<'a> {
{
let mut config = self.fmt.config.clone();
config.set().wrap_comments(false);
let comment_max_width = config
.doc_comment_code_block_width()
.min(config.max_width());
config.set().max_width(comment_max_width);
if let Some(s) =
crate::format_code_block(&self.code_block_buffer, &config, false)
{
Expand Down
3 changes: 3 additions & 0 deletions src/tools/rustfmt/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ create_config! {
// Comments. macros, and strings
wrap_comments: bool, false, false, "Break comments to fit on the line";
format_code_in_doc_comments: bool, false, false, "Format the code snippet in doc comments.";
doc_comment_code_block_width: usize, 100, false, "Maximum width for code snippets in doc \
comments. No effect unless format_code_in_doc_comments = true";
comment_width: usize, 80, false,
"Maximum length of comments. No effect unless wrap_comments = true";
normalize_comments: bool, false, false, "Convert /* */ comments to // comments where possible";
Expand Down Expand Up @@ -532,6 +534,7 @@ chain_width = 60
single_line_if_else_max_width = 50
wrap_comments = false
format_code_in_doc_comments = false
doc_comment_code_block_width = 100
comment_width = 80
normalize_comments = false
normalize_doc_attributes = false
Expand Down
Loading

0 comments on commit 6c1f142

Please sign in to comment.