hygiene: Remove some dead code
This commit is contained in:
parent
f1d4ebf015
commit
62a1f5dbc0
@ -31,7 +31,7 @@ use crate::edition::Edition;
|
|||||||
use crate::symbol::{kw, Symbol};
|
use crate::symbol::{kw, Symbol};
|
||||||
|
|
||||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
@ -130,32 +130,6 @@ impl Mark {
|
|||||||
HygieneData::with(|data| data.is_descendant_of(self, data.outer(ctxt)))
|
HygieneData::with(|data| data.is_descendant_of(self, data.outer(ctxt)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes a mark such that both input marks are descendants of (or equal to) the returned
|
|
||||||
/// mark. That is, the following holds:
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// let la = least_ancestor(a, b);
|
|
||||||
/// assert!(a.is_descendant_of(la))
|
|
||||||
/// assert!(b.is_descendant_of(la))
|
|
||||||
/// ```
|
|
||||||
pub fn least_ancestor(mut a: Mark, mut b: Mark) -> Mark {
|
|
||||||
HygieneData::with(|data| {
|
|
||||||
// Compute the path from a to the root
|
|
||||||
let mut a_path = FxHashSet::<Mark>::default();
|
|
||||||
while a != Mark::root() {
|
|
||||||
a_path.insert(a);
|
|
||||||
a = data.marks[a.0 as usize].parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// While the path from b to the root hasn't intersected, move up the tree
|
|
||||||
while !a_path.contains(&b) {
|
|
||||||
b = data.marks[b.0 as usize].parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
b
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used for enabling some compatibility fallback in resolve.
|
// Used for enabling some compatibility fallback in resolve.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn looks_like_proc_macro_derive(self) -> bool {
|
pub fn looks_like_proc_macro_derive(self) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user