Use ThinVec
in ast::Path
.
This commit is contained in:
parent
6b7ca2fcf2
commit
67d5cc0462
16 changed files with 168 additions and 156 deletions
|
@ -7,10 +7,8 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
bitflags = "1.2.1"
|
||||
tracing = "0.1"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_arena = { path = "../rustc_arena" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_attr = { path = "../rustc_attr" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
|
@ -20,7 +18,10 @@ rustc_feature = { path = "../rustc_feature" }
|
|||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_metadata = { path = "../rustc_metadata" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_query_system = { path = "../rustc_query_system" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||
thin-vec = "0.2.8"
|
||||
tracing = "0.1"
|
||||
|
|
|
@ -25,6 +25,7 @@ use rustc_span::lev_distance::find_best_match_for_name;
|
|||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{BytePos, Span, SyntaxContext};
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
use crate::imports::{Import, ImportKind, ImportResolver};
|
||||
use crate::late::{PatternSource, Rib};
|
||||
|
@ -1295,7 +1296,7 @@ impl<'a> Resolver<'a> {
|
|||
{
|
||||
let mut candidates = Vec::new();
|
||||
let mut seen_modules = FxHashSet::default();
|
||||
let mut worklist = vec![(start_module, Vec::<ast::PathSegment>::new(), true)];
|
||||
let mut worklist = vec![(start_module, ThinVec::<ast::PathSegment>::new(), true)];
|
||||
let mut worklist_via_import = vec![];
|
||||
|
||||
while let Some((in_module, path_segments, accessible)) = match worklist.pop() {
|
||||
|
|
|
@ -33,6 +33,8 @@ use rustc_span::{BytePos, Span};
|
|||
use std::iter;
|
||||
use std::ops::Deref;
|
||||
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
type Res = def::Res<ast::NodeId>;
|
||||
|
||||
/// A field or associated item from self type suggested in case of resolution failure.
|
||||
|
@ -78,7 +80,7 @@ fn import_candidate_to_enum_paths(suggestion: &ImportSuggestion) -> (String, Str
|
|||
let path_len = suggestion.path.segments.len();
|
||||
let enum_path = ast::Path {
|
||||
span: suggestion.path.span,
|
||||
segments: suggestion.path.segments[0..path_len - 1].to_vec(),
|
||||
segments: suggestion.path.segments[0..path_len - 1].iter().cloned().collect(),
|
||||
tokens: None,
|
||||
};
|
||||
let enum_path_string = path_names_to_string(&enum_path);
|
||||
|
@ -1831,7 +1833,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
fn find_module(&mut self, def_id: DefId) -> Option<(Module<'a>, ImportSuggestion)> {
|
||||
let mut result = None;
|
||||
let mut seen_modules = FxHashSet::default();
|
||||
let mut worklist = vec![(self.r.graph_root, Vec::new())];
|
||||
let mut worklist = vec![(self.r.graph_root, ThinVec::new())];
|
||||
|
||||
while let Some((in_module, path_segments)) = worklist.pop() {
|
||||
// abort if the module is already found
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue