Revert the introduced typedefs

This commit is contained in:
Jesper Steen Møller 2019-05-02 08:27:57 +02:00
parent 5d2be7d1fa
commit a300cab526
3 changed files with 9 additions and 13 deletions

View File

@ -2506,16 +2506,13 @@ pub type FreevarMap = NodeMap<Vec<Freevar<ast::NodeId>>>;
pub type CaptureModeMap = NodeMap<CaptureClause>;
pub type SmallHirIdVec = SmallVec<[HirId;1]>;
pub type SmallNodeIdVec = SmallVec<[NodeId;1]>;
// The TraitCandidate's import_ids is empty if the trait is defined in the same module, and
// has length > 0 if the trait is found through an chain of imports, starting with the
// import/use statement in the scope where the trait is used.
#[derive(Clone, Debug)]
pub struct TraitCandidate {
pub def_id: DefId,
pub import_ids: SmallNodeIdVec,
pub import_ids: SmallVec<[NodeId; 1]>,
}
// Trait method resolution

View File

@ -29,7 +29,7 @@ use rustc::hir::def::{
};
use rustc::hir::def::Namespace::*;
use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap, SmallNodeIdVec};
use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap};
use rustc::ty::{self, DefIdTree};
use rustc::util::nodemap::{NodeMap, NodeSet, FxHashMap, FxHashSet, DefIdMap};
use rustc::{bug, span_bug};
@ -67,6 +67,7 @@ use std::collections::BTreeSet;
use std::mem::replace;
use rustc_data_structures::ptr_key::PtrKey;
use rustc_data_structures::sync::Lrc;
use smallvec::SmallVec;
use diagnostics::{find_span_of_binding_until_next_binding, extend_span_to_previous_binding};
use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver};
@ -4658,10 +4659,9 @@ impl<'a> Resolver<'a> {
}
}
fn find_transitive_imports(&mut self, kind: &NameBindingKind<'_>,
trait_name: &Ident) -> SmallNodeIdVec {
fn find_transitive_imports(&mut self, mut kind: &NameBindingKind<'_>,
trait_name: &Ident) -> SmallVec<[NodeId; 1]> {
let mut import_ids = smallvec![];
let mut kind = kind;
while let NameBindingKind::Import { directive, binding, .. } = *kind {
self.maybe_unused_trait_imports.insert(directive.id);
self.add_to_glob_map(&directive, *trait_name);

View File

@ -7,7 +7,6 @@ use crate::check::autoderef::{self, Autoderef};
use crate::check::FnCtxt;
use crate::hir::def_id::DefId;
use crate::hir::def::DefKind;
use crate::hir::SmallHirIdVec;
use crate::namespace::Namespace;
use rustc_data_structures::sync::Lrc;
@ -36,7 +35,7 @@ use std::mem;
use std::ops::Deref;
use std::cmp::max;
use smallvec::smallvec;
use smallvec::{smallvec, SmallVec};
use self::CandidateKind::*;
pub use self::PickKind::*;
@ -124,7 +123,7 @@ struct Candidate<'tcx> {
xform_ret_ty: Option<Ty<'tcx>>,
item: ty::AssociatedItem,
kind: CandidateKind<'tcx>,
import_ids: SmallHirIdVec,
import_ids: SmallVec<[hir::HirId; 1]>,
}
#[derive(Debug)]
@ -149,7 +148,7 @@ enum ProbeResult {
pub struct Pick<'tcx> {
pub item: ty::AssociatedItem,
pub kind: PickKind<'tcx>,
pub import_ids: hir::SmallHirIdVec,
pub import_ids: SmallVec<[hir::HirId; 1]>,
// Indicates that the source expression should be autoderef'd N times
//
@ -894,7 +893,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
}
fn assemble_extension_candidates_for_trait(&mut self,
import_ids: SmallHirIdVec,
import_ids: SmallVec<[hir::HirId; 1]>,
trait_def_id: DefId)
-> Result<(), MethodError<'tcx>> {
debug!("assemble_extension_candidates_for_trait(trait_def_id={:?})",