Skip to content

Commit d06aac1

Browse files
committed
Expose the fallibilty of the unstable lint emission in the method name
1 parent e656883 commit d06aac1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

compiler/rustc_hir_typeck/src/method/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
102102
ProbeScope::TraitsInScope,
103103
) {
104104
Ok(pick) => {
105-
pick.emit_unstable_name_collision_hint(self.tcx, method_name.span, call_expr_id);
105+
pick.maybe_emit_unstable_name_collision_hint(
106+
self.tcx,
107+
method_name.span,
108+
call_expr_id,
109+
);
106110
true
107111
}
108112
Err(NoMatch(..)) => false,
@@ -256,7 +260,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
256260
call_expr.hir_id,
257261
scope,
258262
)?;
259-
pick.emit_unstable_name_collision_hint(self.tcx, method_name.span, call_expr.hir_id);
263+
pick.maybe_emit_unstable_name_collision_hint(self.tcx, method_name.span, call_expr.hir_id);
260264
Ok(pick)
261265
}
262266

@@ -589,7 +593,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
589593
ProbeScope::TraitsInScope,
590594
)?;
591595

592-
pick.emit_unstable_name_collision_hint(self.tcx, span, expr_id);
596+
pick.maybe_emit_unstable_name_collision_hint(self.tcx, span, expr_id);
593597

594598
self.lint_fully_qualified_call_from_2018(
595599
span,

compiler/rustc_hir_typeck/src/method/probe.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
13311331
}
13321332

13331333
impl<'tcx> Pick<'tcx> {
1334-
pub fn emit_unstable_name_collision_hint(
1334+
/// In case there were unstable name collisions, emit them as a lint.
1335+
pub fn maybe_emit_unstable_name_collision_hint(
13351336
&self,
13361337
tcx: TyCtxt<'tcx>,
13371338
span: Span,

0 commit comments

Comments
 (0)