aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-09 18:11:18 +0000
committerGitHub <[email protected]>2021-03-09 18:11:18 +0000
commita436863364937633335bba8fe4fd81c8fdc33837 (patch)
treee2f4fc606210a3adaa9d43e58e822ac4d5cec988 /crates/hir_ty
parent9a5c72d9f07760fe875ef653a956fcaa1fe5d0de (diff)
parentb885e6bdeeb1023df53b3f292cfe301448eeaeef (diff)
Merge #7948
7948: Delete `ContainerId` r=jonas-schievink a=jonas-schievink Since block expressions containing items now have a `ModuleId`, there's no need to also treat `DefWithBodyId` as a potential item container. Since https://github.com/rust-analyzer/rust-analyzer/pull/7878, only the `ModuleId` variant of `ContainerId` was ever created, so just delete the thing and use `ModuleId` everywhere. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/display.rs4
-rw-r--r--crates/hir_ty/src/lower.rs4
-rw-r--r--crates/hir_ty/src/method_resolution.rs2
-rw-r--r--crates/hir_ty/src/traits/chalk.rs4
4 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index a0882a2a1..ab51cb0a6 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -6,7 +6,7 @@ use arrayvec::ArrayVec;
6use chalk_ir::Mutability; 6use chalk_ir::Mutability;
7use hir_def::{ 7use hir_def::{
8 db::DefDatabase, find_path, generics::TypeParamProvenance, item_scope::ItemInNs, 8 db::DefDatabase, find_path, generics::TypeParamProvenance, item_scope::ItemInNs,
9 AssocContainerId, HasModule, Lookup, ModuleId, TraitId, 9 AssocContainerId, Lookup, ModuleId, TraitId,
10}; 10};
11use hir_expand::name::Name; 11use hir_expand::name::Name;
12 12
@@ -611,7 +611,7 @@ impl HirDisplay for CallableSig {
611} 611}
612 612
613fn fn_traits(db: &dyn DefDatabase, trait_: TraitId) -> impl Iterator<Item = TraitId> { 613fn fn_traits(db: &dyn DefDatabase, trait_: TraitId) -> impl Iterator<Item = TraitId> {
614 let krate = trait_.lookup(db).container.module(db).krate(); 614 let krate = trait_.lookup(db).container.krate();
615 let fn_traits = [ 615 let fn_traits = [
616 db.lang_item(krate, "fn".into()), 616 db.lang_item(krate, "fn".into()),
617 db.lang_item(krate, "fn_mut".into()), 617 db.lang_item(krate, "fn_mut".into()),
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index b90fdc382..5fa83567b 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -1130,8 +1130,8 @@ impl CallableDefId {
1130 let db = db.upcast(); 1130 let db = db.upcast();
1131 match self { 1131 match self {
1132 CallableDefId::FunctionId(f) => f.lookup(db).module(db), 1132 CallableDefId::FunctionId(f) => f.lookup(db).module(db),
1133 CallableDefId::StructId(s) => s.lookup(db).container.module(db), 1133 CallableDefId::StructId(s) => s.lookup(db).container,
1134 CallableDefId::EnumVariantId(e) => e.parent.lookup(db).container.module(db), 1134 CallableDefId::EnumVariantId(e) => e.parent.lookup(db).container,
1135 } 1135 }
1136 .krate() 1136 .krate()
1137 } 1137 }
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
index 248367267..ccc12c075 100644
--- a/crates/hir_ty/src/method_resolution.rs
+++ b/crates/hir_ty/src/method_resolution.rs
@@ -267,7 +267,7 @@ impl Ty {
267 LangItemTarget::ImplDefId(it) => Some(it), 267 LangItemTarget::ImplDefId(it) => Some(it),
268 _ => None, 268 _ => None,
269 }) 269 })
270 .map(|it| it.lookup(db.upcast()).container.module(db.upcast()).krate()) 270 .map(|it| it.lookup(db.upcast()).container.krate())
271 .collect(); 271 .collect();
272 Some(res) 272 Some(res)
273 } 273 }
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs
index 4378a9723..565672b6b 100644
--- a/crates/hir_ty/src/traits/chalk.rs
+++ b/crates/hir_ty/src/traits/chalk.rs
@@ -424,7 +424,7 @@ pub(crate) fn trait_datum_query(
424 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); 424 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
425 let flags = rust_ir::TraitFlags { 425 let flags = rust_ir::TraitFlags {
426 auto: trait_data.auto, 426 auto: trait_data.auto,
427 upstream: trait_.lookup(db.upcast()).container.module(db.upcast()).krate() != krate, 427 upstream: trait_.lookup(db.upcast()).container.krate() != krate,
428 non_enumerable: true, 428 non_enumerable: true,
429 coinductive: false, // only relevant for Chalk testing 429 coinductive: false, // only relevant for Chalk testing
430 // FIXME: set these flags correctly 430 // FIXME: set these flags correctly
@@ -548,7 +548,7 @@ fn impl_def_datum(
548 let generic_params = generics(db.upcast(), impl_id.into()); 548 let generic_params = generics(db.upcast(), impl_id.into());
549 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); 549 let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
550 let trait_ = trait_ref.trait_; 550 let trait_ = trait_ref.trait_;
551 let impl_type = if impl_id.lookup(db.upcast()).container.module(db.upcast()).krate() == krate { 551 let impl_type = if impl_id.lookup(db.upcast()).container.krate() == krate {
552 rust_ir::ImplType::Local 552 rust_ir::ImplType::Local
553 } else { 553 } else {
554 rust_ir::ImplType::External 554 rust_ir::ImplType::External