From 0c2f4359fdb8c556af298e835d3828d7c0b4e658 Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Sat, 28 Dec 2024 22:21:04 -0500 Subject: [PATCH 1/4] Fix sentence fragment in `pin` module docs Looks like this was inadvertently dropped in 8241ca60. Restore the words from before that commit. --- library/core/src/pin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index f18a45083ff7e..83730285636fb 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -595,7 +595,7 @@ //! [drop-impl]: self#implementing-drop-for-types-with-address-sensitive-states //! //! The [`drop`] function takes [`&mut self`], but this is called *even if that `self` has been -//! pinned*! Implementing [`Drop`] for a type with address-sensitive states, because if `self` was +//! pinned*! Implementing [`Drop`] for a type with address-sensitive states requires some care, because if `self` was //! indeed in an address-sensitive state before [`drop`] was called, it is as if the compiler //! automatically called [`Pin::get_unchecked_mut`]. //! From 4f8bebd6b55e0a2986be81e50e3851a3ba973edf Mon Sep 17 00:00:00 2001 From: calciumbe <192480234+calciumbe@users.noreply.github.com> Date: Sun, 29 Dec 2024 18:03:37 +0800 Subject: [PATCH 2/4] fix: typos Signed-off-by: calciumbe <192480234+calciumbe@users.noreply.github.com> --- compiler/rustc_parse/src/parser/diagnostics.rs | 2 +- library/alloc/src/raw_vec.rs | 2 +- library/std/src/thread/current.rs | 2 +- src/doc/rustc/src/platform-support/android.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index aab4e1b1afc1b..278cde5d560f7 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -755,7 +755,7 @@ impl<'a> Parser<'a> { // When there are a few keywords in the last ten elements of `self.expected_token_types` // and the current token is an identifier, it's probably a misspelled keyword. This handles // code like `async Move {}`, misspelled `if` in match guard, misspelled `else` in - // `if`-`else` and mispelled `where` in a where clause. + // `if`-`else` and misspelled `where` in a where clause. if !expected_keywords.is_empty() && !curr_ident.is_used_keyword() && let Some(misspelled_kw) = find_similar_kw(curr_ident, &expected_keywords) diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs index 2c7cdcf0cfb4e..e93ff2f902378 100644 --- a/library/alloc/src/raw_vec.rs +++ b/library/alloc/src/raw_vec.rs @@ -420,7 +420,7 @@ impl RawVecInner { match Self::try_allocate_in(capacity, AllocInit::Uninitialized, alloc, elem_layout) { Ok(this) => { unsafe { - // Make it more obvious that a subsquent Vec::reserve(capacity) will not allocate. + // Make it more obvious that a subsequent Vec::reserve(capacity) will not allocate. hint::assert_unchecked(!this.needs_to_grow(0, capacity, elem_layout)); } this diff --git a/library/std/src/thread/current.rs b/library/std/src/thread/current.rs index 1048ef973560e..3d2c288b36085 100644 --- a/library/std/src/thread/current.rs +++ b/library/std/src/thread/current.rs @@ -136,7 +136,7 @@ pub(crate) fn set_current(thread: Thread) -> Result<(), Thread> { /// one thread and is guaranteed not to call the global allocator. #[inline] pub(crate) fn current_id() -> ThreadId { - // If accessing the persistant thread ID takes multiple TLS accesses, try + // If accessing the persistent thread ID takes multiple TLS accesses, try // to retrieve it from the current thread handle, which will only take one // TLS access. if !id::CHEAP { diff --git a/src/doc/rustc/src/platform-support/android.md b/src/doc/rustc/src/platform-support/android.md index 96499b0d80148..54e7ddca32aab 100644 --- a/src/doc/rustc/src/platform-support/android.md +++ b/src/doc/rustc/src/platform-support/android.md @@ -65,4 +65,4 @@ Currently the `riscv64-linux-android` target requires the following architecture ### aarch64-linux-android on Nightly compilers As soon as `-Zfixed-x18` compiler flag is supplied, the [`ShadowCallStack` sanitizer](https://releases.llvm.org/7.0.1/tools/clang/docs/ShadowCallStack.html) -instrumentation is also made avaiable by supplying the second compiler flag `-Zsanitizer=shadow-call-stack`. +instrumentation is also made available by supplying the second compiler flag `-Zsanitizer=shadow-call-stack`. From dab1c57723d4ab53b9279801f6a27db94bdec98a Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 29 Dec 2024 08:02:40 -0600 Subject: [PATCH 3/4] Added codegen test for elidings bounds check when indexes are manually checked Closes #55147 --- tests/codegen/slice-indexing.rs | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/codegen/slice-indexing.rs b/tests/codegen/slice-indexing.rs index 3d284148db22e..75112bb0c24e5 100644 --- a/tests/codegen/slice-indexing.rs +++ b/tests/codegen/slice-indexing.rs @@ -60,3 +60,40 @@ pub unsafe fn str_get_unchecked_mut_by_range(x: &mut str, r: Range) -> &m // CHECK: sub nuw i64 x.get_unchecked_mut(r) } + +// CHECK-LABEL: @slice_repeated_indexing( +#[no_mangle] +pub fn slice_repeated_indexing(dst: &mut [u8], offset: usize) { + let mut i = offset; + // CHECK: panic_bounds_check + dst[i] = 1; + i += 1; + // CHECK: panic_bounds_check + dst[i] = 2; + i += 1; + // CHECK: panic_bounds_check + dst[i] = 3; + i += 1; + // CHECK: panic_bounds_check + dst[i] = 4; +} + +// CHECK-LABEL: @slice_repeated_indexing_coalesced( +#[no_mangle] +pub fn slice_repeated_indexing_coalesced(dst: &mut [u8], offset: usize) { + let mut i = offset; + if i.checked_add(4).unwrap() <= dst.len() { + // CHECK-NOT: panic_bounds_check + dst[i] = 1; + i += 1; + // CHECK-NOT: panic_bounds_check + dst[i] = 2; + i += 1; + // CHECK-NOT: panic_bounds_check + dst[i] = 3; + i += 1; + // CHECK-NOT: panic_bounds_check + dst[i] = 4; + } + // CHECK: ret +} From 9007cb15e4cd5abece667f42ea89bc9ed45bc3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 29 Dec 2024 18:02:14 +0100 Subject: [PATCH 4/4] Document how to run the split Docker pipelines --- src/ci/docker/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 2f35e60502622..508b7b40c01e4 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -26,6 +26,12 @@ DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu while locally, to the `obj/$image_name` directory. This is primarily to prevent strange linker errors when using multiple Docker images. +For some Linux workflows (for example `x86_64-gnu-llvm-18-N`), the process is more involved. You will need to see which script is executed for the given workflow inside the [`jobs.yml`](../github-actions/jobs.yml) file and pass it through the `DOCKER_SCRIPT` environment variable. For example, to reproduce the `x86_64-gnu-llvm-18-3` workflow, you can run the following script: + +``` +DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-18 +``` + ## Local Development Refer to the [dev guide](https://rustc-dev-guide.rust-lang.org/tests/docker.html) for more information on testing locally.