Skip to content

Commit d81e752

Browse files
committed
Remove as_struct_id
1 parent 2a17659 commit d81e752

File tree

4 files changed

+6
-20
lines changed

4 files changed

+6
-20
lines changed

chalk-integration/src/db.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use chalk_ir::Parameter;
1717
use chalk_ir::ProgramClause;
1818
use chalk_ir::StructId;
1919
use chalk_ir::TraitId;
20-
use chalk_ir::TypeName;
2120
use chalk_ir::{ProgramClauses, UCanonical};
2221
use chalk_rust_ir::AssociatedTyDatum;
2322
use chalk_rust_ir::AssociatedTyValue;
@@ -115,10 +114,6 @@ impl RustIrDatabase<ChalkIr> for ChalkDatabase {
115114
self.program_ir().unwrap().struct_datum(id)
116115
}
117116

118-
fn as_struct_id(&self, type_name: &TypeName<ChalkIr>) -> Option<StructId<ChalkIr>> {
119-
self.program_ir().unwrap().as_struct_id(type_name)
120-
}
121-
122117
fn impls_for_trait(
123118
&self,
124119
trait_id: TraitId<ChalkIr>,

chalk-integration/src/program.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use chalk_ir::tls;
66
use chalk_ir::{
77
debug::SeparatorTraitRef, AliasTy, ApplicationTy, AssocTypeId, Goal, Goals, ImplId, Lifetime,
88
OpaqueTy, OpaqueTyId, Parameter, ProgramClause, ProgramClauseImplication, ProgramClauses,
9-
ProjectionTy, StructId, Substitution, TraitId, Ty, TypeName,
9+
ProjectionTy, StructId, Substitution, TraitId, Ty,
1010
};
1111
use chalk_rust_ir::{
1212
AssociatedTyDatum, AssociatedTyValue, AssociatedTyValueId, ImplDatum, ImplType, OpaqueTyDatum,
@@ -332,13 +332,6 @@ impl RustIrDatabase<ChalkIr> for Program {
332332
self.struct_data[&id].clone()
333333
}
334334

335-
fn as_struct_id(&self, type_name: &TypeName<ChalkIr>) -> Option<StructId<ChalkIr>> {
336-
match type_name {
337-
TypeName::Struct(struct_id) => Some(*struct_id),
338-
_ => None,
339-
}
340-
}
341-
342335
fn impls_for_trait(
343336
&self,
344337
trait_id: TraitId<ChalkIr>,

chalk-solve/src/clauses.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ fn program_clauses_that_could_match<I: Interner>(
185185
let trait_datum = db.trait_datum(trait_id);
186186
if trait_datum.is_auto_trait() {
187187
match trait_ref.self_type_parameter(interner).data(interner) {
188-
TyData::Apply(apply) => {
189-
if let Some(struct_id) = db.as_struct_id(&apply.name) {
190-
push_auto_trait_impls(builder, trait_id, struct_id);
188+
TyData::Apply(apply) => match &apply.name {
189+
TypeName::Struct(struct_id) => {
190+
push_auto_trait_impls(builder, trait_id, *struct_id);
191191
}
192-
}
192+
_ => {}
193+
},
193194
TyData::InferenceVar(_) | TyData::BoundVar(_) => {
194195
return Err(Floundered);
195196
}

chalk-solve/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ pub trait RustIrDatabase<I: Interner>: Debug {
4343
/// Returns the `OpaqueTyDatum` with the given id.
4444
fn opaque_ty_data(&self, id: OpaqueTyId<I>) -> Arc<OpaqueTyDatum<I>>;
4545

46-
/// If `id` is a struct id, returns `Some(id)` (but cast to `StructId`).
47-
fn as_struct_id(&self, id: &TypeName<I>) -> Option<StructId<I>>;
48-
4946
/// Returns a list of potentially relevant impls for a given
5047
/// trait-id; we also supply the type parameters that we are
5148
/// trying to match (if known: these parameters may contain

0 commit comments

Comments
 (0)