You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sema: the "unsafe global access … single-thread proof" warning is located in whatever file was current (a <facade …> line) and fires on <c_import …> translations #1590
use c_import("buf.h")
c facade x:
fn last_err
lend
fn main:
print("ok")
with check prints:
warning: unsafe global access is currently covered by the single-thread proof; keep `unsafe` only if future concurrency is intended
--> <facade x>:10:1
10 |
| ^^^^^^^^^^^^^^
Expected
Either no warning — the access is in the c_import translation of set_err, not in a user source; sema_path_is_user_lint_source treats <c_import …> translations as user lint sources — or a warning located at the access in <c_import buf.h>.
Actual
The span is read in whatever source file was current when the deferred pass ran (SemaCheck.w validate_global_data_race_accesses emits from recorded nodes without restoring each access's source context; with facades the last context is a rendered <facade …> file, so the location is an empty line of a synthetic file).
The pass already keeps each access's path (global_race_access_paths[i]); update_source_context_path(path) before the emit locates it. Found while writing the modeled C stage 7 fixtures (test/behavior/c_facade_text.h).
Activity
Sema: the unsafe-global-access advice is located at the recorded acce…