Skip to content

Use final path segment for diagnostic #138075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
CallableKind::Function
};
maybe_emit_help(def_id, path.segments[0].ident, args, callable_kind);
maybe_emit_help(def_id, path.segments.last().unwrap().ident, args, callable_kind);
}
hir::ExprKind::MethodCall(method, _receiver, args, _span) => {
let Some(def_id) =
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/typeck/issue-84768.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ help: the return type of this call is `{integer}` due to the type of the argumen
LL | <F as FnOnce(&mut u8)>::call_once(f, 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^
| |
| this argument influences the return type of `FnOnce`
| this argument influences the return type of `call_once`
note: method defined here
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ help: the return type of this call is `u32` due to the type of the argument pass
LL | <i32 as Add<i32>>::add(1u32, 2);
| ^^^^^^^^^^^^^^^^^^^^^^^----^^^^
| |
| this argument influences the return type of `Add`
| this argument influences the return type of `add`
note: method defined here
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: change the type of the numeric literal from `u32` to `i32`
Expand All @@ -48,7 +48,7 @@ help: the return type of this call is `u32` due to the type of the argument pass
LL | <i32 as Add<i32>>::add(1, 2u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^----^
| |
| this argument influences the return type of `Add`
| this argument influences the return type of `add`
note: method defined here
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: change the type of the numeric literal from `u32` to `i32`
Expand Down
Loading