Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
824cc42
[AIX] update linker default to bcdtors
daltenty Apr 13, 2026
c81ff33
Add test demonstrating a bug in `ChunkedBitSet::subtract`.
nnethercote Apr 16, 2026
3f9dbf2
Fix bug in `ChunkedBitSet::subtract`.
nnethercote Apr 16, 2026
9854d7e
tests: mark migrated UI tests as check-pass
SynapLink Apr 26, 2026
34e1e17
Don't reload length in String::push
DaniPopes Apr 26, 2026
49a490e
enable pipe tests in Miri
RalfJung Apr 27, 2026
612afd1
Add regression test
pluiee Apr 27, 2026
d7184b7
tests: remove obsolete class attribute tests
SynapLink Apr 27, 2026
b7424ba
slice::join: borrow only once during length calc
ChrisDenton Apr 27, 2026
04874be
Adjust diagnostic items for mpmc/mpsc Receiver and Sender
cammeresi Apr 27, 2026
cf8a60c
Update LLVM to 22.1.4
dianqk Apr 22, 2026
4c59213
Rollup merge of #155381 - nnethercote:fix-ChunkedBitSet-subtract, r=Z…
jhpratt Apr 28, 2026
8985f1f
Rollup merge of #155847 - DaniPopes:string-push-len, r=jhpratt
jhpratt Apr 28, 2026
06fa547
Rollup merge of #155858 - ChrisDenton:borrowed-len, r=jhpratt
jhpratt Apr 28, 2026
1952c34
Rollup merge of #155879 - RalfJung:miri-pipes, r=jhpratt
jhpratt Apr 28, 2026
ca98fe1
Rollup merge of #155905 - dianqk:update-llvm, r=nikic
jhpratt Apr 28, 2026
0611bfc
Rollup merge of #155247 - daltenty:daltenty/bcdtors, r=davidtwco
jhpratt Apr 28, 2026
5216be3
Rollup merge of #155812 - SynapLink:codex/check-pass-fixme-62277, r=p…
jhpratt Apr 28, 2026
f4d64bd
Rollup merge of #155854 - cammeresi:20260426-receiver-diag, r=mejrs
jhpratt Apr 28, 2026
8759017
Rollup merge of #155882 - pluiee:pluiee/101363-test, r=mu001999
jhpratt Apr 28, 2026
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
13 changes: 8 additions & 5 deletions compiler/rustc_index/src/bit_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,13 +833,16 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
changed = true;
let num_words = num_words(*chunk_domain_size as usize);
debug_assert!(num_words > 0 && num_words <= CHUNK_WORDS);
let mut tail_mask =
1 << (*chunk_domain_size - ((num_words - 1) * WORD_BITS) as u16) - 1;
// Set `self_chunk_words` to `other_chunk_words`, then invert all bits and
// clear any excess bits in the final word.
let mut self_chunk_words = **other_chunk_words;
for word in self_chunk_words[0..num_words].iter_mut().rev() {
*word = !*word & tail_mask;
tail_mask = Word::MAX;
for word in self_chunk_words[0..num_words].iter_mut() {
*word = !*word;
}
clear_excess_bits_in_final_word(
*chunk_domain_size as usize,
&mut self_chunk_words[..num_words],
);
let self_chunk_ones_count = *chunk_domain_size - *other_chunk_ones_count;
debug_assert_eq!(
self_chunk_ones_count,
Expand Down
27 changes: 27 additions & 0 deletions compiler/rustc_index/src/bit_set/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,33 @@ fn chunked_bitset() {
assert_eq!(b10000.count(), 6000);
b10000.assert_valid();
b10000b.assert_valid();

//-----------------------------------------------------------------------

let mut b64 = ChunkedBitSet::<usize>::new_filled(64);

let mut b64b = ChunkedBitSet::<usize>::new_empty(64);
b64b.insert(0);

b64.subtract(&b64b);
assert!(!b64.contains(0));
assert!(b64.contains(10));
assert!(b64.contains(50));
assert!(b64.contains(63));
assert_eq!(
b64.chunks(),
#[rustfmt::skip]
vec![
Mixed {
chunk_domain_size: 64,
ones_count: 63,
words: Rc::new([
0xfffffffffffffffe, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
])
},
],
);
}

fn with_elements_chunked(elements: &[usize], domain_size: usize) -> ChunkedBitSet<usize> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub(crate) fn target() -> Target {
base.max_atomic_width = Some(64);
base.add_pre_link_args(
LinkerFlavor::Unix(Cc::No),
&["-b64", "-bpT:0x100000000", "-bpD:0x110000000", "-bcdtors:all:0:s"],
&["-b64", "-bpT:0x100000000", "-bpD:0x110000000", "-bcdtors:mbr:0:s"],
);

Target {
Expand Down
21 changes: 11 additions & 10 deletions library/alloc/src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,9 @@ macro_rules! copy_slice_and_advance {
//
// This implementation calls `borrow()` multiple times:
// 1. To calculate `reserved_len`, all elements are borrowed once.
// 2. The first element is borrowed again when copied via `extend_from_slice`.
// 3. Subsequent elements are borrowed a second time when building the mapped iterator.
// 2. All elements, except the first, are borrowed a second time when building the mapped iterator.
//
// Risks and Mitigations:
// - If the first element GROWS on the second borrow, the length subtraction underflows.
// We mitigate this by doing a `checked_sub` to panic rather than allowing an underflow
// that fabricates a huge destination slice.
// - If elements 2..N GROW on their second borrow, the target slice bounds set by `checked_sub`
// means that `split_at_mut` inside `copy_slice_and_advance!` will correctly panic.
// - If elements SHRINK on their second borrow, the spare space is never written, and the final
Expand All @@ -157,8 +153,10 @@ where
let mut iter = slice.iter();

// the first slice is the only one without a separator preceding it
// we take care to only borrow this once during the length calculation
// to avoid inconsistent Borrow implementations from breaking our assumptions
let first = match iter.next() {
Some(first) => first,
Some(first) => first.borrow().as_ref(),
None => return vec![],
};

Expand All @@ -168,21 +166,24 @@ where
// the entire Vec pre-allocated for safety
let reserved_len = sep_len
.checked_mul(iter.len())
.and_then(|n| n.checked_add(first.len()))
.and_then(|n| {
slice.iter().map(|s| s.borrow().as_ref().len()).try_fold(n, usize::checked_add)
// iter starts from the second element as we've already taken the first
// it's cloned so we can reuse the same iterator below
iter.clone().map(|s| s.borrow().as_ref().len()).try_fold(n, usize::checked_add)
})
.expect("attempt to join into collection with len > usize::MAX");

// prepare an uninitialized buffer
let mut result = Vec::with_capacity(reserved_len);
debug_assert!(result.capacity() >= reserved_len);

result.extend_from_slice(first.borrow().as_ref());
result.extend_from_slice(first);

unsafe {
let pos = result.len();
let target_len = reserved_len.checked_sub(pos).expect("inconsistent Borrow implementation");
let target = result.spare_capacity_mut().get_unchecked_mut(..target_len);
debug_assert!(reserved_len >= pos);
let target = result.spare_capacity_mut().get_unchecked_mut(..reserved_len - pos);

// Convert the separator and slices to slices of MaybeUninit
// to simplify implementation in specialize_for_lengths.
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ impl String {

// SAFETY: Just reserved capacity for at least the length needed to encode `ch`.
unsafe {
core::char::encode_utf8_raw_unchecked(ch as u32, self.vec.as_mut_ptr().add(self.len()));
core::char::encode_utf8_raw_unchecked(ch as u32, self.vec.as_mut_ptr().add(len));
self.vec.set_len(len + ch_len);
}
}
Expand Down
8 changes: 4 additions & 4 deletions library/alloctests/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fn test_join_for_different_lengths_with_long_separator() {
}

#[test]
fn test_join_issue_80335() {
fn test_join_inconsistent_borrow_shrink() {
use core::borrow::Borrow;
use core::cell::Cell;

Expand All @@ -191,12 +191,12 @@ fn test_join_issue_80335() {
}

let arr: [WeirdBorrow; 3] = Default::default();
test_join!("0-0-0", arr, "-");
test_join!("123456-0-0", arr, "-");
}

#[test]
#[should_panic(expected = "inconsistent Borrow implementation")]
fn test_join_inconsistent_borrow() {
#[should_panic(expected = "mid > len")]
fn test_join_inconsistent_borrow_grow() {
use std::borrow::Borrow;
use std::cell::Cell;

Expand Down
6 changes: 0 additions & 6 deletions library/std/src/io/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ use crate::sys::{FromInner, IntoInner, pipe as imp};
/// # Example
///
/// ```no_run
/// # #[cfg(miri)] fn main() {}
/// # #[cfg(not(miri))]
/// # fn main() -> std::io::Result<()> {
/// use std::io::{Read, Write, pipe};
/// use std::process::Command;
Expand Down Expand Up @@ -126,8 +124,6 @@ impl PipeReader {
/// # Examples
///
/// ```no_run
/// # #[cfg(miri)] fn main() {}
/// # #[cfg(not(miri))]
/// # fn main() -> std::io::Result<()> {
/// use std::fs;
/// use std::io::{pipe, Write};
Expand Down Expand Up @@ -185,8 +181,6 @@ impl PipeWriter {
/// # Examples
///
/// ```no_run
/// # #[cfg(miri)] fn main() {}
/// # #[cfg(not(miri))]
/// # fn main() -> std::io::Result<()> {
/// use std::process::Command;
/// use std::io::{pipe, Read};
Expand Down
1 change: 0 additions & 1 deletion library/std/src/io/pipe/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::io::{Read, Write, pipe};

#[test]
#[cfg(all(any(unix, windows), not(miri)))]
fn pipe_creation_clone_and_rw() {
let (rx, tx) = pipe().unwrap();

Expand Down
2 changes: 2 additions & 0 deletions library/std/src/sync/mpmc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ pub fn sync_channel<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
/// assert_eq!(3, msg + msg2);
/// ```
#[unstable(feature = "mpmc_channel", issue = "126840")]
#[cfg_attr(not(test), rustc_diagnostic_item = "MpmcSender")]
pub struct Sender<T> {
flavor: SenderFlavor<T>,
}
Expand Down Expand Up @@ -722,6 +723,7 @@ impl<T> fmt::Debug for Sender<T> {
/// rx_thread_2.join().unwrap();
/// ```
#[unstable(feature = "mpmc_channel", issue = "126840")]
#[cfg_attr(not(test), rustc_diagnostic_item = "MpmcReceiver")]
pub struct Receiver<T> {
flavor: ReceiverFlavor<T>,
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sync/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ use crate::{error, fmt};
/// println!("{}", recv.recv().unwrap()); // Received after 2 seconds
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Receiver")]
#[cfg_attr(not(test), rustc_diagnostic_item = "MpscReceiver")]
pub struct Receiver<T> {
inner: mpmc::Receiver<T>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 132 files
5 changes: 4 additions & 1 deletion src/tools/clippy/clippy_utils/src/sym.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ generate! {
MAX,
MIN,
MaybeDef,
MpmcReceiver,
MpmcSender,
MpscReceiver,
MpscSender,
MsrvStack,
Octal,
OpenOptions,
Expand All @@ -99,7 +103,6 @@ generate! {
PathBuf,
PathLookup,
RangeBounds,
Receiver,
RefCellRef,
RefCellRefMut,
Regex,
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_utils/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ pub fn has_iter_method(cx: &LateContext<'_>, probably_ref_ty: Ty<'_>) -> Option<
sym::HashMap,
sym::PathBuf,
sym::Path,
sym::Receiver,
sym::MpscReceiver,
sym::MpmcReceiver,
];

let ty_to_check = match probably_ref_ty.kind() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attributes/attr-before-view-item.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![feature(rustc_attrs)]
#![feature(test)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attributes/attr-before-view-item2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![feature(rustc_attrs)]
#![feature(test)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attributes/attr-mix-new.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![feature(rustc_attrs)]

Expand Down
19 changes: 0 additions & 19 deletions tests/ui/attributes/class-attributes-1.rs

This file was deleted.

31 changes: 0 additions & 31 deletions tests/ui/attributes/class-attributes-2.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/ui/attributes/method-attributes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass
//@ pp-exact - Make sure we print all the attributes

#![feature(rustc_attrs)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attributes/unrestricted-attribute-tokens.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![feature(rustc_attrs)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attributes/variant-attributes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass
//@ pp-exact - Make sure we actually print the attributes

#![allow(non_camel_case_types)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/conditional-compilation/cfg-attr-multi-false.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Test that cfg_attr doesn't emit any attributes when the
// configuration variable is false. This mirrors `cfg-attr-multi-true.rs`

//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![warn(unused_must_use)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/conditional-compilation/cfg-attr-multi-true.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This is done by emitting two attributes that cause new warnings, and then
// triggering those warnings.

//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![warn(unused_must_use)]

Expand Down
11 changes: 11 additions & 0 deletions tests/ui/consts/const-eval/static-promotion-issue-101363.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ check-pass
// Regression test for <https://github.com/rust-lang/rust/issues/101363>

const OPTIONAL_SLICE_V1: Option<&'static [u8]> = Some(&{
let array = [1, 2, 3];
array
});

fn main() {
let _ = OPTIONAL_SLICE_V1;
}
2 changes: 1 addition & 1 deletion tests/ui/range/range_traits-4.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

use std::ops::*;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/range/range_traits-5.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

use std::ops::*;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/range/range_traits-7.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

use std::ops::*;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/reachable/expr_andand.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![allow(unused_variables)]
#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/reachable/expr_oror.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ build-pass (FIXME(62277): could be check-pass?)
//@ check-pass

#![allow(unused_variables)]
#![allow(dead_code)]
Expand Down
Loading