Skip to content

Kernel calls through a qualified path are not exec-threaded #2

Description

@byeongjee

A call inside a #[kernel] body gets __exec threaded through it (and
::<N, _> supplied) only when the path is a single segment starting with a
lowercase letter or _
rewrite.rs:1236-1249:

let single = p.qself.is_none()
    && p.path.leading_colon.is_none()
    && p.path.segments.len() == 1;

So m::k(x) and Self::k(x) compile as ordinary Rust calls with no exec
threading, and a kernel can only be called by a bare name.

The restriction is there because the prelude re-exports math, reduce and
rng as modules, so math::exp(x) and friends have to stay ordinary calls.
Telling the two apart is not possible syntactically — the macro never inspects
types — so this needs a marker of some kind.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions