Skip to content

check: an unsafe call inside an uninstantiated generic body passes the module check (unsafe-context checking is per-instantiation) #2235

Closed

Description

@ehartford

On #2208 (D100 unsafe helpers) with check lib/std/collections/trie.w (and sorted_vec.w, hash_index.w) reported ok after lookup/slot_at/find became unsafe fn while their safe callers in the same generic impls (Trie[V].insert, SortedVec[T].get, HashIndex[K, V].contains, …) still called them bare. The error ("unsafe function call requires unsafe context") appeared only when a fixture instantiated the types. Whether a call needs an unsafe context is a property of the spelling, not of T: the check belongs to the template body, once, at declaration — the same way a syntactic rule is checked — so a module check is complete and a library author sees the error without a consumer. A tool that said ok over a real error is a bug (AGENTS.md).

Activity

  1. changed the title [-]check: an unsafe call inside an uninstantiated generic body passes of the module (unsafe-context checking is per-instantiation)[/-] [+]check: an unsafe call inside an uninstantiated generic body passes the module check (unsafe-context checking is per-instantiation)[/+] on Oct 7, 2026
  2. ehartford commented on Oct 7, 2026

    @ehartford
    ContributorAuthor

    Merged in db013d9 (PR #2247), battery green on 4bd97c6.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions