Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bd72f7a
Replace `Allocator + Clone` with `AllocatorClone` in btree
maxdexh Aug 24, 2026
c42b90f
Add codegen test for disjunction fed to unreachable_unchecked
zakrad Aug 25, 2026
2686c8c
Don't list escaping bound regions in nested `for<...>` binders of E03…
Rani367 Jul 13, 2026
8432202
clippy::manual_is_ascii_check
ChrisDenton Aug 12, 2026
563b112
clippy::manual_ignore_case_cmp
ChrisDenton Aug 12, 2026
5fa3b60
clippy::manual_hash_one
ChrisDenton Aug 12, 2026
7cf35bd
clippy::excessive_precision
ChrisDenton Aug 12, 2026
abce09f
clippy::partialeq_ne_impl
ChrisDenton Aug 12, 2026
d867667
clippy::manual_contains
ChrisDenton Aug 13, 2026
b6ef1ff
clippy::single_match
ChrisDenton Aug 13, 2026
fd0a93f
clippy::match_as_ref
ChrisDenton Aug 13, 2026
28f78d4
clippy::default_constructed_unit_structs
ChrisDenton Aug 13, 2026
a7f7b19
clippy::redundant_closure
ChrisDenton Aug 13, 2026
097f843
clippy::derivable_impls
ChrisDenton Aug 13, 2026
ff47e67
clippy::partialeq_to_none
ChrisDenton Aug 13, 2026
8523083
clippy::unnecessary_map_or
ChrisDenton Aug 13, 2026
64393eb
clippy::manual_clear
ChrisDenton Aug 13, 2026
30dc431
clippy::bind_instead_of_map
ChrisDenton Aug 13, 2026
5051bc3
clippy::redundant_slicing
ChrisDenton Aug 13, 2026
0348ed1
clippy::transmutes_expressible_as_ptr_casts
ChrisDenton Aug 13, 2026
4dae4ea
clippy::manual_repeat_n
ChrisDenton Aug 13, 2026
d1f1aae
clippy::to_digit_is_some
ChrisDenton Aug 18, 2026
4b68669
clippy::double_must_use
ChrisDenton Aug 18, 2026
7401901
clippy::seek_from_current
ChrisDenton Aug 18, 2026
641b3e5
clippy::mem_replace_option_with_some
ChrisDenton Aug 18, 2026
836a20f
clippy::mem_replace_option_with_none
ChrisDenton Aug 18, 2026
3fba07b
clippy::map_clone
ChrisDenton Aug 18, 2026
610a48e
clippy::declare_interior_mutable_const
ChrisDenton Aug 18, 2026
f591acd
clippy::assign_op_pattern
ChrisDenton Aug 18, 2026
31f7abc
clippy::chunks_exact_to_as_chunks
ChrisDenton Aug 18, 2026
4bed8e2
clippy::needless_raw_string_hashes
ChrisDenton Aug 19, 2026
428739b
clippy::approx_constant
ChrisDenton Aug 19, 2026
af533a1
clippy::neg_cmp_op_on_partial_ord
ChrisDenton Aug 12, 2026
9fa2a10
Ignore clippy failures in stdarch submodule
ChrisDenton Aug 18, 2026
79c0d27
Enforce even more clippy lints in CI
ChrisDenton Aug 18, 2026
4c8eac0
Allow lints on backtrace-rs
ChrisDenton Aug 19, 2026
aa9fe90
ignore clippy::redundant_pattern_matching
ChrisDenton Aug 19, 2026
cada98b
Rollup merge of #161328 - ChrisDenton:clippy3, r=nia-e
JonathanBrouwer Aug 25, 2026
0dfc186
Rollup merge of #161684 - maxdexh:smoke-trees, r=nia-e
JonathanBrouwer Aug 25, 2026
884a609
Rollup merge of #159232 - Rani367:fix-nested-hrtb-binder-printing, r=…
JonathanBrouwer Aug 25, 2026
50f5be9
Rollup merge of #161774 - zakrad:regr-test-115026, r=JonathanBrouwer
JonathanBrouwer Aug 25, 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
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl_dyn_send!(
[std::sync::LazyLock<T, F> where T: DynSend, F: DynSend]
[std::collections::HashSet<K, S> where K: DynSend, S: DynSend]
[std::collections::HashMap<K, V, S> where K: DynSend, V: DynSend, S: DynSend]
[std::collections::BTreeMap<K, V, A> where K: DynSend, V: DynSend, A: std::alloc::Allocator + Clone + DynSend]
[std::collections::BTreeMap<K, V, A> where K: DynSend, V: DynSend, A: std::alloc::AllocatorClone + DynSend]
[Vec<T, A> where T: DynSend, A: std::alloc::Allocator + DynSend]
[Box<T, A> where T: ?Sized + DynSend, A: std::alloc::Allocator + DynSend]
[crate::sync::RwLock<T> where T: DynSend]
Expand Down Expand Up @@ -168,7 +168,7 @@ impl_dyn_sync!(
[std::sync::LazyLock<T, F> where T: DynSend + DynSync, F: DynSend]
[std::collections::HashSet<K, S> where K: DynSync, S: DynSync]
[std::collections::HashMap<K, V, S> where K: DynSync, V: DynSync, S: DynSync]
[std::collections::BTreeMap<K, V, A> where K: DynSync, V: DynSync, A: std::alloc::Allocator + Clone + DynSync]
[std::collections::BTreeMap<K, V, A> where K: DynSync, V: DynSync, A: std::alloc::AllocatorClone + DynSync]
[Vec<T, A> where T: DynSync, A: std::alloc::Allocator + DynSync]
[Box<T, A> where T: ?Sized + DynSync, A: std::alloc::Allocator + DynSync]
[crate::sync::RwLock<T> where T: DynSend + DynSync]
Expand Down
44 changes: 13 additions & 31 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2706,15 +2706,10 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
struct RegionFolder<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
current_index: ty::DebruijnIndex,
/// Regions bound by the binder being named (and placeholders) that have
/// already been named.
region_map: UnordMap<ty::BoundRegion<'tcx>, ty::Region<'tcx>>,
name: &'a mut (
dyn FnMut(
Option<ty::DebruijnIndex>, // Debruijn index of the folded late-bound region
ty::DebruijnIndex, // Index corresponding to binder level
ty::BoundRegion<'tcx>,
) -> ty::Region<'tcx>
+ 'a
),
name: &'a mut (dyn FnMut(ty::BoundRegion<'tcx>) -> ty::Region<'tcx> + 'a),
}

impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
Expand Down Expand Up @@ -2745,8 +2740,13 @@ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
let name = &mut self.name;
let region = match r.kind() {
ty::ReBound(ty::BoundVarIndexKind::Bound(db), br) if db >= self.current_index => {
*self.region_map.entry(br).or_insert_with(|| name(Some(db), self.current_index, br))
// Only name regions bound by the binder being named. Regions bound by an
// enclosing binder that merely escape through this one keep their name
// (they were named when that binder was folded) and their index, and must
// not end up in `region_map`, which callers use to build `for<...>` lists
// (#102392, #134410).
ty::ReBound(ty::BoundVarIndexKind::Bound(db), br) if db == self.current_index => {
*self.region_map.entry(br).or_insert_with(|| name(br))
}
ty::RePlaceholder(ty::PlaceholderRegion {
bound: ty::BoundRegion { kind, .. },
Expand All @@ -2759,10 +2759,7 @@ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
_ => {
// Index doesn't matter, since this is just for naming and these never get bound
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind };
*self
.region_map
.entry(br)
.or_insert_with(|| name(None, self.current_index, br))
*self.region_map.entry(br).or_insert_with(|| name(br))
}
}
}
Expand Down Expand Up @@ -2871,30 +2868,15 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {

let trim_path = with_forced_trimmed_paths();
// Closure used in `RegionFolder` to create names for anonymous late-bound
// regions. We use two `DebruijnIndex`es (one for the currently folded
// late-bound region and the other for the binder level) to determine
// whether a name has already been created for the currently folded region,
// see issue #102392.
let mut name = |lifetime_idx: Option<ty::DebruijnIndex>,
binder_level_idx: ty::DebruijnIndex,
br: ty::BoundRegion<'tcx>| {
// regions.
let mut name = |br: ty::BoundRegion<'tcx>| {
let (name, kind) = if let Some(name) = br.kind.get_name(tcx) {
(name, br.kind)
} else {
let name = next_name(self);
(name, ty::BoundRegionKind::NamedForPrinting(name))
};

if let Some(lt_idx) = lifetime_idx {
if lt_idx > binder_level_idx {
return ty::Region::new_bound(
tcx,
ty::INNERMOST,
ty::BoundRegion { var: br.var, kind },
);
}
}

// Unconditionally render `unsafe<>`.
if !trim_path || mode == WrapBinderMode::Unsafe {
start_or_continue(self, mode.start_str(), ", ");
Expand Down
3 changes: 0 additions & 3 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,6 @@ impl<T: ?Sized + CloneToUninit> Box<T> {
/// ```
#[unstable(feature = "clone_from_ref", issue = "149075")]
//#[unstable(feature = "allocator_api", issue = "32838")]
#[must_use]
#[inline]
pub fn try_clone_from_ref(src: &T) -> Result<Box<T>, AllocError> {
Box::try_clone_from_ref_in(src, Global)
Expand Down Expand Up @@ -860,7 +859,6 @@ impl<T: ?Sized + CloneToUninit, A: Allocator> Box<T, A> {
/// ```
#[unstable(feature = "clone_from_ref", issue = "149075")]
//#[unstable(feature = "allocator_api", issue = "32838")]
#[must_use]
#[inline]
pub fn try_clone_from_ref_in(src: &T, alloc: A) -> Result<Box<T, A>, AllocError> {
struct DeallocDropGuard<'a, A: Allocator>(Layout, &'a A, NonNull<u8>);
Expand Down Expand Up @@ -1156,7 +1154,6 @@ impl<T, A: Allocator> Box<[T], A> {
/// ```
#[unstable(feature = "alloc_slice_into_array", issue = "148082")]
#[inline]
#[must_use]
pub fn into_array<const N: usize>(self) -> Result<Box<[T; N], A>, Self> {
if self.len() == N {
let (ptr, alloc) = Self::into_raw_with_allocator(self);
Expand Down
9 changes: 1 addition & 8 deletions library/alloc/src/bstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::vec::Vec;
/// showing invalid UTF-8 as hex escapes or the Unicode replacement character, respectively.
#[unstable(feature = "bstr", issue = "134915")]
#[repr(transparent)]
#[derive(Clone)]
#[derive(Clone, Default)]
#[doc(alias = "BString")]
pub struct ByteString(pub Vec<u8>);

Expand Down Expand Up @@ -187,13 +187,6 @@ impl BorrowMut<ByteStr> for ByteString {

// `impl BorrowMut<ByteStr> for Vec<u8>` omitted to avoid inference failures

#[unstable(feature = "bstr", issue = "134915")]
impl Default for ByteString {
fn default() -> Self {
ByteString(Vec::new())
}
}

// Omitted due to inference failures
//
// #[unstable(feature = "bstr", issue = "134915")]
Expand Down
10 changes: 3 additions & 7 deletions library/alloc/src/collections/btree/append.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
use core::alloc::Allocator;
use core::alloc::AllocatorClone;

use super::node::{self, Root};

impl<K, V> Root<K, V> {
/// Pushes all key-value pairs to the end of the tree, incrementing a
/// `length` variable along the way. The latter makes it easier for the
/// caller to avoid a leak when the iterator panicks.
pub(super) fn bulk_push<I, A: Allocator + Clone>(
&mut self,
iter: I,
length: &mut usize,
alloc: A,
) where
pub(super) fn bulk_push<I, A: AllocatorClone>(&mut self, iter: I, length: &mut usize, alloc: A)
where
I: Iterator<Item = (K, V)>,
{
let mut cur_node = self.borrow_mut().last_leaf_edge().into_node();
Expand Down
23 changes: 10 additions & 13 deletions library/alloc/src/collections/btree/fix.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::alloc::Allocator;
use core::alloc::AllocatorClone;

use super::map::MIN_LEN;
use super::node::ForceResult::*;
Expand All @@ -10,7 +10,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
/// sibling. If successful but at the cost of shrinking the parent node,
/// returns that shrunk parent node. Returns an `Err` if the node is
/// an empty root.
fn fix_node_through_parent<A: Allocator + Clone>(
fn fix_node_through_parent<A: AllocatorClone>(
self,
alloc: A,
) -> Result<Option<NodeRef<marker::Mut<'a>, K, V, marker::Internal>>, Self> {
Expand Down Expand Up @@ -57,10 +57,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
///
/// This method does not expect ancestors to already be underfull upon entry
/// and panics if it encounters an empty ancestor.
pub(super) fn fix_node_and_affected_ancestors<A: Allocator + Clone>(
mut self,
alloc: A,
) -> bool {
pub(super) fn fix_node_and_affected_ancestors<A: AllocatorClone>(mut self, alloc: A) -> bool {
loop {
match self.fix_node_through_parent(alloc.clone()) {
Ok(Some(parent)) => self = parent.forget_type(),
Expand All @@ -73,7 +70,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {

impl<K, V> Root<K, V> {
/// Removes empty levels on the top, but keeps an empty leaf if the entire tree is empty.
pub(super) fn fix_top<A: Allocator + Clone>(&mut self, alloc: A) {
pub(super) fn fix_top<A: AllocatorClone>(&mut self, alloc: A) {
while self.height() > 0 && self.len() == 0 {
self.pop_internal_level(alloc.clone());
}
Expand All @@ -82,7 +79,7 @@ impl<K, V> Root<K, V> {
/// Stocks up or merge away any underfull nodes on the right border of the
/// tree. The other nodes, those that are not the root nor a rightmost edge,
/// must already have at least MIN_LEN elements.
pub(super) fn fix_right_border<A: Allocator + Clone>(&mut self, alloc: A) {
pub(super) fn fix_right_border<A: AllocatorClone>(&mut self, alloc: A) {
self.fix_top(alloc.clone());
if self.len() > 0 {
self.borrow_mut().last_kv().fix_right_border_of_right_edge(alloc.clone());
Expand All @@ -91,7 +88,7 @@ impl<K, V> Root<K, V> {
}

/// The symmetric clone of `fix_right_border`.
pub(super) fn fix_left_border<A: Allocator + Clone>(&mut self, alloc: A) {
pub(super) fn fix_left_border<A: AllocatorClone>(&mut self, alloc: A) {
self.fix_top(alloc.clone());
if self.len() > 0 {
self.borrow_mut().first_kv().fix_left_border_of_left_edge(alloc.clone());
Expand Down Expand Up @@ -121,14 +118,14 @@ impl<K, V> Root<K, V> {
}

impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV> {
fn fix_left_border_of_left_edge<A: Allocator + Clone>(mut self, alloc: A) {
fn fix_left_border_of_left_edge<A: AllocatorClone>(mut self, alloc: A) {
while let Internal(internal_kv) = self.force() {
self = internal_kv.fix_left_child(alloc.clone()).first_kv();
debug_assert!(self.reborrow().into_node().len() > MIN_LEN);
}
}

fn fix_right_border_of_right_edge<A: Allocator + Clone>(mut self, alloc: A) {
fn fix_right_border_of_right_edge<A: AllocatorClone>(mut self, alloc: A) {
while let Internal(internal_kv) = self.force() {
self = internal_kv.fix_right_child(alloc.clone()).last_kv();
debug_assert!(self.reborrow().into_node().len() > MIN_LEN);
Expand All @@ -141,7 +138,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
/// provisions an extra element to allow merging its children in turn
/// without becoming underfull.
/// Returns the left child.
fn fix_left_child<A: Allocator + Clone>(
fn fix_left_child<A: AllocatorClone>(
self,
alloc: A,
) -> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
Expand All @@ -164,7 +161,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
/// provisions an extra element to allow merging its children in turn
/// without becoming underfull.
/// Returns wherever the right child ended up.
fn fix_right_child<A: Allocator + Clone>(
fn fix_right_child<A: AllocatorClone>(
self,
alloc: A,
) -> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
Expand Down
Loading
Loading