From d06aac178358509cd7f416285e920f67bea1d64b Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 14 Nov 2022 11:21:37 +0000 Subject: [PATCH] Expose the fallibilty of the unstable lint emission in the method name --- compiler/rustc_hir_typeck/src/method/mod.rs | 10 +++++++--- compiler/rustc_hir_typeck/src/method/probe.rs | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/method/mod.rs b/compiler/rustc_hir_typeck/src/method/mod.rs index 1d13386c57af..1577eb666c84 100644 --- a/compiler/rustc_hir_typeck/src/method/mod.rs +++ b/compiler/rustc_hir_typeck/src/method/mod.rs @@ -102,7 +102,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ProbeScope::TraitsInScope, ) { Ok(pick) => { - pick.emit_unstable_name_collision_hint(self.tcx, method_name.span, call_expr_id); + pick.maybe_emit_unstable_name_collision_hint( + self.tcx, + method_name.span, + call_expr_id, + ); true } Err(NoMatch(..)) => false, @@ -256,7 +260,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { call_expr.hir_id, scope, )?; - pick.emit_unstable_name_collision_hint(self.tcx, method_name.span, call_expr.hir_id); + pick.maybe_emit_unstable_name_collision_hint(self.tcx, method_name.span, call_expr.hir_id); Ok(pick) } @@ -589,7 +593,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ProbeScope::TraitsInScope, )?; - pick.emit_unstable_name_collision_hint(self.tcx, span, expr_id); + pick.maybe_emit_unstable_name_collision_hint(self.tcx, span, expr_id); self.lint_fully_qualified_call_from_2018( span, diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index 15481296d9bf..6d46be40e622 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -1331,7 +1331,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { } impl<'tcx> Pick<'tcx> { - pub fn emit_unstable_name_collision_hint( + /// In case there were unstable name collisions, emit them as a lint. + pub fn maybe_emit_unstable_name_collision_hint( &self, tcx: TyCtxt<'tcx>, span: Span,