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
Bundle emitter: a refused mutable droppable global that is never rebound gets an exact let fix-it #2369
Bundle Level 0 (D39) refuses a mutable global of a droppable type: nobody drops bundle storage (src/compiler/BundleInterfaceEmit.w, global_text: is_mut && type_needs_drop_frozen). D119 step 3 hit this in production shape: the migrator emitted tommyds' HASH32..INTHASH64 tables as pub var ... : List[...] and tommyds-wo-build failed. The migrator now spells a stable binding for a file-scope array (PR #2364), but hand-written code can still land on the bare refusal with no guidance toward the one-token fix.
Eric's question (2026-10-12): why doesn't the emitter just convert it? Answer recorded so it is not relitigated: var -> let changes the binding's meaning and the .wi fingerprint must agree with source (D65: a downstream stage never picks a meaning; defaults pick representations, never meanings). Auto-conversion would also hide the drop problem for bundle-internal rebinding. The emitter refuses loudly — that part is right.
Proposal
When the emitter refuses a mutable droppable global, check Sema's evidence for whether the binding is ever rebound (whole-binding assignment). Interior mutation — field/index writes, mut self calls — is fine under a stable binding (spec §9.1c), so it does not block the suggestion; only reassignment of the binding itself does. Sema already records global writes (global_write_records / record_global_place_write in SemaCheck, built for the §9.1c/§21.1 race rules); the diagnostic needs the rebound-vs-interior distinction from that data, completed if necessary (note the std/runtime-module carve-out in record_global_data_race_access).
Never rebound: the refusal names the exact fix: spell it let (a stable binding), e.g. pub let HASH32: List[hash32_test], and notes that interior writes remain legal under §9.1c.
Rebound somewhere: refusal unchanged (no suggestion, or names the rebinding site so the author sees why let is not available).
The .wi spelling is never altered by the emitter; the programmer (or migrator) makes the change at the source.
Acceptance
A bundle-interface-tests refusal case: a pub var List global that is only read or written in place refuses with the let fix-it in the message.
A second case: a pub var List global that some body rebinds refuses without the fix-it (ideally naming the rebinding site).
Fingerprint behavior unchanged; no silent conversion anywhere.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced in source: the refusal (src/compiler/BundleInterfaceEmit.w:538-539) still reads "is a mutable global of a droppable type (…); nobody drops bundle storage (Level 0)" with no fix-it, even when the global is never rebound.
post-release: it reaches only bundle authors, and the migrator already emits the stable binding (#2364).
Fixed in #3257. Sema records the first site that rebinds a mutable global whole (global_rebind_sites). The refusal now ends 'no body rebinds it, so spell it let (pub let TABLE: List[i32])' or 'it is rebound at :, so it cannot be a let'. The emitter still never changes the spelling. Tests: bundle-interface-tests wi_refuse_var_droppable, wi_refuse_var_rebound.
Activity
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced in source: the refusal (src/compiler/BundleInterfaceEmit.w:538-539) still reads "is a mutable global of a droppable type (…); nobody drops bundle storage (Level 0)" with no fix-it, even when the global is never rebound.post-release: it reaches only bundle authors, and the migrator already emits the stable binding (#2364).
Issues batch G: #2680 #1153 #2369 #2761 #1014 (#3257)
ehartford commentedon Nov 11, 2026
Fixed in #3257. Sema records the first site that rebinds a mutable global whole (
global_rebind_sites). The refusal now ends 'no body rebinds it, so spell itlet(pub let TABLE: List[i32])' or 'it is rebound at :, so it cannot be alet'. The emitter still never changes the spelling. Tests: bundle-interface-testswi_refuse_var_droppable,wi_refuse_var_rebound.