rust-lang / rust-lang/fls

"invoke" for functions

Open
#462 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-method-call C-enhancement S-waiting-on-author
Dominant language
reStructuredText
Stars
497
Forks
41
Avg merge
3h 52m
Merged PRs (30d)
4

Description

The spec relies on the notion of "invoking" a function in several places, but the process is never defined.

For example §6.12.1:9 (fls_yrr1s0tucgvh) says:

If the callee type is a function item type or a function pointer type, then the value is the result of invoking the corresponding function with the argument operands.

Compare §6.19:7 (fls_bqmwlona6l5w) for return expression, which is written in terms of activation frames and transfer of control.

Something needs to say that a pattern match happens between the argument operands and the patterns represented by the function's FunctionParameterPatterns, effectively resulting in additional local variables.

Compare this text from the Rust Reference:

The block of a function is conceptually wrapped in a block that binds the argument patterns and then returns the value of the function's block.

This needs to tie up with §14.4.1:3 "The binding of a function parameter is in scope within the related function body", and with §15.5 "Passing Conventions".

A different definition would be needed for external functions (and that one has to deal with variadics).

Contributor guide

Open the contributing guide

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

Read §6.12.1:9, §6.19:7, §14.4.1:3, and §15.5 to compare invocation with return expressions, parameter binding, and passing conventions. Define invocation for function items and function pointers, then address external functions and variadics; the specification is complete when these cases and their parameter-pattern bindings are explicitly connected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.