Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Expose the fallibilty of the unstable lint emission in the method name
  • Loading branch information
oli-obk committed Nov 15, 2022
commit d06aac178358509cd7f416285e920f67bea1d64b
10 changes: 7 additions & 3 deletions compiler/rustc_hir_typeck/src/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down