-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Tweak suggest_constraining_type_param
#70009
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,8 +195,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
return; | ||
} | ||
|
||
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. }) | ||
| hir::Node::TraitItem(hir::TraitItem { | ||
hir::Node::TraitItem(hir::TraitItem { | ||
generics, | ||
kind: hir::TraitItemKind::Fn(..), | ||
.. | ||
|
@@ -206,63 +205,31 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
kind: hir::ImplItemKind::Fn(..), | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Trait(_, _, generics, _, _), | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Impl { generics, .. }, .. | ||
}) if projection.is_some() => { | ||
| hir::Node::Item( | ||
hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. } | ||
| hir::Item { kind: hir::ItemKind::Trait(_, _, generics, _, _), .. } | ||
| hir::Item { kind: hir::ItemKind::Impl { generics, .. }, .. }, | ||
) if projection.is_some() => { | ||
// Missing associated type bound. | ||
suggest_restriction(&generics, "the associated type", err); | ||
return; | ||
} | ||
|
||
hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Struct(_, generics), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Enum(_, generics), span, .. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Union(_, generics), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Trait(_, _, generics, ..), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Impl { generics, .. }, | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::Fn(_, generics, _), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::TyAlias(_, generics), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::TraitAlias(generics, _), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::Item(hir::Item { | ||
kind: hir::ItemKind::OpaqueTy(hir::OpaqueTy { generics, .. }), | ||
span, | ||
.. | ||
}) | ||
| hir::Node::TraitItem(hir::TraitItem { generics, span, .. }) | ||
| hir::Node::ImplItem(hir::ImplItem { generics, span, .. }) | ||
hir::Node::Item( | ||
hir::Item { kind: hir::ItemKind::Struct(_, generics), .. } | ||
| hir::Item { kind: hir::ItemKind::Enum(_, generics), .. } | ||
| hir::Item { kind: hir::ItemKind::Union(_, generics), .. } | ||
| hir::Item { kind: hir::ItemKind::Trait(_, _, generics, ..), .. } | ||
| hir::Item { kind: hir::ItemKind::Impl { generics, .. }, .. } | ||
| hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. } | ||
| hir::Item { kind: hir::ItemKind::TyAlias(_, generics), .. } | ||
| hir::Item { kind: hir::ItemKind::TraitAlias(generics, _), .. } | ||
| hir::Item { | ||
kind: hir::ItemKind::OpaqueTy(hir::OpaqueTy { generics, .. }), .. | ||
}, | ||
Comment on lines
+219
to
+229
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you can further simplify this by moving the or-pattern all the way into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried that first but I got a syntax error so I assumed it wasn't possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, that shouldn't happen... Let's merge this without and I'll see what's up with this myself. |
||
) | ||
| hir::Node::TraitItem(hir::TraitItem { generics, .. }) | ||
| hir::Node::ImplItem(hir::ImplItem { generics, .. }) | ||
if param_ty => | ||
{ | ||
// Missing generic type parameter bound. | ||
|
@@ -274,8 +241,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
&mut err, | ||
¶m_name, | ||
&constraint, | ||
self.tcx.sess.source_map(), | ||
*span, | ||
Some(trait_ref.def_id()), | ||
) { | ||
return; | ||
|
Uh oh!
There was an error while loading. Please reload this page.