8000 Update chalk to 0.19.0 by vandenheuvel · Pull Request #74700 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Update chalk to 0.19.0 #74700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Collect fields from structs, unions and enums in the same way
  • Loading branch information
Bram van den Heuvel authored and vandenheuvel committed Aug 13, 2020
commit fd797c41ca205887b12f9fc3fd298cf94873528a
27 changes: 10 additions & 17 deletions src/librustc_traits/chalk/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,16 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
.map(|(wc, _)| wc.subst(self.tcx, bound_vars))
.filter_map(|wc| LowerInto::<Option<chalk_ir::QuantifiedWhereClause<RustInterner<'tcx>>>>::lower_into(wc, &self.interner))
.collect();
let fields = match adt_def.adt_kind() {
ty::AdtKind::Struct | ty::AdtKind::Union => {
let variant = adt_def.non_enum_variant();
variant
.fields
.iter()
.map(|field| {
self.tcx
.type_of(field.did)
.subst(self.tcx, bound_vars)
.lower_into(&self.interner)
})
.collect()
}
// FIXME(chalk): handle enums; force_impl_for requires this
ty::AdtKind::Enum => vec![],
};

let fields = adt_def
.variants
.iter()
.flat_map(|variant| variant.fields.iter())
.map(|field| {
self.tcx.type_of(field.did).subst(self.tcx, bound_vars).lower_into(&self.interner)
})
.collect();

let struct_datum = Arc::new(chalk_solve::rust_ir::AdtDatum {
id: adt_id,
binders: chalk_ir::Binders::new(
Expand Down
0