Skip to content

Commit 0726636

Browse files
committed
Lrc -> Rc
1 parent 597c651 commit 0726636

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl ReverseSccGraph {
4141
impl RegionInferenceContext<'_> {
4242
/// Compute the reverse SCC-based constraint graph (lazily).
4343
pub(super) fn compute_reverse_scc_graph(&mut self) {
44-
if matches!(self.rev_scc_graph, Some(_)) {
44+
if self.rev_scc_graph.is_some() {
4545
return;
4646
}
4747

compiler/rustc_expand/src/mbe/macro_parser.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ use rustc_span::Span;
8888
use std::borrow::Cow;
8989
use std::collections::hash_map::Entry::{Occupied, Vacant};
9090
use std::fmt::Display;
91+
use std::rc::Rc;
9192

9293
/// A unit within a matcher that a `MatcherPos` can refer to. Similar to (and derived from)
9394
/// `mbe::TokenTree`, but designed specifically for fast and easy traversal during matching.
@@ -257,10 +258,10 @@ struct MatcherPos {
257258
/// against the relevant metavar by the black box parser. An element will be a `MatchedSeq` if
258259
/// the corresponding metavar decl is within a sequence.
259260
///
260-
/// It is critical to performance that this is an `Lrc`, because it gets cloned frequently when
261+
/// It is critical to performance that this is an `Rc`, because it gets cloned frequently when
261262
/// processing sequences. Mostly for sequence-ending possibilities that must be tried but end
262263
/// up failing.
263-
matches: Lrc<Vec<NamedMatch>>,
264+
matches: Rc<Vec<NamedMatch>>,
264265
}
265266

266267
// This type is used a lot. Make sure it doesn't unintentionally get bigger.
@@ -272,7 +273,7 @@ impl MatcherPos {
272273
/// and both are hot enough to be always worth inlining.
273274
#[inline(always)]
274275
fn push_match(&mut self, metavar_idx: usize, seq_depth: usize, m: NamedMatch) {
275-
let matches = Lrc::make_mut(&mut self.matches);
276+
let matches = Rc::make_mut(&mut self.matches);
276277
match seq_depth {
277278
0 => {
278279
// We are not within a sequence. Just append `m`.
@@ -427,7 +428,7 @@ pub struct TtParser {
427428

428429
/// Pre-allocate an empty match array, so it can be cloned cheaply for macros with many rules
429430
/// that have no metavars.
430-
empty_matches: Lrc<Vec<NamedMatch>>,
431+
empty_matches: Rc<Vec<NamedMatch>>,
431432
}
432433

433434
impl TtParser {
@@ -437,7 +438,7 @@ impl TtParser {
437438
cur_mps: vec![],
438439
next_mps: vec![],
439440
bb_mps: vec![],
440-
empty_matches: Lrc::new(vec![]),
441+
empty_matches: Rc::new(vec![]),
441442
}
442443
}
443444

@@ -507,7 +508,7 @@ impl TtParser {
507508
// Try zero matches of this sequence, by skipping over it.
508509
self.cur_mps.push(MatcherPos {
509510
idx: idx_first_after,
510-
matches: Lrc::clone(&mp.matches),
511+
matches: Rc::clone(&mp.matches),
511512
});
512513
}
513514

@@ -521,7 +522,7 @@ impl TtParser {
521522
// processed next time around the loop.
522523
let ending_mp = MatcherPos {
523524
idx: mp.idx + 1, // +1 skips the Kleene op
524-
matches: Lrc::clone(&mp.matches),
525+
matches: Rc::clone(&mp.matches),
525526
};
526527
self.cur_mps.push(ending_mp);
527528

@@ -537,7 +538,7 @@ impl TtParser {
537538
// will fail quietly when it is processed next time around the loop.
538539
let ending_mp = MatcherPos {
539540
idx: mp.idx + 2, // +2 skips the separator and the Kleene op
540-
matches: Lrc::clone(&mp.matches),
541+
matches: Rc::clone(&mp.matches),
541542
};
542543
self.cur_mps.push(ending_mp);
543544

@@ -587,9 +588,9 @@ impl TtParser {
587588
if *token == token::Eof {
588589
Some(match eof_mps {
589590
EofMatcherPositions::One(mut eof_mp) => {
590-
// Need to take ownership of the matches from within the `Lrc`.
591-
Lrc::make_mut(&mut eof_mp.matches);
592-
let matches = Lrc::try_unwrap(eof_mp.matches).unwrap().into_iter();
591+
// Need to take ownership of the matches from within the `Rc`.
592+
Rc::make_mut(&mut eof_mp.matches);
593+
let matches = Rc::try_unwrap(eof_mp.matches).unwrap().into_iter();
593594
self.nameize(matcher, matches)
594595
}
595596
EofMatcherPositions::Multiple => {

0 commit comments

Comments
 (0)