Skip to content

c_import: translated facade code warns "redundant unsafe prefix inside unsafe context" on every compile (an unsafe *(&raw const __param_…) deref inside an unsafe { … } block) #1704

Closed

Description

@ehartford

Every program that c_imports a header with a by-value record parameter prints, on main d7a3d84 and on stage1 alike:

warning: redundant unsafe prefix inside unsafe context
 --> <c_import c_facade_callbacks.h>:48:27
48 |     unsafe { with_free((((unsafe *(&raw const __param_l as *const Log)).n as *mut c_void) …

(seen on test/behavior/behav_c_facade_retained_callback.w, behav_c_facade_statement_cache.w, behav_c_facade_thread_send.w and 25 other facade fixtures — their stdout is right; the warning is stderr noise from generated code). Generated code must compile clean: the translator wraps the call in unsafe { … } and also spells the record deref with an unsafe prefix. Drop the inner prefix when the expression is already emitted inside an unsafe block (CiPrint's CIE_UNSAFE prints the block form; the prefix form comes from the by-value record parameter rendering). Found sweeping the facade corpus for #1653.

Activity

  1. ehartford commented on Sep 26, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by #1707 (37d87fc): all 57 facade fixtures compile warning-free.

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