rust-lang / rust-lang/rust-mode

wrong function name in which-function-mode

Open
#211 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Emacs Lisp
Stars
1.3k
Forks
198
PR merge metrics
No merged PRs in 30d

Description

I enable which-function-mode. I noticed a bug that I reduced to this:

fn subroutine_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                      unique_type_id: UniqueTypeId,
                                      signature: ty::PolyFnSig<'tcx>,
                                      span: Span)
                                      -> MetadataCreationResult
{
    for &argument_type in signature.inputs() {
        signature_metadata.push(type_metadata(cx, argument_type, span));
    }
}

Put point on or just before the closing brace of the function. I see the function name reported as in. This happens on any line after the for.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report in which-function-mode with the provided Rust snippet, placing point near the closing brace and after the for loop. Trace how the mode determines the current function name and verify that it reports subroutine_type_metadata rather than in at those positions.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.