Skip to content

Commit d3e8bd9

Browse files
committed
Auto merge of rust-lang#153000 - Zalathar:rollup-68jDIBK, r=Zalathar
Rollup of 9 pull requests Successful merges: - rust-lang#152229 (Remove deterministic picking from query cycle handling) - rust-lang#152970 (extend unpin noalias tests to cover mutable references) - rust-lang#149783 (stabilize `cfg_select!`) - rust-lang#151744 (fix refining_impl_trait suggestion with return_type_notation) - rust-lang#152366 (Add try_shrink_to and try_shrink_to_fit to Vec) - rust-lang#152640 (Add direct link to rustc-dev-guide in README) - rust-lang#152963 (Revert "Stabilize `str_as_str`") - rust-lang#152984 (Remove redundant call to `check_codegen_attributes_extra` in Inliner) - rust-lang#152987 (Use `HashStable` derive in more places)
2 parents c78a294 + 8c96521 commit d3e8bd9

File tree

64 files changed

+329
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+329
-286
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4492,7 +4492,6 @@ dependencies = [
44924492
"rustc_abi",
44934493
"rustc_data_structures",
44944494
"rustc_errors",
4495-
"rustc_hashes",
44964495
"rustc_hir",
44974496
"rustc_index",
44984497
"rustc_macros",

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ See https://www.rust-lang.org/community for a list of chat platforms and forums.
5252

5353
See [CONTRIBUTING.md](CONTRIBUTING.md).
5454

55+
For a detailed explanation of the compiler's architecture and how to begin contributing, see the [rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/).
56+
5557
## License
5658

5759
Rust is primarily distributed under the terms of both the MIT license and the

compiler/rustc_attr_parsing/src/attributes/cfg_select.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,14 @@ pub fn parse_cfg_select(
128128
}
129129
}
130130

131-
if let Some(features) = features
132-
&& features.enabled(sym::cfg_select)
133-
{
134-
let it = branches
135-
.reachable
136-
.iter()
137-
.map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone()))
138-
.chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t)))
139-
.chain(
140-
branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry)),
141-
);
142-
143-
lint_unreachable(p, it, lint_node_id);
144-
}
131+
let it = branches
132+
.reachable
133+
.iter()
134+
.map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone()))
135+
.chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t)))
136+
.chain(branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry)));
137+
138+
lint_unreachable(p, it, lint_node_id);
145139

146140
Ok(branches)
147141
}

compiler/rustc_codegen_cranelift/patches/0027-sysroot_tests-128bit-atomic-operations.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ index 1e336bf..35e6f54 100644
1717
@@ -2,4 +2,3 @@
1818
// tidy-alphabetical-start
1919
-#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
20-
#![cfg_attr(test, feature(cfg_select))]
2120
#![feature(array_ptr_get)]
21+
#![feature(array_try_from_fn)]
2222
diff --git a/coretests/tests/atomic.rs b/coretests/tests/atomic.rs
2323
index b735957..ea728b6 100644
2424
--- a/coretests/tests/atomic.rs

compiler/rustc_data_structures/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
#![allow(rustc::default_hash_types)]
1212
#![allow(rustc::potential_query_instability)]
1313
#![cfg_attr(bootstrap, feature(assert_matches))]
14+
#![cfg_attr(bootstrap, feature(cfg_select))]
1415
#![cfg_attr(bootstrap, feature(cold_path))]
1516
#![cfg_attr(test, feature(test))]
1617
#![deny(unsafe_op_in_unsafe_fn)]
1718
#![feature(allocator_api)]
1819
#![feature(ascii_char)]
1920
#![feature(ascii_char_variants)]
2021
#![feature(auto_traits)]
21-
#![feature(cfg_select)]
2222
#![feature(const_default)]
2323
#![feature(const_trait_impl)]
2424
#![feature(dropck_eyepatch)]
@@ -47,6 +47,9 @@ use std::fmt;
4747
#[cfg(not(bootstrap))]
4848
pub use std::{assert_matches, debug_assert_matches};
4949

50+
// This allows derive macros to reference this crate
51+
extern crate self as rustc_data_structures;
52+
5053
pub use atomic_ref::AtomicRef;
5154
pub use ena::{snapshot_vec, undo_log, unify};
5255
// Re-export `hashbrown::hash_table`, because it's part of our API

compiler/rustc_data_structures/src/sorted_map/index_map.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
use std::hash::{Hash, Hasher};
44

55
use rustc_index::{Idx, IndexVec};
6-
7-
use crate::stable_hasher::{HashStable, StableHasher};
6+
use rustc_macros::HashStable_NoContext;
87

98
/// An indexed multi-map that preserves insertion order while permitting both *O*(log *n*) lookup of
109
/// an item by key and *O*(1) lookup by index.
@@ -24,11 +23,13 @@ use crate::stable_hasher::{HashStable, StableHasher};
2423
/// in-place.
2524
///
2625
/// [`SortedMap`]: super::SortedMap
27-
#[derive(Clone, Debug)]
26+
#[derive(Clone, Debug, HashStable_NoContext)]
2827
pub struct SortedIndexMultiMap<I: Idx, K, V> {
2928
/// The elements of the map in insertion order.
3029
items: IndexVec<I, (K, V)>,
3130

31+
// We can ignore this field because it is not observable from the outside.
32+
#[stable_hasher(ignore)]
3233
/// Indices of the items in the set, sorted by the item's key.
3334
idx_sorted_by_item_key: Vec<I>,
3435
}
@@ -126,22 +127,6 @@ where
126127
}
127128
}
128129

129-
impl<I: Idx, K, V, C> HashStable<C> for SortedIndexMultiMap<I, K, V>
130-
where
131-
K: HashStable<C>,
132-
V: HashStable<C>,
133-
{
134-
fn hash_stable(&self, ctx: &mut C, hasher: &mut StableHasher) {
135-
let SortedIndexMultiMap {
136-
items,
137-
// We can ignore this field because it is not observable from the outside.
138-
idx_sorted_by_item_key: _,
139-
} = self;
140-
141-
items.hash_stable(ctx, hasher)
142-
}
143-
}
144-
145130
impl<I: Idx, K: Ord, V> FromIterator<(K, V)> for SortedIndexMultiMap<I, K, V> {
146131
fn from_iter<J>(iter: J) -> Self
147132
where

compiler/rustc_data_structures/src/svh.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@
77
88
use std::fmt;
99

10-
use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
10+
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
1111

1212
use crate::fingerprint::Fingerprint;
13-
use crate::stable_hasher;
1413

15-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable_NoContext, Decodable_NoContext, Hash)]
14+
#[derive(
15+
Copy,
16+
Clone,
17+
PartialEq,
18+
Eq,
19+
Debug,
20+
Encodable_NoContext,
21+
Decodable_NoContext,
22+
Hash,
23+
HashStable_NoContext
24+
)]
1625
pub struct Svh {
1726
hash: Fingerprint,
1827
}
@@ -39,11 +48,3 @@ impl fmt::Display for Svh {
3948
f.pad(&self.to_hex())
4049
}
4150
}
42-
43-
impl<T> stable_hasher::HashStable<T> for Svh {
44-
#[inline]
45-
fn hash_stable(&self, ctx: &mut T, hasher: &mut stable_hasher::StableHasher) {
46-
let Svh { hash } = *self;
47-
hash.hash_stable(ctx, hasher);
48-
}
49-
}

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ declare_features! (
102102
(accepted, cfg_doctest, "1.40.0", Some(62210)),
103103
/// Enables `#[cfg(panic = "...")]` config key.
104104
(accepted, cfg_panic, "1.60.0", Some(77443)),
105+
/// Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times.
106+
(accepted, cfg_select, "CURRENT_RUSTC_VERSION", Some(115585)),
105107
/// Allows `cfg(target_abi = "...")`.
106108
(accepted, cfg_target_abi, "1.78.0", Some(80970)),
107109
/// Allows `cfg(target_feature = "...")`.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ declare_features! (
388388
(unstable, cfg_sanitize, "1.41.0", Some(39699)),
389389
/// Allows `cfg(sanitizer_cfi_generalize_pointers)` and `cfg(sanitizer_cfi_normalize_integers)`.
390390
(unstable, cfg_sanitizer_cfi, "1.77.0", Some(89653)),
391-
/// Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times.
392-
(unstable, cfg_select, "CURRENT_RUSTC_VERSION", Some(115585)),
393391
/// Allows `cfg(target(abi = "..."))`.
394392
(unstable, cfg_target_compact, "1.63.0", Some(96901)),
395393
/// Allows `cfg(target_has_atomic_load_store = "...")`.
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
use rustc_data_structures::fx::FxIndexMap;
2-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2+
use rustc_macros::HashStable_Generic;
33
use rustc_span::Symbol;
44
use rustc_span::def_id::DefIdMap;
55

66
use crate::def_id::DefId;
77

8-
#[derive(Debug, Default)]
8+
#[derive(Debug, Default, HashStable_Generic)]
99
pub struct DiagnosticItems {
10+
#[stable_hasher(ignore)]
1011
pub id_to_name: DefIdMap<Symbol>,
1112
pub name_to_id: FxIndexMap<Symbol, DefId>,
1213
}
13-
14-
impl<CTX: crate::HashStableContext> HashStable<CTX> for DiagnosticItems {
15-
#[inline]
16-
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
17-
self.name_to_id.hash_stable(ctx, hasher);
18-
}
19-
}

0 commit comments

Comments
 (0)