Skip to content

Commit

Permalink
Auto merge of rust-lang#82663 - jyn514:rollup-xh3cb0c, r=jyn514
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Mar 1, 2021
2 parents ccad218 + 9a86a72 commit 4f20caa
Show file tree
Hide file tree
Showing 29 changed files with 164 additions and 163 deletions.
14 changes: 10 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ dependencies = [
"regex",
"serde",
"serde_json",
"shlex",
"shlex 0.1.1",
]

[[package]]
Expand Down Expand Up @@ -2122,9 +2122,9 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.4.6"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d948b64449003363127ed6c6139f03273982c3fe97da4cb3dee933e38ce38f"
checksum = "28f6a882f3880ec68e96f60d6b543c34941e2f307ad10e2992e4db9acfe96529"
dependencies = [
"ammonia",
"anyhow",
Expand All @@ -2142,7 +2142,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"shlex",
"shlex 1.0.0",
"tempfile",
"toml",
]
Expand Down Expand Up @@ -4858,6 +4858,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"

[[package]]
name = "shlex"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d"

[[package]]
name = "signal-hook-registry"
version = "1.2.1"
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_infer/src/infer/nll_relate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ where
{
infcx: &'me InferCtxt<'me, 'tcx>,

/// Callback to use when we deduce an outlives relationship
/// Callback to use when we deduce an outlives relationship.
delegate: D,

/// How are we relating `a` and `b`?
Expand Down Expand Up @@ -768,7 +768,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
}
}

/// The "type generalize" is used when handling inference variables.
/// The "type generalizer" is used when handling inference variables.
///
/// The basic strategy for handling a constraint like `?A <: B` is to
/// apply a "generalization strategy" to the type `B` -- this replaces
Expand Down
33 changes: 25 additions & 8 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,18 @@ impl<'s> LintLevelsBuilder<'s> {
None
};
let name = meta_item.path.segments.last().expect("empty lint name").ident.name;
match store.check_lint_name(&name.as_str(), tool_name) {
let lint_result = store.check_lint_name(&name.as_str(), tool_name);
match &lint_result {
CheckLintNameResult::Ok(ids) => {
let src = LintLevelSource::Node(name, li.span(), reason);
for &id in ids {
for &id in *ids {
self.check_gated_lint(id, attr.span);
self.insert_spec(&mut specs, id, (level, src));
}
}

CheckLintNameResult::Tool(result) => {
match result {
match *result {
Ok(ids) => {
let complete_name = &format!("{}::{}", tool_name.unwrap(), name);
let src = LintLevelSource::Node(
Expand All @@ -343,7 +344,7 @@ impl<'s> LintLevelsBuilder<'s> {
self.insert_spec(&mut specs, *id, (level, src));
}
}
Err((Some(ids), new_lint_name)) => {
Err((Some(ids), ref new_lint_name)) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
let (lvl, src) =
self.sets.get_lint_level(lint, self.cur, Some(&specs), &sess);
Expand Down Expand Up @@ -392,21 +393,21 @@ impl<'s> LintLevelsBuilder<'s> {

CheckLintNameResult::Warning(msg, renamed) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
let (level, src) =
let (renamed_lint_level, src) =
self.sets.get_lint_level(lint, self.cur, Some(&specs), &sess);
struct_lint_level(
self.sess,
lint,
level,
renamed_lint_level,
src,
Some(li.span().into()),
|lint| {
let mut err = lint.build(&msg);
if let Some(new_name) = renamed {
if let Some(new_name) = &renamed {
err.span_suggestion(
li.span(),
"use the new name",
new_name,
new_name.to_string(),
Applicability::MachineApplicable,
);
}
Expand Down Expand Up @@ -444,6 +445,22 @@ impl<'s> LintLevelsBuilder<'s> {
);
}
}
// If this lint was renamed, apply the new lint instead of ignoring the attribute.
// This happens outside of the match because the new lint should be applied even if
// we don't warn about the name change.
if let CheckLintNameResult::Warning(_, Some(new_name)) = lint_result {
// Ignore any errors or warnings that happen because the new name is inaccurate
if let CheckLintNameResult::Ok(ids) =
store.check_lint_name(&new_name, tool_name)
{
let src =
LintLevelSource::Node(Symbol::intern(&new_name), li.span(), reason);
for &id in ids {
self.check_gated_lint(id, attr.span);
self.insert_spec(&mut specs, id, (level, src));
}
}
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ symbols! {
Argument,
ArgumentV1,
Arguments,
BTreeMap,
BTreeSet,
BinaryHeap,
C,
CString,
Center,
Expand Down Expand Up @@ -163,6 +166,7 @@ symbols! {
Iterator,
Layout,
Left,
LinkedList,
LintPass,
None,
Ok,
Expand Down Expand Up @@ -191,6 +195,7 @@ symbols! {
RangeToInclusive,
Rc,
Ready,
Receiver,
Result,
Return,
Right,
Expand Down Expand Up @@ -592,6 +597,8 @@ symbols! {
gt,
half_open_range_patterns,
hash,
hashmap_type,
hashset_type,
hexagon_target_feature,
hidden,
homogeneous_aggregate,
Expand Down Expand Up @@ -1256,6 +1263,7 @@ symbols! {
variant_count,
vec,
vec_type,
vecdeque_type,
version,
vis,
visible_private_types,
Expand Down
4 changes: 3 additions & 1 deletion config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,9 @@ changelog-seen = 2
# The full path to the musl libdir.
#musl-libdir = musl-root/lib

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

# Used in testing for configuring where the QEMU images are located, you
Expand Down
76 changes: 0 additions & 76 deletions library/alloc/benches/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ fn fat_val_map(n: usize) -> BTreeMap<usize, [usize; FAT]> {
(0..n).map(|i| (i, [i; FAT])).collect::<BTreeMap<_, _>>()
}

// The returned map has large keys and values.
fn fat_map(n: usize) -> BTreeMap<[usize; FAT], [usize; FAT]> {
(0..n).map(|i| ([i; FAT], [i; FAT])).collect::<BTreeMap<_, _>>()
}

#[bench]
pub fn clone_slim_100(b: &mut Bencher) {
let src = slim_map(100);
Expand Down Expand Up @@ -513,74 +508,3 @@ pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) {
map
})
}

#[bench]
pub fn clone_fat_100(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone())
}

#[bench]
pub fn clone_fat_100_and_clear(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone().clear())
}

#[bench]
pub fn clone_fat_100_and_drain_all(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}

#[bench]
pub fn clone_fat_100_and_drain_half(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i[0] % 2 == 0).count(), 100 / 2);
assert_eq!(map.len(), 100 / 2);
})
}

#[bench]
pub fn clone_fat_100_and_into_iter(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone().into_iter().count())
}

#[bench]
pub fn clone_fat_100_and_pop_all(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}

#[bench]
pub fn clone_fat_100_and_remove_all(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}

#[bench]
pub fn clone_fat_100_and_remove_half(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
for i in (0..100).step_by(2) {
let v = map.remove(&[i; FAT]);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 100 / 2);
map
})
}
1 change: 1 addition & 0 deletions library/alloc/src/collections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ use super::SpecExtend;
/// [peek]: BinaryHeap::peek
/// [peek\_mut]: BinaryHeap::peek_mut
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "BinaryHeap")]
pub struct BinaryHeap<T> {
data: Vec<T>,
}
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
/// *stat += random_stat_buff();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeMap")]
pub struct BTreeMap<K, V> {
root: Option<Root<K, V>>,
length: usize,
Expand Down
5 changes: 3 additions & 2 deletions library/alloc/src/collections/btree/map/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
}
}

// Tests our value of MIN_INSERTS_HEIGHT_2. It may change according to the
// implementation of insertion, but it's best to be aware of when it does.
// Tests our value of MIN_INSERTS_HEIGHT_2. Failure may mean you just need to
// adapt that value to match a change in node::CAPACITY or the choices made
// during insertion, otherwise other test cases may fail or be less useful.
#[test]
fn test_levels() {
let mut map = BTreeMap::new();
Expand Down
6 changes: 3 additions & 3 deletions library/alloc/src/collections/btree/node/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn test_partial_eq() {
#[cfg(target_arch = "x86_64")]
fn test_sizes() {
assert_eq!(core::mem::size_of::<LeafNode<(), ()>>(), 16);
assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 8 * 2);
assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 112);
assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 112 + CAPACITY * 8 * 2);
assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 2 * 8);
assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 16 + (CAPACITY + 1) * 8);
assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 16 + (CAPACITY * 3 + 1) * 8);
}
1 change: 1 addition & 0 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ use super::Recover;
/// ```
#[derive(Hash, PartialEq, Eq, Ord, PartialOrd)]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeSet")]
pub struct BTreeSet<T> {
map: BTreeMap<T, ()>,
}
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod tests;
/// array-based containers are generally faster,
/// more memory efficient, and make better use of CPU cache.
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "LinkedList")]
pub struct LinkedList<T> {
head: Option<NonNull<Node<T>>>,
tail: Option<NonNull<Node<T>>>,
Expand Down
5 changes: 4 additions & 1 deletion library/std/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ impl<T> SyncOnceCell<T> {

/// Sets the contents of this cell to `value`.
///
/// Returns `Ok(())` if the cell's value was updated.
/// May block if another thread is currently attempting to initialize the cell. The cell is
/// guaranteed to contain a value when set returns, though not necessarily the one provided.
///
/// Returns `Ok(())` if the cell's value was set by this call.
///
/// # Examples
///
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ mod cache_aligned;
/// println!("{}", recv.recv().unwrap()); // Received after 2 seconds
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Receiver")]
pub struct Receiver<T> {
inner: UnsafeCell<Flavor<T>>,
}
Expand Down
Loading

0 comments on commit 4f20caa

Please sign in to comment.