add CStore::item_generics_num_lifetimes
This commit is contained in:
parent
b743af6a24
commit
5dafa6a464
6 changed files with 11 additions and 13 deletions
|
|
@ -5,8 +5,8 @@
|
|||
use crate::hir::map as hir_map;
|
||||
use crate::hir::map::definitions::{DefKey, DefPathTable};
|
||||
use crate::session::search_paths::PathKind;
|
||||
use crate::session::{CrateDisambiguator, Session};
|
||||
use crate::ty::{self, TyCtxt};
|
||||
use crate::session::CrateDisambiguator;
|
||||
use crate::ty::TyCtxt;
|
||||
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::{self, MetadataRef};
|
||||
|
|
@ -208,7 +208,6 @@ pub trait CrateStore {
|
|||
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool;
|
||||
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> CrateDisambiguator;
|
||||
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
|
||||
fn item_generics_cloned_untracked(&self, def: DefId, sess: &Session) -> ty::Generics;
|
||||
|
||||
// This is basically a 1-based range of ints, which is a little
|
||||
// silly - I may fix that.
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ struct LoweringContext<'a, 'hir: 'a> {
|
|||
pub trait Resolver {
|
||||
fn def_key(&mut self, id: DefId) -> DefKey;
|
||||
|
||||
fn item_generics_num_liftimes(&self, def: DefId, sess: &Session) -> usize;
|
||||
fn item_generics_num_lifetimes(&self, def: DefId, sess: &Session) -> usize;
|
||||
|
||||
/// Obtains resolution for a `NodeId` with a single resolution.
|
||||
fn get_partial_res(&mut self, id: NodeId) -> Option<PartialRes>;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
return n;
|
||||
}
|
||||
assert!(!def_id.is_local());
|
||||
let n = self.resolver.item_generics_num_liftimes(def_id, self.sess);
|
||||
let n = self.resolver.item_generics_num_lifetimes(def_id, self.sess);
|
||||
self.type_def_lifetime_params.insert(def_id, n);
|
||||
n
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ use rustc::session::{CrateDisambiguator, Session};
|
|||
use rustc::ty::TyCtxt;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir::def_id::CrateNum;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_target::spec::{PanicStrategy, TargetTriple};
|
||||
|
||||
|
|
|
|||
|
|
@ -478,6 +478,10 @@ impl CStore {
|
|||
pub fn crate_source_untracked(&self, cnum: CrateNum) -> CrateSource {
|
||||
self.get_crate_data(cnum).source.clone()
|
||||
}
|
||||
|
||||
pub fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usize {
|
||||
self.get_crate_data(def_id.krate).get_generics(def_id.index, sess).own_counts().lifetimes
|
||||
}
|
||||
}
|
||||
|
||||
impl CrateStore for CStore {
|
||||
|
|
@ -485,10 +489,6 @@ impl CrateStore for CStore {
|
|||
self
|
||||
}
|
||||
|
||||
fn item_generics_cloned_untracked(&self, def: DefId, sess: &Session) -> ty::Generics {
|
||||
self.get_crate_data(def.krate).get_generics(def.index, sess)
|
||||
}
|
||||
|
||||
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol {
|
||||
self.get_crate_data(cnum).root.name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1031,8 +1031,8 @@ impl rustc_ast_lowering::Resolver for Resolver<'_> {
|
|||
if id.is_local() { self.definitions().def_key(id.index) } else { self.cstore().def_key(id) }
|
||||
}
|
||||
|
||||
fn item_generics_num_liftimes(&self, def_id: DefId, sess: &Session) -> usize {
|
||||
self.cstore().item_generics_cloned_untracked(def_id, sess).own_counts().lifetimes
|
||||
fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usize {
|
||||
self.cstore().item_generics_num_lifetimes(def_id, sess)
|
||||
}
|
||||
|
||||
fn resolve_str_path(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue