Skip to content

Commit d36961f

Browse files
Rollup merge of #138075 - compiler-errors:final-seg, r=Noratrieb
Use final path segment for diagnostic Test changes should prove the effect of this PR; we want to mention the *function name* not the arbitrary first segment of the path.
2 parents 3f4c31c + 181ef54 commit d36961f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/rustc_hir_typeck/src/demand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12651265
} else {
12661266
CallableKind::Function
12671267
};
1268-
maybe_emit_help(def_id, path.segments[0].ident, args, callable_kind);
1268+
maybe_emit_help(def_id, path.segments.last().unwrap().ident, args, callable_kind);
12691269
}
12701270
hir::ExprKind::MethodCall(method, _receiver, args, _span) => {
12711271
let Some(def_id) =

tests/ui/typeck/issue-84768.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ help: the return type of this call is `{integer}` due to the type of the argumen
2020
LL | <F as FnOnce(&mut u8)>::call_once(f, 1)
2121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^
2222
| |
23-
| this argument influences the return type of `FnOnce`
23+
| this argument influences the return type of `call_once`
2424
note: method defined here
2525
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
2626

tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ help: the return type of this call is `u32` due to the type of the argument pass
2525
LL | <i32 as Add<i32>>::add(1u32, 2);
2626
| ^^^^^^^^^^^^^^^^^^^^^^^----^^^^
2727
| |
28-
| this argument influences the return type of `Add`
28+
| this argument influences the return type of `add`
2929
note: method defined here
3030
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
3131
help: change the type of the numeric literal from `u32` to `i32`
@@ -48,7 +48,7 @@ help: the return type of this call is `u32` due to the type of the argument pass
4848
LL | <i32 as Add<i32>>::add(1, 2u32);
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^^----^
5050
| |
51-
| this argument influences the return type of `Add`
51+
| this argument influences the return type of `add`
5252
note: method defined here
5353
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
5454
help: change the type of the numeric literal from `u32` to `i32`

0 commit comments

Comments
 (0)