Skip to content

Sema.method_may_suspend_current_fiber is a hand list of std method names (Mutex.lock/enter/enter_mut/set, RwLock.read/write/…, Receiver.recv, Once.call_once) #3052

Closed

Description

@ehartford

src/SemaCheck.w method_may_suspend_current_fiber decides whether a std method may suspend the current fiber by matching the owner's and method's spelling against a hand-written list. #3045 added Mutex.lock, RwLock.read and RwLock.write to it; every new std method that blocks on a lock has to be remembered here, and a method that merely delegates (RwLock.read is self.enter()) is listed twice.

This is a second ownership system for a fact a signature or body owns once (D110 spirit: facts come from declarations, never a per-stage name list). The route out: the may-suspend fact is an effect of the method's signature (an attribute on the declaration in lib/std/sync.w / channel.w, or derived from the body's call to sync_wait_for_progress / the runtime's park), recorded by Sema once, read here and by MirLower/AsyncLower.

Until then the list is the mechanism; this issue is the backlog item to retire it.

Activity

  1. added
    bug
    on Nov 6, 2026
  2. added 2 commits that reference this issue on Nov 6, 2026
  3. ehartford commented on Nov 7, 2026

    @ehartford
    ContributorAuthor

    Fixed in #3064 (173ef04) under D195 (delegated): the may-suspend fact is the declaration's — @[suspends] on the std methods in lib/std/sync.w, and the compiler's own declaration of the builtins (Sender.send, Receiver.recv, Task.join_cleanup) beside the names it interns in Sema.w. The hand list in method_may_suspend_current_fiber is gone; §14.3 and the §29.14 attribute index say so. Pinned by test/compile_errors/err_3052_suspends_attribute_in_no_suspend.w.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions