suggest calling Self::associated_function()

do not suggest when trait_ref is some

Update compiler/rustc_resolve/src/late/diagnostics.rs

Co-authored-by: lcnr <rust@lcnr.de>

use helper struct

add a test for functions with some params

refactor debug log
This commit is contained in:
Takayuki Maeda
2022-04-28 16:54:28 +09:00
committed by Takayuki Maeda
parent 99b70ee230
commit df25189552
5 changed files with 147 additions and 34 deletions

View File

@@ -470,6 +470,9 @@ struct DiagnosticMetadata<'ast> {
current_where_predicate: Option<&'ast WherePredicate>,
current_type_path: Option<&'ast Ty>,
/// The current impl items (used to suggest).
current_impl_items: Option<&'ast [P<AssocItem>]>,
}
struct LateResolutionVisitor<'a, 'b, 'ast> {
@@ -1478,7 +1481,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
items: ref impl_items,
..
}) => {
self.diagnostic_metadata.current_impl_items = Some(impl_items);
self.resolve_implementation(generics, of_trait, &self_ty, item.id, impl_items);
self.diagnostic_metadata.current_impl_items = None;
}
ItemKind::Trait(box Trait { ref generics, ref bounds, ref items, .. }) => {