X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_typeck%2Fsrc%2Fcheck%2Fmethod%2Fsuggest.rs;h=042ee768d5f2e6dcc7f3781254b51aa8d245771a;hb=a2b6744af03e315587626e9faa34bfaf3b913012;hp=56fcd9e0a890743c93f6a118969957760ede4f31;hpb=3405e402faf413ef4633142225228c260a91dd9d;p=rust.git diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs index 56fcd9e0a89..042ee768d5f 100644 --- a/compiler/rustc_typeck/src/check/method/suggest.rs +++ b/compiler/rustc_typeck/src/check/method/suggest.rs @@ -904,7 +904,7 @@ trait bound{s}", } } - let label_span_not_found = |err: &mut DiagnosticBuilder<'_, _>| { + let label_span_not_found = |err: &mut Diagnostic| { if unsatisfied_predicates.is_empty() { err.span_label(span, format!("{item_kind} not found in `{ty_str}`")); let is_string_or_ref_str = match actual.kind() { @@ -1150,7 +1150,7 @@ fn suggest_field_call( rcvr_ty: Ty<'tcx>, expr: &hir::Expr<'_>, item_name: Ident, - err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>, + err: &mut Diagnostic, ) -> bool { let tcx = self.tcx; let field_receiver = self.autoderef(span, rcvr_ty).find_map(|(ty, _)| match ty.kind() { @@ -1327,7 +1327,7 @@ fn suggest_constraining_numerical_ty( fn check_for_field_method( &self, - err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>, + err: &mut Diagnostic, source: SelfSource<'tcx>, span: Span, actual: Ty<'tcx>, @@ -1375,7 +1375,7 @@ fn check_for_field_method( fn check_for_unwrap_self( &self, - err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>, + err: &mut Diagnostic, source: SelfSource<'tcx>, span: Span, actual: Ty<'tcx>, @@ -1789,7 +1789,7 @@ fn suggest_traits_to_import( // We point at the method, but we just skip the rest of the check for arbitrary // self types and rely on the suggestion to `use` the trait from // `suggest_valid_traits`. - let did = Some(pick.item.container.id()); + let did = Some(pick.item.container_id(self.tcx)); let skip = skippable.contains(&did); if pick.autoderefs == 0 && !skip { err.span_label( @@ -1825,7 +1825,7 @@ fn suggest_traits_to_import( ) { debug!("try_alt_rcvr: pick candidate {:?}", pick); - let did = Some(pick.item.container.id()); + let did = Some(pick.item.container_id(self.tcx)); // We don't want to suggest a container type when the missing // method is `.clone()` or `.deref()` otherwise we'd suggest // `Arc::new(foo).clone()`, which is far from what the user wants. @@ -1937,7 +1937,7 @@ fn suggest_traits_to_import( } } // We only want to suggest public or local traits (#45781). - item.vis.is_public() || info.def_id.is_local() + item.visibility(self.tcx).is_public() || info.def_id.is_local() }) .is_some() })