From e41bb97c253bf99a33ee077578d876d3d6b94148 Mon Sep 17 00:00:00 2001 From: Ryan Lopopolo Date: Sun, 3 Oct 2021 20:59:54 -0700 Subject: [PATCH 1/8] Add `#[repr(i8)]` to `Ordering` Followup to #89491 to allow `Ordering` to auto-derive `AsRepr` once the proposal to add `AsRepr` (#81642) lands. --- library/core/src/cmp.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 5ac9fdec0cf58..7456f886ea5d8 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -323,6 +323,7 @@ pub struct AssertParamIsEq { /// ``` #[derive(Clone, Copy, PartialEq, Debug, Hash)] #[stable(feature = "rust1", since = "1.0.0")] +#[repr(i8)] pub enum Ordering { /// An ordering where a compared value is less than another. #[stable(feature = "rust1", since = "1.0.0")] From 8514b0097b28f84ee5cfead059a5771c6a693fb0 Mon Sep 17 00:00:00 2001 From: Hans Kratz Date: Wed, 13 Oct 2021 17:44:39 +0200 Subject: [PATCH 2/8] Selecting the Xcode version no longer needed with the macos-11 runners. --- .github/workflows/ci.yml | 10 ---------- src/ci/github-actions/ci.yml | 5 ----- src/ci/scripts/select-xcode.sh | 13 ------------- 3 files changed, 28 deletions(-) delete mode 100755 src/ci/scripts/select-xcode.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78ff874e75501..d921286ba3489 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,9 +92,6 @@ jobs: - name: install sccache run: src/ci/scripts/install-sccache.sh if: success() && !env.SKIP_JOB - - name: select Xcode - run: src/ci/scripts/select-xcode.sh - if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh if: success() && !env.SKIP_JOB @@ -322,7 +319,6 @@ jobs: SCRIPT: "./x.py dist --stage 2" RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false" RUSTC_RETRY_LINKER_ON_SEGFAULT: 1 - SELECT_XCODE: /Applications/Xcode_12.2.app USE_XCODE_CLANG: 1 MACOSX_DEPLOYMENT_TARGET: 11.0 MACOSX_STD_DEPLOYMENT_TARGET: 11.0 @@ -467,9 +463,6 @@ jobs: - name: install sccache run: src/ci/scripts/install-sccache.sh if: success() && !env.SKIP_JOB - - name: select Xcode - run: src/ci/scripts/select-xcode.sh - if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh if: success() && !env.SKIP_JOB @@ -580,9 +573,6 @@ jobs: - name: install sccache run: src/ci/scripts/install-sccache.sh if: success() && !env.SKIP_JOB - - name: select Xcode - run: src/ci/scripts/select-xcode.sh - if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh if: success() && !env.SKIP_JOB diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index c9f8692d41887..eb16cf3c7620a 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -153,10 +153,6 @@ x--expand-yaml-anchors--remove: run: src/ci/scripts/install-sccache.sh <<: *step - - name: select Xcode - run: src/ci/scripts/select-xcode.sh - <<: *step - - name: install clang run: src/ci/scripts/install-clang.sh <<: *step @@ -498,7 +494,6 @@ jobs: --set rust.jemalloc --set llvm.ninja=false RUSTC_RETRY_LINKER_ON_SEGFAULT: 1 - SELECT_XCODE: /Applications/Xcode_12.2.app USE_XCODE_CLANG: 1 MACOSX_DEPLOYMENT_TARGET: 11.0 MACOSX_STD_DEPLOYMENT_TARGET: 11.0 diff --git a/src/ci/scripts/select-xcode.sh b/src/ci/scripts/select-xcode.sh deleted file mode 100755 index 3b9c77d42ba5f..0000000000000 --- a/src/ci/scripts/select-xcode.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# This script selects the Xcode instance to use. - -set -euo pipefail -IFS=$'\n\t' - -source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" - -if isMacOS; then - if [[ -s "${SELECT_XCODE-}" ]]; then - sudo xcode-select -s "${SELECT_XCODE}" - fi -fi From 5125b1a5c0a661f13a408e7864c05a97d1c40ce5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 14 Oct 2021 10:12:15 -0700 Subject: [PATCH 3/8] Update the wasi-libc built with the wasm32-wasi target This commit updates the wasi-libc that we include with the wasm32-wasi target, which brings in various misc fixes such as musl updates and some math tweaks. --- .../docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh index 82d0f7dc471e8..9bd56394eafc6 100755 --- a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh +++ b/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh @@ -10,7 +10,7 @@ export PATH=`pwd`/clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04/bin:$PATH git clone /~https://github.com/WebAssembly/wasi-libc cd wasi-libc -git reset --hard 58795582905e08fa7748846c1971b4ab911d1e16 +git reset --hard ad5133410f66b93a2381db5b542aad5e0964db96 make -j$(nproc) INSTALL_DIR=/wasm32-wasi install cd .. From 00dba3a6938fb996b5d3b7f67823fc5272b38f59 Mon Sep 17 00:00:00 2001 From: woppopo Date: Sun, 17 Oct 2021 00:02:42 +0900 Subject: [PATCH 4/8] Make Option::as_mut const --- library/core/src/option.rs | 3 ++- library/core/tests/option.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 401267f5613ee..885058321589c 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -646,7 +646,8 @@ impl Option { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn as_mut(&mut self) -> Option<&mut T> { + #[rustc_const_unstable(feature = "const_option", issue = "67441")] + pub const fn as_mut(&mut self) -> Option<&mut T> { match *self { Some(ref mut x) => Some(x), None => None, diff --git a/library/core/tests/option.rs b/library/core/tests/option.rs index 8995f96b1238a..c9508c145258c 100644 --- a/library/core/tests/option.rs +++ b/library/core/tests/option.rs @@ -380,6 +380,14 @@ const fn option_const_mut() { let _take = option.take(); let _replace = option.replace(42); + + { + let as_mut = option.as_mut(); + match as_mut { + Some(v) => *v = 32, + None => unreachable!(), + } + } } #[test] From d1f7608699e07e345caf4188ecbf415914c3241b Mon Sep 17 00:00:00 2001 From: woppopo Date: Sun, 17 Oct 2021 00:32:01 +0900 Subject: [PATCH 5/8] Add `#![cfg_attr(bootstrap, feature(const_panic))]` to `library/core/tests/lib.rs` --- library/core/tests/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 3608853dce4e0..cf669163d3ef2 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -10,6 +10,7 @@ #![feature(const_assume)] #![feature(const_cell_into_inner)] #![feature(const_maybe_uninit_assume_init)] +#![cfg_attr(bootstrap, feature(const_panic))] #![feature(const_ptr_read)] #![feature(const_ptr_write)] #![feature(const_ptr_offset)] From c645d3f3b99da97b802b1c757fcd1a3c21c84e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 16 Oct 2021 10:18:17 +0200 Subject: [PATCH 6/8] clippy::complexity changes --- compiler/rustc_expand/src/config.rs | 2 +- compiler/rustc_middle/src/mir/interpret/allocation.rs | 6 +++--- compiler/rustc_resolve/src/diagnostics.rs | 2 +- src/librustdoc/html/markdown.rs | 2 +- src/librustdoc/visit_ast.rs | 8 +++----- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 38c099fa4f59c..1b123520961a6 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -171,7 +171,7 @@ fn get_features( } if let Some(allowed) = sess.opts.debugging_opts.allow_features.as_ref() { - if allowed.iter().find(|&f| name.as_str() == *f).is_none() { + if allowed.iter().all(|f| name.as_str() != *f) { struct_span_err!( span_handler, mi.span(), diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index b6358f9929448..a36c9b6ed7304 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -1004,13 +1004,13 @@ impl Allocation { /// Checks that a range of bytes is initialized. If not, returns the `InvalidUninitBytes` /// error which will report the first range of bytes which is uninitialized. fn check_init(&self, range: AllocRange) -> AllocResult { - self.is_init(range).or_else(|idx_range| { - Err(AllocError::InvalidUninitBytes(Some(UninitBytesAccess { + self.is_init(range).map_err(|idx_range| { + AllocError::InvalidUninitBytes(Some(UninitBytesAccess { access_offset: range.start, access_size: range.size, uninit_offset: idx_range.start, uninit_size: idx_range.end - idx_range.start, // `Size` subtraction - }))) + })) }) } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index e3970038a33b0..05675e086d777 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1837,7 +1837,7 @@ crate fn show_candidates( .skip(1) .all(|(_, descr, _)| descr == descr_first) { - format!("{}", descr_first) + descr_first.to_string() } else { "item".to_string() }; diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 9f2e282fce1c3..c46439b851050 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -765,7 +765,7 @@ crate fn find_testable_code( // If there are characters between the preceding line ending and // this code block, `str::lines` will return an additional line, // which we subtract here. - if nb_lines != 0 && !&doc[prev_offset..offset.start].ends_with("\n") { + if nb_lines != 0 && !&doc[prev_offset..offset.start].ends_with('\n') { nb_lines -= 1; } let line = tests.get_line() + nb_lines + 1; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 36b1a14f6c1ea..b13ab64011dc1 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -113,11 +113,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { .unwrap_or(&[]) .iter() .filter_map(|attr| { - Some( - Cfg::parse(attr.meta_item()?) - .map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg)) - .ok()?, - ) + Cfg::parse(attr.meta_item()?) + .map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg)) + .ok() }) .collect::>() }) From 7bad85e815346dfbfabab8179a941b6f4031ea91 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 15 Oct 2021 21:37:31 +0200 Subject: [PATCH 7/8] Remove FIXME since there is nothing to be fixed. The errors are deduplicated when displayed to users. They only appear multiple times in UI tests. --- src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs index 3ad56aebc21c5..e58bba6405853 100644 --- a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs +++ b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs @@ -11,7 +11,6 @@ impl Struct { pub const AssocConst: Self::AssocTy = 42; //~^ ERROR ambiguous associated type //~| HELP use fully-qualified syntax - // FIXME: for some reason, the error is shown twice with rustdoc but only once with rustc //~| ERROR ambiguous associated type //~| HELP use fully-qualified syntax } From 2b3685a6cb286149e50d49f9da455804320b0cb9 Mon Sep 17 00:00:00 2001 From: nhamovitz <18648574+nhamovitz@users.noreply.github.com> Date: Sat, 16 Oct 2021 13:36:05 -0700 Subject: [PATCH 8/8] Correct typo --- compiler/rustc_attr/src/builtin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index 8d7f2b65c5a82..719caaabbbf0a 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -802,7 +802,7 @@ impl IntType { /// Valid repr contents: any of the primitive integral type names (see /// `int_type_of_word`, below) to specify enum discriminant type; `C`, to use /// the same discriminant size that the corresponding C enum would or C -/// structure layout, `packed` to remove padding, and `transparent` to elegate representation +/// structure layout, `packed` to remove padding, and `transparent` to delegate representation /// concerns to the only non-ZST field. pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec { use ReprAttr::*;