Skip to content

Commit

Permalink
Rename StructDatum -> AdtDatum
Browse files Browse the repository at this point in the history
  • Loading branch information
lowr authored and Veykril committed Feb 14, 2024
1 parent a52accc commit 4940017
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
20 changes: 10 additions & 10 deletions crates/hir-ty/src/chalk_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::{

pub(crate) type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>;
pub(crate) type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>;
pub(crate) type StructDatum = chalk_solve::rust_ir::AdtDatum<Interner>;
pub(crate) type AdtDatum = chalk_solve::rust_ir::AdtDatum<Interner>;
pub(crate) type ImplDatum = chalk_solve::rust_ir::ImplDatum<Interner>;
pub(crate) type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>;

Expand All @@ -53,8 +53,8 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
fn trait_datum(&self, trait_id: TraitId) -> Arc<TraitDatum> {
self.db.trait_datum(self.krate, trait_id)
}
fn adt_datum(&self, struct_id: AdtId) -> Arc<StructDatum> {
self.db.struct_datum(self.krate, struct_id)
fn adt_datum(&self, struct_id: AdtId) -> Arc<AdtDatum> {
self.db.adt_datum(self.krate, struct_id)
}
fn adt_repr(&self, _struct_id: AdtId) -> Arc<rust_ir::AdtRepr<Interner>> {
// FIXME: keep track of these
Expand Down Expand Up @@ -712,13 +712,13 @@ fn lang_item_from_well_known_trait(trait_: WellKnownTrait) -> LangItem {
}
}

pub(crate) fn struct_datum_query(
pub(crate) fn adt_datum_query(
db: &dyn HirDatabase,
krate: CrateId,
struct_id: AdtId,
) -> Arc<StructDatum> {
debug!("struct_datum {:?}", struct_id);
let chalk_ir::AdtId(adt_id) = struct_id;
adt_id: AdtId,
) -> Arc<AdtDatum> {
debug!("adt_datum {:?}", adt_id);
let chalk_ir::AdtId(adt_id) = adt_id;
let generic_params = generics(db.upcast(), adt_id.into());
let upstream = adt_id.module(db.upcast()).krate() != krate;
let where_clauses = {
Expand All @@ -737,10 +737,10 @@ pub(crate) fn struct_datum_query(
fields: Vec::new(), // FIXME add fields (only relevant for auto traits),
};
let struct_datum_bound = rust_ir::AdtDatumBound { variants: vec![variant], where_clauses };
let struct_datum = StructDatum {
let struct_datum = AdtDatum {
// FIXME set ADT kind
kind: rust_ir::AdtKind::Struct,
id: struct_id,
id: chalk_ir::AdtId(adt_id),
binders: make_binders(db, &generic_params, struct_datum_bound),
flags,
};
Expand Down
6 changes: 3 additions & 3 deletions crates/hir-ty/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
trait_id: chalk_db::TraitId,
) -> sync::Arc<chalk_db::TraitDatum>;

#[salsa::invoke(chalk_db::struct_datum_query)]
fn struct_datum(
#[salsa::invoke(chalk_db::adt_datum_query)]
fn adt_datum(
&self,
krate: CrateId,
struct_id: chalk_db::AdtId,
) -> sync::Arc<chalk_db::StructDatum>;
) -> sync::Arc<chalk_db::AdtDatum>;

#[salsa::invoke(chalk_db::impl_datum_query)]
fn impl_datum(
Expand Down
4 changes: 2 additions & 2 deletions crates/hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3798,9 +3798,9 @@ impl Type {

// For non-phantom_data adts we check variants/fields as well as generic parameters
TyKind::Adt(adt_id, substitution)
if !db.struct_datum(krate, *adt_id).flags.phantom_data =>
if !db.adt_datum(krate, *adt_id).flags.phantom_data =>
{
let adt_datum = &db.struct_datum(krate, *adt_id);
let adt_datum = &db.adt_datum(krate, *adt_id);
let adt_datum_bound =
adt_datum.binders.clone().substitute(Interner, substitution);
adt_datum_bound
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-db/src/apply_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl RootDatabase {
hir::db::InternCoroutineQuery
hir::db::AssociatedTyDataQuery
hir::db::TraitDatumQuery
hir::db::StructDatumQuery
hir::db::AdtDatumQuery
hir::db::ImplDatumQuery
hir::db::FnDefDatumQuery
hir::db::FnDefVarianceQuery
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl RootDatabase {
// hir_db::InternCoroutineQuery
hir_db::AssociatedTyDataQuery
hir_db::TraitDatumQuery
hir_db::StructDatumQuery
hir_db::AdtDatumQuery
hir_db::ImplDatumQuery
hir_db::FnDefDatumQuery
hir_db::FnDefVarianceQuery
Expand Down

0 comments on commit 4940017

Please sign in to comment.