From 47b1e6659bbb4a8f490e683a53f261b73f4f586d Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 18 Oct 2021 09:28:38 +0200 Subject: [PATCH 1/8] switch release channel to stable --- src/ci/channel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/channel b/src/ci/channel index 65b2df87f7df3..2bf5ad0447d33 100644 --- a/src/ci/channel +++ b/src/ci/channel @@ -1 +1 @@ -beta +stable From 3197652fbe20367c9acdda2f6878c56fd5a362ce Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 18 Oct 2021 09:34:09 +0200 Subject: [PATCH 2/8] bring updated release notes from master --- RELEASES.md | 188 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 185 insertions(+), 3 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index c0851a1506e13..52d823d8acac4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,185 @@ +Version 1.56.0 (2021-10-21) +======================== + +Language +-------- + +- [The 2021 Edition is now stable.][rust#88100] + See [the edition guide][rust-2021-edition-guide] for more details. +- [The pattern in `binding @ pattern` can now also introduce new bindings.][rust#85305] +- [Union field access is permitted in `const fn`.][rust#85769] + +[rust-2021-edition-guide]: https://doc.rust-lang.org/nightly/edition-guide/rust-2021/index.html + +Compiler +-------- + +- [Upgrade to LLVM 13.][rust#87570] +- [Support memory, address, and thread sanitizers on aarch64-unknown-freebsd.][rust#88023] +- [Allow specifying a deployment target version for all iOS targets][rust#87699] +- [Warnings can be forced on with `--force-warn`.][rust#87472] + This feature is primarily intended for usage by `cargo fix`, rather than end users. +- [Promote `aarch64-apple-ios-sim` to Tier 2\*.][rust#87760] +- [Add `powerpc-unknown-freebsd` at Tier 3\*.][rust#87370] +- [Add `riscv32imc-esp-espidf` at Tier 3\*.][rust#87666] + +\* Refer to Rust's [platform support page][platform-support-doc] for more +information on Rust's tiered platform support. + +Libraries +--------- + +- [Allow writing of incomplete UTF-8 sequences via stdout/stderr on Windows.][rust#83342] + The Windows console still requires valid Unicode, but this change allows + splitting a UTF-8 character across multiple write calls. This allows, for + instance, programs that just read and write data buffers (e.g. copying a file + to stdout) without regard for Unicode or character boundaries. +- [Prefer `AtomicU{64,128}` over Mutex for Instant backsliding protection.][rust#83093] + For this use case, atomics scale much better under contention. +- [Implement `Extend<(A, B)>` for `(Extend, Extend)`][rust#85835] +- [impl Default, Copy, Clone for std::io::Sink and std::io::Empty][rust#86744] +- [`impl From<[(K, V); N]>` for all collections.][rust#84111] +- [Remove `P: Unpin` bound on impl Future for Pin.][rust#81363] +- [Treat invalid environment variable names as non-existent.][rust#86183] + Previously, the environment functions would panic if given a variable name + with an internal null character or equal sign (`=`). Now, these functions will + just treat such names as non-existent variables, since the OS cannot represent + the existence of a variable with such a name. + +Stabilised APIs +--------------- + +- [`std::os::unix::fs::chroot`] +- [`UnsafeCell::raw_get`] +- [`BufWriter::into_parts`] +- [`core::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}`] + These APIs were previously stable in `std`, but are now also available in `core`. +- [`Vec::shrink_to`] +- [`String::shrink_to`] +- [`OsString::shrink_to`] +- [`PathBuf::shrink_to`] +- [`BinaryHeap::shrink_to`] +- [`VecDeque::shrink_to`] +- [`HashMap::shrink_to`] +- [`HashSet::shrink_to`] + +These APIs are now usable in const contexts: + +- [`std::mem::transmute`] +- [`[T]::first`][`slice::first`] +- [`[T]::split_first`][`slice::split_first`] +- [`[T]::last`][`slice::last`] +- [`[T]::split_last`][`slice::split_last`] + +Cargo +----- + +- [Cargo supports specifying a minimum supported Rust version in Cargo.toml.][`rust-version`] + This has no effect at present on dependency version selection. + We encourage crates to specify their minimum supported Rust version, and we encourage CI systems + that support Rust code to include a crate's specified minimum version in the text matrix for that + crate by default. + +Compatibility notes +------------------- + +- [Update to new argument parsing rules on Windows.][rust#87580] + This adjusts Rust's standard library to match the behavior of the standard + libraries for C/C++. The rules have changed slightly over time, and this PR + brings us to the latest set of rules (changed in 2008). +- [Disallow the aapcs calling convention on aarch64][rust#88399] + This was already not supported by LLVM; this change surfaces this lack of + support with a better error message. +- [Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default][rust#87385] +- [Warn when an escaped newline skips multiple lines.][rust#87671] +- [Calls to `libc::getpid` / `std::process::id` from `Command::pre_exec` + may return different values on glibc <= 2.24.][rust#81825] + Rust now invokes the `clone3` system call directly, when available, to use new functionality + available via that system call. Older versions of glibc cache the result of `getpid`, and only + update that cache when calling glibc's clone/fork functions, so a direct system call bypasses + that cache update. glibc 2.25 and newer no longer cache `getpid` for exactly this reason. + +Internal changes +---------------- +These changes provide no direct user facing benefits, but represent significant +improvements to the internals and overall performance of rustc +and related tools. + +- [LLVM is compiled with PGO in published x86_64-unknown-linux-gnu artifacts.][rust#88069] + This improves the performance of most Rust builds. +- [Unify representation of macros in internal data structures.][rust#88019] + This change fixes a host of bugs with the handling of macros by the compiler, + as well as rustdoc. + +[`std::os::unix::fs::chroot`]: https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chroot.html +[`Iterator::intersperse`]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.intersperse +[`Iterator::intersperse_with`]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.intersperse +[`UnsafeCell::raw_get`]: https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell.html#method.raw_get +[`BufWriter::into_parts`]: https://doc.rust-lang.org/stable/std/io/struct.BufWriter.html#method.into_parts +[`core::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}`]: https://github.com/rust-lang/rust/pull/84662 +[`Vec::shrink_to`]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.shrink_to +[`String::shrink_to`]: https://doc.rust-lang.org/stable/std/string/struct.String.html#method.shrink_to +[`OsString::shrink_to`]: https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.shrink_to +[`PathBuf::shrink_to`]: https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#method.shrink_to +[`BinaryHeap::shrink_to`]: https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html#method.shrink_to +[`VecDeque::shrink_to`]: https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.shrink_to +[`HashMap::shrink_to`]: https://doc.rust-lang.org/stable/std/collections/hash_map/struct.HashMap.html#method.shrink_to +[`HashSet::shrink_to`]: https://doc.rust-lang.org/stable/std/collections/hash_set/struct.HashSet.html#method.shrink_to +[`std::mem::transmute`]: https://doc.rust-lang.org/stable/std/mem/fn.transmute.html +[`slice::first`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.first +[`slice::split_first`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_first +[`slice::last`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.last +[`slice::split_last`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_last +[`rust-version`]: https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-rust-version-field +[rust#87671]: https://github.com/rust-lang/rust/pull/87671 +[rust#86183]: https://github.com/rust-lang/rust/pull/86183 +[rust#87385]: https://github.com/rust-lang/rust/pull/87385 +[rust#88100]: https://github.com/rust-lang/rust/pull/88100 +[rust#86860]: https://github.com/rust-lang/rust/pull/86860 +[rust#84039]: https://github.com/rust-lang/rust/pull/84039 +[rust#86492]: https://github.com/rust-lang/rust/pull/86492 +[rust#88363]: https://github.com/rust-lang/rust/pull/88363 +[rust#85305]: https://github.com/rust-lang/rust/pull/85305 +[rust#87832]: https://github.com/rust-lang/rust/pull/87832 +[rust#88069]: https://github.com/rust-lang/rust/pull/88069 +[rust#87472]: https://github.com/rust-lang/rust/pull/87472 +[rust#87699]: https://github.com/rust-lang/rust/pull/87699 +[rust#87570]: https://github.com/rust-lang/rust/pull/87570 +[rust#88023]: https://github.com/rust-lang/rust/pull/88023 +[rust#87760]: https://github.com/rust-lang/rust/pull/87760 +[rust#87370]: https://github.com/rust-lang/rust/pull/87370 +[rust#87580]: https://github.com/rust-lang/rust/pull/87580 +[rust#83342]: https://github.com/rust-lang/rust/pull/83342 +[rust#83093]: https://github.com/rust-lang/rust/pull/83093 +[rust#88177]: https://github.com/rust-lang/rust/pull/88177 +[rust#88548]: https://github.com/rust-lang/rust/pull/88548 +[rust#88551]: https://github.com/rust-lang/rust/pull/88551 +[rust#88299]: https://github.com/rust-lang/rust/pull/88299 +[rust#88220]: https://github.com/rust-lang/rust/pull/88220 +[rust#85835]: https://github.com/rust-lang/rust/pull/85835 +[rust#86879]: https://github.com/rust-lang/rust/pull/86879 +[rust#86744]: https://github.com/rust-lang/rust/pull/86744 +[rust#84662]: https://github.com/rust-lang/rust/pull/84662 +[rust#86593]: https://github.com/rust-lang/rust/pull/86593 +[rust#81050]: https://github.com/rust-lang/rust/pull/81050 +[rust#81363]: https://github.com/rust-lang/rust/pull/81363 +[rust#84111]: https://github.com/rust-lang/rust/pull/84111 +[rust#85769]: https://github.com/rust-lang/rust/pull/85769#issuecomment-854363720 +[rust#88490]: https://github.com/rust-lang/rust/pull/88490 +[rust#88269]: https://github.com/rust-lang/rust/pull/88269 +[rust#84176]: https://github.com/rust-lang/rust/pull/84176 +[rust#88399]: https://github.com/rust-lang/rust/pull/88399 +[rust#88227]: https://github.com/rust-lang/rust/pull/88227 +[rust#88200]: https://github.com/rust-lang/rust/pull/88200 +[rust#82776]: https://github.com/rust-lang/rust/pull/82776 +[rust#88077]: https://github.com/rust-lang/rust/pull/88077 +[rust#87728]: https://github.com/rust-lang/rust/pull/87728 +[rust#87050]: https://github.com/rust-lang/rust/pull/87050 +[rust#87619]: https://github.com/rust-lang/rust/pull/87619 +[rust#81825]: https://github.com/rust-lang/rust/pull/81825#issuecomment-808406918 +[rust#88019]: https://github.com/rust-lang/rust/pull/88019 +[rust#87666]: https://github.com/rust-lang/rust/pull/87666 + Version 1.55.0 (2021-09-09) ============================ @@ -4985,7 +5167,7 @@ Libraries - [Upgrade to Unicode 10.0.0][42999] - [Reimplemented `{f32, f64}::{min, max}` in Rust instead of using CMath.][42430] - [Skip the main thread's manual stack guard on Linux][43072] -- [Iterator::nth for `ops::{Range, RangeFrom}` is now done in O(1) time][43077] +- [Iterator::nth for `ops::{Range, RangeFrom}` is now done in *O*(1) time][43077] - [`#[repr(align(N))]` attribute max number is now 2^31 - 1.][43097] This was previously 2^15. - [`{OsStr, Path}::Display` now avoids allocations where possible][42613] @@ -8288,7 +8470,7 @@ Libraries algorithm][s]. * [`std::io::copy` allows `?Sized` arguments][cc]. * The `Windows`, `Chunks`, and `ChunksMut` iterators over slices all - [override `count`, `nth` and `last` with an O(1) + [override `count`, `nth` and `last` with an *O*(1) implementation][it]. * [`Default` is implemented for arrays up to `[T; 32]`][d]. * [`IntoRawFd` has been added to the Unix-specific prelude, @@ -8810,7 +8992,7 @@ Libraries * The `Default` implementation for `Arc` [no longer requires `Sync + Send`][arc]. * [The `Iterator` methods `count`, `nth`, and `last` have been - overridden for slices to have O(1) performance instead of O(n)][si]. + overridden for slices to have *O*(1) performance instead of *O*(*n*)][si]. * Incorrect handling of paths on Windows has been improved in both the compiler and the standard library. * [`AtomicPtr` gained a `Default` implementation][ap]. From aef5765479b7c7d3d44fc69c8126b2ef5052433f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Thu, 14 Oct 2021 01:50:37 +0200 Subject: [PATCH 3/8] Deduplicate macro_rules! from module_exports when documenting them This can append if within the same module a `#[macro_export] macro_rules!` is declared but also a reexport of itself producing two export of the same macro in the same module. In that case we only want to document it once. --- src/librustdoc/visit_ast.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 897b9140fc8bc..7182310b73a6e 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -86,13 +86,21 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // the rexport defines the path that a user will actually see. Accordingly, // we add the rexport as an item here, and then skip over the original // definition in `visit_item()` below. + // + // We also skip `#[macro_export] macro_rules!` that have alredy been inserted, + // this can append if within the same module a `#[macro_export] macro_rules!` + // is declared but also a reexport of itself producing two export of the same + // macro in the same module. + let mut inserted = FxHashSet::default(); for export in self.cx.tcx.module_exports(CRATE_DEF_ID).unwrap_or(&[]) { if let Res::Def(DefKind::Macro(_), def_id) = export.res { if let Some(local_def_id) = def_id.as_local() { if self.cx.tcx.has_attr(def_id, sym::macro_export) { - let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); - let item = self.cx.tcx.hir().expect_item(hir_id); - top_level_module.items.push((item, None)); + if !inserted.insert(def_id) { + let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); + let item = self.cx.tcx.hir().expect_item(hir_id); + top_level_module.items.push((item, None)); + } } } } From f96a40f4db06b81bd7eb9bde965e8835d06a0447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Thu, 14 Oct 2021 02:12:18 +0200 Subject: [PATCH 4/8] Add regression test for #89852 --- src/test/rustdoc-json/reexport/macro.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/rustdoc-json/reexport/macro.rs diff --git a/src/test/rustdoc-json/reexport/macro.rs b/src/test/rustdoc-json/reexport/macro.rs new file mode 100644 index 0000000000000..b86614ffbad68 --- /dev/null +++ b/src/test/rustdoc-json/reexport/macro.rs @@ -0,0 +1,17 @@ +// edition:2018 + +#![no_core] +#![feature(no_core)] + +// @count macro.json "$.index[*][?(@.name=='macro')].inner.items[*]" 2 + +// @set repro_id = macro.json "$.index[*][?(@.name=='repro')].id" +// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id +#[macro_export] +macro_rules! repro { + () => {}; +} + +// @set repro2_id = macro.json "$.index[*][?(@.inner.name=='repro2')].id" +// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro2_id +pub use crate::repro as repro2; From b5729387f315fe58431d56729d23b65a00071abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Thu, 14 Oct 2021 10:50:46 +0200 Subject: [PATCH 5/8] Oops, inverted condition, fix that --- src/librustdoc/visit_ast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 7182310b73a6e..8268f10db36ef 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -96,7 +96,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { if let Res::Def(DefKind::Macro(_), def_id) = export.res { if let Some(local_def_id) = def_id.as_local() { if self.cx.tcx.has_attr(def_id, sym::macro_export) { - if !inserted.insert(def_id) { + if inserted.insert(def_id) { let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); let item = self.cx.tcx.hir().expect_item(hir_id); top_level_module.items.push((item, None)); From e05ee65ac3598d47cf712b2f3585ee11720c92db Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 15 Oct 2021 12:21:25 +0200 Subject: [PATCH 6/8] Apply documentation suggestions from code review Co-authored-by: Guillaume Gomez --- src/librustdoc/visit_ast.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 8268f10db36ef..5082a14da2c39 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -87,9 +87,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // we add the rexport as an item here, and then skip over the original // definition in `visit_item()` below. // - // We also skip `#[macro_export] macro_rules!` that have alredy been inserted, - // this can append if within the same module a `#[macro_export] macro_rules!` - // is declared but also a reexport of itself producing two export of the same + // We also skip `#[macro_export] macro_rules!` that have already been inserted, + // it can happen if within the same module a `#[macro_export] macro_rules!` + // is declared but also a reexport of itself producing two exports of the same // macro in the same module. let mut inserted = FxHashSet::default(); for export in self.cx.tcx.module_exports(CRATE_DEF_ID).unwrap_or(&[]) { From 6307ecb63aedfd4d3bfc93d31b21cf6a7cd6cb84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Fri, 15 Oct 2021 12:56:47 +0200 Subject: [PATCH 7/8] Add equivalent test in src/test/rustdoc --- src/test/rustdoc/issue-89852.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/test/rustdoc/issue-89852.rs diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs new file mode 100644 index 0000000000000..dff2d07ac2537 --- /dev/null +++ b/src/test/rustdoc/issue-89852.rs @@ -0,0 +1,14 @@ +// edition:2018 + +#![no_core] +#![feature(no_core)] + +// @count issue_89852/index.html '//*[@class="macro"]' 2 +// @has - '//*[@class="macro"]/@href' 'macro.repro.html' +#[macro_export] +macro_rules! repro { + () => {}; +} + +// @!has issue_89852/macro.repro.html '//*[@class="macro"]/@content' 'repro2' +pub use crate::repro as repro2; From 7b9189aef301bd0e6cb2ec50835d3ce15eee051f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Fri, 15 Oct 2021 16:54:31 +0200 Subject: [PATCH 8/8] Rework the equivalent test to work with sidebar-items.js --- src/test/rustdoc/issue-89852.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs index dff2d07ac2537..45544dbeea6a0 100644 --- a/src/test/rustdoc/issue-89852.rs +++ b/src/test/rustdoc/issue-89852.rs @@ -3,12 +3,12 @@ #![no_core] #![feature(no_core)] -// @count issue_89852/index.html '//*[@class="macro"]' 2 -// @has - '//*[@class="macro"]/@href' 'macro.repro.html' +// @matches 'issue_89852/sidebar-items.js' '"repro"' +// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' + #[macro_export] macro_rules! repro { () => {}; } -// @!has issue_89852/macro.repro.html '//*[@class="macro"]/@content' 'repro2' pub use crate::repro as repro2;