Auto merge of #79322 - jyn514:refactor-impl, r=estebank
Separate out a `hir::Impl` struct This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases. See `rustc_save_analysis::dump_visitor::process_impl` or `rustdoc::clean::clean_impl` for a good example of how this makes `impl`s easier to work with. r? `@petrochenkov` maybe?
This commit is contained in:
commit
150d1fee04
61 changed files with 258 additions and 246 deletions
|
@ -393,7 +393,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
hir::Node::Item(hir::Item {
|
||||
kind:
|
||||
hir::ItemKind::Trait(_, _, generics, _, _)
|
||||
| hir::ItemKind::Impl { generics, .. },
|
||||
| hir::ItemKind::Impl(hir::Impl { generics, .. }),
|
||||
..
|
||||
}) if projection.is_some() => {
|
||||
// Missing restriction on associated type of type parameter (unmet projection).
|
||||
|
@ -416,7 +416,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
| hir::ItemKind::Enum(_, generics)
|
||||
| hir::ItemKind::Union(_, generics)
|
||||
| hir::ItemKind::Trait(_, _, generics, ..)
|
||||
| hir::ItemKind::Impl { generics, .. }
|
||||
| hir::ItemKind::Impl(hir::Impl { generics, .. })
|
||||
| hir::ItemKind::Fn(_, generics, _)
|
||||
| hir::ItemKind::TyAlias(_, generics)
|
||||
| hir::ItemKind::TraitAlias(generics, _)
|
||||
|
|
|
@ -199,7 +199,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
|
|||
trait_ref, item, cause, pred
|
||||
);
|
||||
let items = match item {
|
||||
Some(hir::Item { kind: hir::ItemKind::Impl { items, .. }, .. }) => items,
|
||||
Some(hir::Item { kind: hir::ItemKind::Impl(impl_), .. }) => impl_.items,
|
||||
_ => return,
|
||||
};
|
||||
let fix_span =
|
||||
|
@ -333,7 +333,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
let mut new_cause = cause.clone();
|
||||
// The first subst is the self ty - use the correct span for it.
|
||||
if i == 0 {
|
||||
if let Some(hir::ItemKind::Impl { self_ty, .. }) = item.map(|i| &i.kind) {
|
||||
if let Some(hir::ItemKind::Impl(hir::Impl { self_ty, .. })) =
|
||||
item.map(|i| &i.kind)
|
||||
{
|
||||
new_cause.make_mut().span = self_ty.span;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue