7986: Simplify a bit r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
This commit is contained in:
bors[bot] 2021-03-12 19:52:07 +00:00 committed by GitHub
commit 437527b226
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -487,19 +487,14 @@ pub(crate) fn struct_datum_query(
struct_id: AdtId, struct_id: AdtId,
) -> Arc<StructDatum> { ) -> Arc<StructDatum> {
debug!("struct_datum {:?}", struct_id); debug!("struct_datum {:?}", struct_id);
let type_ctor = Ty::Adt(struct_id, Substs::empty());
let chalk_ir::AdtId(adt_id) = struct_id; let chalk_ir::AdtId(adt_id) = struct_id;
debug!("struct {:?} = {:?}", struct_id, type_ctor);
let num_params = generics(db.upcast(), adt_id.into()).len(); let num_params = generics(db.upcast(), adt_id.into()).len();
let upstream = adt_id.module(db.upcast()).krate() != krate; let upstream = adt_id.module(db.upcast()).krate() != krate;
let where_clauses = type_ctor let where_clauses = {
.as_generic_def() let generic_params = generics(db.upcast(), adt_id.into());
.map(|generic_def| {
let generic_params = generics(db.upcast(), generic_def);
let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
convert_where_clauses(db, generic_def, &bound_vars) convert_where_clauses(db, adt_id.into(), &bound_vars)
}) };
.unwrap_or_else(Vec::new);
let flags = rust_ir::AdtFlags { let flags = rust_ir::AdtFlags {
upstream, upstream,
// FIXME set fundamental and phantom_data flags correctly // FIXME set fundamental and phantom_data flags correctly