diff options
| author | Taylor Yu <tlyu@mit.edu> | 2021-05-31 20:46:58 -0500 |
|---|---|---|
| committer | Taylor Yu <tlyu@mit.edu> | 2021-06-18 14:20:45 -0500 |
| commit | 2862f08b79c73233e338a063d7a58e642903c9f5 (patch) | |
| tree | 87f221a8cc2dd3efdd9cdd5b8308c9c55c47761f | |
| parent | ce982a35e18e08b81a1524435f390b291f6e32b8 (diff) | |
| download | rust-2862f08b79c73233e338a063d7a58e642903c9f5.tar.gz rust-2862f08b79c73233e338a063d7a58e642903c9f5.zip | |
factor out maybe_suggest_unsized_generics
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index f522e272ecf..0441e3a1693 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1088,6 +1088,13 @@ trait InferCtxtPrivExt<'tcx> { obligation: &PredicateObligation<'tcx>, ); + fn maybe_suggest_unsized_generics( + &self, + err: &mut DiagnosticBuilder<'tcx>, + span: Span, + node: Node<'hir>, + ); + fn is_recursive_obligation( &self, obligated_types: &mut Vec<&ty::TyS<'tcx>>, @@ -1774,6 +1781,15 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { (Some(node), true) => node, _ => 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() { Some(generics) => generics, None => return, @@ -1792,7 +1808,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { { continue; } - debug!("suggest_unsized_bound_if_applicable: param={:?}", param); + debug!("maybe_suggest_unsized_generics: param={:?}", param); match node { hir::Node::Item( item |
