Skip to content

Imprecise language about function "access" #2135

Open

Description

@umanwizard

vis.usage claims:

Accessing a module, for example, would mean looking inside of it (to import more items). On the other hand, accessing a function would mean that it is invoked.

I don't understand what this is supposed to mean, other than perhaps "usually, the reason you might want to access a function is to invoke it".

But of course while usually true that's not always true.

mod m1 {
    pub fn f() {}
}

fn main() {
    let p: fn() = m1::f;
    println!("{:?}", p);
}

Activity

  1. bitcp commented on Feb 5, 2026

    @bitcp
    Contributor

    Maybe the sentence "On the other hand, accessing a function would mean that it is invoked." should be removed.

    The following sentence comes as:

    Additionally, path expressions and import statements are considered to access an item...

    A function invocation involves a PathExpression, just as in your code snippet where a function is NOT immediately invoked but accessed indeed, and thus can be covered by the PathExpression case.

    It seems we can distinguish two kinds of access as to whether the item in question can appear as the LAST segment of a PathInExpression or a SimplePath. A module item can not whereas other items can. After aforementioned removal the remaining reflects this classification somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-visibilityArea: visibility and privacy

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions