Skip to content

Commit e461b81

Browse files
committed
Auto merge of rust-lang#80180 - JohnTitor:rollup-a31s996, r=JohnTitor
Rollup of 7 pull requests Successful merges: - rust-lang#78083 (Stabilize or_insert_with_key) - rust-lang#79211 (Add the "async" and "promise" doc aliases to `core::future::Future`) - rust-lang#79612 (Switch some links in compiler/ to intra-doc links) - rust-lang#80068 (Add `&mut` as an alias for 'reference' primitive) - rust-lang#80129 (docs: Edit rustc_ast::token::Token) - rust-lang#80133 (Suppress `CONST_ITEM_MUTATION` lint if a dereference occurs anywhere) - rust-lang#80155 (Fix typo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3d9ada6 + b27c783 commit e461b81

File tree

15 files changed

+42
-32
lines changed

15 files changed

+42
-32
lines changed

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ impl Token {
434434
|| self == &OpenDelim(Paren)
435435
}
436436

437-
/// Returns `true` if the token is any literal
437+
/// Returns `true` if the token is any literal.
438438
pub fn is_lit(&self) -> bool {
439439
match self.kind {
440440
Literal(..) => true,

compiler/rustc_data_structures/src/graph/iterate/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ struct Event<N> {
149149
/// those successors), we will pop off that node's `Settled` event.
150150
///
151151
/// [CLR]: https://en.wikipedia.org/wiki/Introduction_to_Algorithms
152-
/// [`NodeStatus`]: ./enum.NodeStatus.html
153-
/// [`TriColorVisitor::node_examined`]: ./trait.TriColorVisitor.html#method.node_examined
154152
pub struct TriColorDepthFirstSearch<'graph, G>
155153
where
156154
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,

compiler/rustc_data_structures/src/sorted_map/index_map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ use rustc_index::vec::{Idx, IndexVec};
2424
/// to insert into the middle of the sorted array. Users should avoid mutating this data structure
2525
/// in-place.
2626
///
27-
/// [`IndexVec`]: ../../rustc_index/vec/struct.IndexVec.html
28-
/// [`SortedMap`]: ../sorted_map/struct.SortedMap.html
27+
/// [`SortedMap`]: super::SortedMap
2928
#[derive(Clone, Debug)]
3029
pub struct SortedIndexMultiMap<I: Idx, K, V> {
3130
/// The elements of the map in insertion order.

compiler/rustc_data_structures/src/sso/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const SSO_ARRAY_SIZE: usize = 8;
4040
// into_keys/into_values (unstable)
4141
// all raw_entry-related
4242
// PartialEq/Eq (requires sorting the array)
43-
// Entry::or_insert_with_key (unstable)
43+
// Entry::or_insert_with_key
4444
// Vacant/Occupied entries and related
4545
//
4646
// FIXME: In HashMap most methods accepting key reference

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ impl Diagnostic {
138138
///
139139
/// This span is *not* considered a ["primary span"][`MultiSpan`]; only
140140
/// the `Span` supplied when creating the diagnostic is primary.
141-
///
142-
/// [`MultiSpan`]: ../rustc_span/struct.MultiSpan.html
143141
pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self {
144142
self.span.push_span_label(span, label.into());
145143
self

compiler/rustc_index/src/bit_set.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub const WORD_BITS: usize = WORD_BYTES * 8;
2727
/// to or greater than the domain size. All operations that involve two bitsets
2828
/// will panic if the bitsets have differing domain sizes.
2929
///
30-
/// [`GrowableBitSet`]: struct.GrowableBitSet.html
3130
#[derive(Eq, PartialEq, Decodable, Encodable)]
3231
pub struct BitSet<T> {
3332
domain_size: usize,

compiler/rustc_lexer/src/unescape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ fn scan_escape(first_char: char, chars: &mut Chars<'_>, mode: Mode) -> Result<ch
201201
return Err(EscapeError::NoBraceInUnicodeEscape);
202202
}
203203

204-
// First characrer must be a hexadecimal digit.
204+
// First character must be a hexadecimal digit.
205205
let mut n_digits = 1;
206206
let mut value: u32 = match chars.next().ok_or(EscapeError::UnclosedUnicodeEscape)? {
207207
'_' => return Err(EscapeError::LeadingUnderscoreUnicodeEscape),

compiler/rustc_mir/src/dataflow/impls/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::dataflow::{AnalysisDomain, Backward, GenKill, GenKillAnalysis};
1111
/// exist. See [this `mir-dataflow` test][flow-test] for an example. You almost never want to use
1212
/// this analysis without also looking at the results of [`MaybeBorrowedLocals`].
1313
///
14-
/// [`MaybeBorrowedLocals`]: ../struct.MaybeBorrowedLocals.html
14+
/// [`MaybeBorrowedLocals`]: super::MaybeBorrowedLocals
1515
/// [flow-test]: https://github.com/rust-lang/rust/blob/a08c47310c7d49cbdc5d7afb38408ba519967ecd/src/test/ui/mir-dataflow/liveness-ptr.rs
1616
/// [liveness]: https://en.wikipedia.org/wiki/Live_variable_analysis
1717
pub struct MaybeLiveLocals;

compiler/rustc_mir/src/transform/check_const_item_mutation.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ impl<'a, 'tcx> ConstMutationChecker<'a, 'tcx> {
6666
location: Location,
6767
decorate: impl for<'b> FnOnce(LintDiagnosticBuilder<'b>) -> DiagnosticBuilder<'b>,
6868
) {
69-
// Don't lint on borrowing/assigning to a dereference
70-
// e.g:
69+
// Don't lint on borrowing/assigning when a dereference is involved.
70+
// If we 'leave' the temporary via a dereference, we must
71+
// be modifying something else
7172
//
7273
// `unsafe { *FOO = 0; *BAR.field = 1; }`
7374
// `unsafe { &mut *FOO }`
74-
if !matches!(place.projection.last(), Some(PlaceElem::Deref)) {
75+
// `unsafe { (*ARRAY)[0] = val; }
76+
if !place.projection.iter().any(|p| matches!(p, PlaceElem::Deref)) {
7577
let source_info = self.body.source_info(location);
7678
let lint_root = self.body.source_scopes[source_info.scope]
7779
.local_data

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,16 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
116116
}
117117
}
118118

119-
#[unstable(feature = "or_insert_with_key", issue = "71024")]
120-
/// Ensures a value is in the entry by inserting, if empty, the result of the default function,
121-
/// which takes the key as its argument, and returns a mutable reference to the value in the
122-
/// entry.
119+
/// Ensures a value is in the entry by inserting, if empty, the result of the default function.
120+
/// This method allows for generating key-derived values for insertion by providing the default
121+
/// function a reference to the key that was moved during the `.entry(key)` method call.
122+
///
123+
/// The reference to the moved key is provided so that cloning or copying the key is
124+
/// unnecessary, unlike with `.or_insert_with(|| ... )`.
123125
///
124126
/// # Examples
125127
///
126128
/// ```
127-
/// #![feature(or_insert_with_key)]
128129
/// use std::collections::BTreeMap;
129130
///
130131
/// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
@@ -134,6 +135,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
134135
/// assert_eq!(map["poneyland"], 9);
135136
/// ```
136137
#[inline]
138+
#[stable(feature = "or_insert_with_key", since = "1.50.0")]
137139
pub fn or_insert_with_key<F: FnOnce(&K) -> V>(self, default: F) -> &'a mut V {
138140
match self {
139141
Occupied(entry) => entry.into_mut(),

0 commit comments

Comments
 (0)