Skip to content

Commit 4f20caa

Browse files
committed
Auto merge of rust-lang#82663 - jyn514:rollup-xh3cb0c, r=jyn514
Rollup of 8 pull requests Successful merges: - rust-lang#81210 (BTreeMap: correct node size test case for choices of B) - rust-lang#82360 (config.toml parsing error improvements) - rust-lang#82428 (Update mdbook) - rust-lang#82480 (Remove `ENABLE_DOWNLOAD_RUSTC` constant) - rust-lang#82578 (Add some diagnostic items for Clippy) - rust-lang#82620 (Apply lint restrictions from renamed lints) - rust-lang#82635 (Fix typos in rustc_infer::infer::nll_relate) - rust-lang#82645 (Clarify that SyncOnceCell::set blocks.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ccad218 + 9a86a72 commit 4f20caa

File tree

29 files changed

+164
-163
lines changed

29 files changed

+164
-163
lines changed

Cargo.lock

+10-4
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ dependencies = [
17671767
"regex",
17681768
"serde",
17691769
"serde_json",
1770-
"shlex",
1770+
"shlex 0.1.1",
17711771
]
17721772

17731773
[[package]]
@@ -2122,9 +2122,9 @@ dependencies = [
21222122

21232123
[[package]]
21242124
name = "mdbook"
2125-
version = "0.4.6"
2125+
version = "0.4.7"
21262126
source = "registry+https://github.com/rust-lang/crates.io-index"
2127-
checksum = "b3d948b64449003363127ed6c6139f03273982c3fe97da4cb3dee933e38ce38f"
2127+
checksum = "28f6a882f3880ec68e96f60d6b543c34941e2f307ad10e2992e4db9acfe96529"
21282128
dependencies = [
21292129
"ammonia",
21302130
"anyhow",
@@ -2142,7 +2142,7 @@ dependencies = [
21422142
"serde",
21432143
"serde_derive",
21442144
"serde_json",
2145-
"shlex",
2145+
"shlex 1.0.0",
21462146
"tempfile",
21472147
"toml",
21482148
]
@@ -4858,6 +4858,12 @@ version = "0.1.1"
48584858
source = "registry+https://github.com/rust-lang/crates.io-index"
48594859
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
48604860

4861+
[[package]]
4862+
name = "shlex"
4863+
version = "1.0.0"
4864+
source = "registry+https://github.com/rust-lang/crates.io-index"
4865+
checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d"
4866+
48614867
[[package]]
48624868
name = "signal-hook-registry"
48634869
version = "1.2.1"

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ where
4444
{
4545
infcx: &'me InferCtxt<'me, 'tcx>,
4646

47-
/// Callback to use when we deduce an outlives relationship
47+
/// Callback to use when we deduce an outlives relationship.
4848
delegate: D,
4949

5050
/// How are we relating `a` and `b`?
@@ -768,7 +768,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
768768
}
769769
}
770770

771-
/// The "type generalize" is used when handling inference variables.
771+
/// The "type generalizer" is used when handling inference variables.
772772
///
773773
/// The basic strategy for handling a constraint like `?A <: B` is to
774774
/// apply a "generalization strategy" to the type `B` -- this replaces

compiler/rustc_lint/src/levels.rs

+25-8
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,18 @@ impl<'s> LintLevelsBuilder<'s> {
321321
None
322322
};
323323
let name = meta_item.path.segments.last().expect("empty lint name").ident.name;
324-
match store.check_lint_name(&name.as_str(), tool_name) {
324+
let lint_result = store.check_lint_name(&name.as_str(), tool_name);
325+
match &lint_result {
325326
CheckLintNameResult::Ok(ids) => {
326327
let src = LintLevelSource::Node(name, li.span(), reason);
327-
for &id in ids {
328+
for &id in *ids {
328329
self.check_gated_lint(id, attr.span);
329330
self.insert_spec(&mut specs, id, (level, src));
330331
}
331332
}
332333

333334
CheckLintNameResult::Tool(result) => {
334-
match result {
335+
match *result {
335336
Ok(ids) => {
336337
let complete_name = &format!("{}::{}", tool_name.unwrap(), name);
337338
let src = LintLevelSource::Node(
@@ -343,7 +344,7 @@ impl<'s> LintLevelsBuilder<'s> {
343344
self.insert_spec(&mut specs, *id, (level, src));
344345
}
345346
}
346-
Err((Some(ids), new_lint_name)) => {
347+
Err((Some(ids), ref new_lint_name)) => {
347348
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
348349
let (lvl, src) =
349350
self.sets.get_lint_level(lint, self.cur, Some(&specs), &sess);
@@ -392,21 +393,21 @@ impl<'s> LintLevelsBuilder<'s> {
392393

393394
CheckLintNameResult::Warning(msg, renamed) => {
394395
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
395-
let (level, src) =
396+
let (renamed_lint_level, src) =
396397
self.sets.get_lint_level(lint, self.cur, Some(&specs), &sess);
397398
struct_lint_level(
398399
self.sess,
399400
lint,
400-
level,
401+
renamed_lint_level,
401402
src,
402403
Some(li.span().into()),
403404
|lint| {
404405
let mut err = lint.build(&msg);
405-
if let Some(new_name) = renamed {
406+
if let Some(new_name) = &renamed {
406407
err.span_suggestion(
407408
li.span(),
408409
"use the new name",
409-
new_name,
410+
new_name.to_string(),
410411
Applicability::MachineApplicable,
411412
);
412413
}
@@ -444,6 +445,22 @@ impl<'s> LintLevelsBuilder<'s> {
444445
);
445446
}
446447
}
448+
// If this lint was renamed, apply the new lint instead of ignoring the attribute.
449+
// This happens outside of the match because the new lint should be applied even if
450+
// we don't warn about the name change.
451+
if let CheckLintNameResult::Warning(_, Some(new_name)) = lint_result {
452+
// Ignore any errors or warnings that happen because the new name is inaccurate
453+
if let CheckLintNameResult::Ok(ids) =
454+
store.check_lint_name(&new_name, tool_name)
455+
{
456+
let src =
457+
LintLevelSource::Node(Symbol::intern(&new_name), li.span(), reason);
458+
for &id in ids {
459+
self.check_gated_lint(id, attr.span);
460+
self.insert_spec(&mut specs, id, (level, src));
461+
}
462+
}
463+
}
447464
}
448465
}
449466

compiler/rustc_span/src/symbol.rs

+8
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ symbols! {
126126
Argument,
127127
ArgumentV1,
128128
Arguments,
129+
BTreeMap,
130+
BTreeSet,
131+
BinaryHeap,
129132
C,
130133
CString,
131134
Center,
@@ -163,6 +166,7 @@ symbols! {
163166
Iterator,
164167
Layout,
165168
Left,
169+
LinkedList,
166170
LintPass,
167171
None,
168172
Ok,
@@ -191,6 +195,7 @@ symbols! {
191195
RangeToInclusive,
192196
Rc,
193197
Ready,
198+
Receiver,
194199
Result,
195200
Return,
196201
Right,
@@ -592,6 +597,8 @@ symbols! {
592597
gt,
593598
half_open_range_patterns,
594599
hash,
600+
hashmap_type,
601+
hashset_type,
595602
hexagon_target_feature,
596603
hidden,
597604
homogeneous_aggregate,
@@ -1256,6 +1263,7 @@ symbols! {
12561263
variant_count,
12571264
vec,
12581265
vec_type,
1266+
vecdeque_type,
12591267
version,
12601268
vis,
12611269
visible_private_types,

config.toml.example

+3-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,9 @@ changelog-seen = 2
637637
# The full path to the musl libdir.
638638
#musl-libdir = musl-root/lib
639639

640-
# The root location of the `wasm32-wasi` sysroot.
640+
# The root location of the `wasm32-wasi` sysroot. Only used for the
641+
# `wasm32-wasi` target. If you are building wasm32-wasi target, make sure to
642+
# create a `[target.wasm32-wasi]` section and move this field there.
641643
#wasi-root = "..."
642644

643645
# Used in testing for configuring where the QEMU images are located, you

library/alloc/benches/btree/map.rs

-76
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,6 @@ fn fat_val_map(n: usize) -> BTreeMap<usize, [usize; FAT]> {
296296
(0..n).map(|i| (i, [i; FAT])).collect::<BTreeMap<_, _>>()
297297
}
298298

299-
// The returned map has large keys and values.
300-
fn fat_map(n: usize) -> BTreeMap<[usize; FAT], [usize; FAT]> {
301-
(0..n).map(|i| ([i; FAT], [i; FAT])).collect::<BTreeMap<_, _>>()
302-
}
303-
304299
#[bench]
305300
pub fn clone_slim_100(b: &mut Bencher) {
306301
let src = slim_map(100);
@@ -513,74 +508,3 @@ pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) {
513508
map
514509
})
515510
}
516-
517-
#[bench]
518-
pub fn clone_fat_100(b: &mut Bencher) {
519-
let src = fat_map(100);
520-
b.iter(|| src.clone())
521-
}
522-
523-
#[bench]
524-
pub fn clone_fat_100_and_clear(b: &mut Bencher) {
525-
let src = fat_map(100);
526-
b.iter(|| src.clone().clear())
527-
}
528-
529-
#[bench]
530-
pub fn clone_fat_100_and_drain_all(b: &mut Bencher) {
531-
let src = fat_map(100);
532-
b.iter(|| src.clone().drain_filter(|_, _| true).count())
533-
}
534-
535-
#[bench]
536-
pub fn clone_fat_100_and_drain_half(b: &mut Bencher) {
537-
let src = fat_map(100);
538-
b.iter(|| {
539-
let mut map = src.clone();
540-
assert_eq!(map.drain_filter(|i, _| i[0] % 2 == 0).count(), 100 / 2);
541-
assert_eq!(map.len(), 100 / 2);
542-
})
543-
}
544-
545-
#[bench]
546-
pub fn clone_fat_100_and_into_iter(b: &mut Bencher) {
547-
let src = fat_map(100);
548-
b.iter(|| src.clone().into_iter().count())
549-
}
550-
551-
#[bench]
552-
pub fn clone_fat_100_and_pop_all(b: &mut Bencher) {
553-
let src = fat_map(100);
554-
b.iter(|| {
555-
let mut map = src.clone();
556-
while map.pop_first().is_some() {}
557-
map
558-
});
559-
}
560-
561-
#[bench]
562-
pub fn clone_fat_100_and_remove_all(b: &mut Bencher) {
563-
let src = fat_map(100);
564-
b.iter(|| {
565-
let mut map = src.clone();
566-
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
567-
let v = map.remove(&elt);
568-
debug_assert!(v.is_some());
569-
}
570-
map
571-
});
572-
}
573-
574-
#[bench]
575-
pub fn clone_fat_100_and_remove_half(b: &mut Bencher) {
576-
let src = fat_map(100);
577-
b.iter(|| {
578-
let mut map = src.clone();
579-
for i in (0..100).step_by(2) {
580-
let v = map.remove(&[i; FAT]);
581-
debug_assert!(v.is_some());
582-
}
583-
assert_eq!(map.len(), 100 / 2);
584-
map
585-
})
586-
}

library/alloc/src/collections/binary_heap.rs

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ use super::SpecExtend;
247247
/// [peek]: BinaryHeap::peek
248248
/// [peek\_mut]: BinaryHeap::peek_mut
249249
#[stable(feature = "rust1", since = "1.0.0")]
250+
#[cfg_attr(not(test), rustc_diagnostic_item = "BinaryHeap")]
250251
pub struct BinaryHeap<T> {
251252
data: Vec<T>,
252253
}

library/alloc/src/collections/btree/map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
138138
/// *stat += random_stat_buff();
139139
/// ```
140140
#[stable(feature = "rust1", since = "1.0.0")]
141+
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeMap")]
141142
pub struct BTreeMap<K, V> {
142143
root: Option<Root<K, V>>,
143144
length: usize,

library/alloc/src/collections/btree/map/tests.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
136136
}
137137
}
138138

139-
// Tests our value of MIN_INSERTS_HEIGHT_2. It may change according to the
140-
// implementation of insertion, but it's best to be aware of when it does.
139+
// Tests our value of MIN_INSERTS_HEIGHT_2. Failure may mean you just need to
140+
// adapt that value to match a change in node::CAPACITY or the choices made
141+
// during insertion, otherwise other test cases may fail or be less useful.
141142
#[test]
142143
fn test_levels() {
143144
let mut map = BTreeMap::new();

library/alloc/src/collections/btree/node/tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn test_partial_eq() {
9595
#[cfg(target_arch = "x86_64")]
9696
fn test_sizes() {
9797
assert_eq!(core::mem::size_of::<LeafNode<(), ()>>(), 16);
98-
assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 8 * 2);
99-
assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 112);
100-
assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 112 + CAPACITY * 8 * 2);
98+
assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 2 * 8);
99+
assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 16 + (CAPACITY + 1) * 8);
100+
assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 16 + (CAPACITY * 3 + 1) * 8);
101101
}

library/alloc/src/collections/btree/set.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ use super::Recover;
6161
/// ```
6262
#[derive(Hash, PartialEq, Eq, Ord, PartialOrd)]
6363
#[stable(feature = "rust1", since = "1.0.0")]
64+
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeSet")]
6465
pub struct BTreeSet<T> {
6566
map: BTreeMap<T, ()>,
6667
}

library/alloc/src/collections/linked_list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ mod tests;
3535
/// array-based containers are generally faster,
3636
/// more memory efficient, and make better use of CPU cache.
3737
#[stable(feature = "rust1", since = "1.0.0")]
38+
#[cfg_attr(not(test), rustc_diagnostic_item = "LinkedList")]
3839
pub struct LinkedList<T> {
3940
head: Option<NonNull<Node<T>>>,
4041
tail: Option<NonNull<Node<T>>>,

library/std/src/lazy.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ impl<T> SyncOnceCell<T> {
177177

178178
/// Sets the contents of this cell to `value`.
179179
///
180-
/// Returns `Ok(())` if the cell's value was updated.
180+
/// May block if another thread is currently attempting to initialize the cell. The cell is
181+
/// guaranteed to contain a value when set returns, though not necessarily the one provided.
182+
///
183+
/// Returns `Ok(())` if the cell's value was set by this call.
181184
///
182185
/// # Examples
183186
///

library/std/src/sync/mpsc/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ mod cache_aligned;
310310
/// println!("{}", recv.recv().unwrap()); // Received after 2 seconds
311311
/// ```
312312
#[stable(feature = "rust1", since = "1.0.0")]
313+
#[cfg_attr(not(test), rustc_diagnostic_item = "Receiver")]
313314
pub struct Receiver<T> {
314315
inner: UnsafeCell<Flavor<T>>,
315316
}

0 commit comments

Comments
 (0)