factor out maybe_suggest_unsized_generics
This commit is contained in:
parent
ce982a35e1
commit
2862f08b79
1 changed files with 17 additions and 1 deletions
|
@ -1088,6 +1088,13 @@ trait InferCtxtPrivExt<'tcx> {
|
||||||
obligation: &PredicateObligation<'tcx>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fn maybe_suggest_unsized_generics(
|
||||||
|
&self,
|
||||||
|
err: &mut DiagnosticBuilder<'tcx>,
|
||||||
|
span: Span,
|
||||||
|
node: Node<'hir>,
|
||||||
|
);
|
||||||
|
|
||||||
fn is_recursive_obligation(
|
fn is_recursive_obligation(
|
||||||
&self,
|
&self,
|
||||||
obligated_types: &mut Vec<&ty::TyS<'tcx>>,
|
obligated_types: &mut Vec<&ty::TyS<'tcx>>,
|
||||||
|
@ -1774,6 +1781,15 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
(Some(node), true) => node,
|
(Some(node), true) => node,
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
self.maybe_suggest_unsized_generics(err, span, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn maybe_suggest_unsized_generics(
|
||||||
|
&self,
|
||||||
|
err: &mut DiagnosticBuilder<'tcx>,
|
||||||
|
span: Span,
|
||||||
|
node: Node<'hir>,
|
||||||
|
) {
|
||||||
let generics = match node.generics() {
|
let generics = match node.generics() {
|
||||||
Some(generics) => generics,
|
Some(generics) => generics,
|
||||||
None => return,
|
None => return,
|
||||||
|
@ -1792,7 +1808,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
debug!("suggest_unsized_bound_if_applicable: param={:?}", param);
|
debug!("maybe_suggest_unsized_generics: param={:?}", param);
|
||||||
match node {
|
match node {
|
||||||
hir::Node::Item(
|
hir::Node::Item(
|
||||||
item
|
item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue