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 }}
Can't take address of a struct value and set it to a discard pattern #18841
Update: I attempted to write a regression test for this issue and it still fails on current main (commit 1775f42a, 2026-03-31):
module Test
type S =
struct
val Field: int
end
do
let s = S()
let _ = &s // ← still raises FS0421
let a = &s // ← works fine
()
```
Output:
```
Error FS0421: The address of the variable 's' cannot be used at this point (line 11, col 13–14)
My previous comment claiming this was fixed was incorrect — I apologize for the confusion. The let _ = &s case still raises FS0421 while let a = &s works fine. The discriminatory treatment of discard patterns vs. named bindings in address-of expressions is still present. Removing the AI-thinks-issue-fixed label.
Activity
github-actions commentedon Mar 29, 2026
github-actions commentedon Mar 31, 2026
🤖 This is an automated response from Repo Assist.
Update: I attempted to write a regression test for this issue and it still fails on current
main(commit1775f42a, 2026-03-31):My previous comment claiming this was fixed was incorrect — I apologize for the confusion. The
let _ = &scase still raises FS0421 whilelet a = &sworks fine. The discriminatory treatment of discard patterns vs. named bindings in address-of expressions is still present. Removing theAI-thinks-issue-fixedlabel.Add release notes entry for #18841 fix
Fix #18841: let _ = &expr now compiles like let x = &expr (#19811)
[feature/net11-scouting] Update dependencies from dotnet/arcade (#19874)
[feature/net11-scouting] Update dependencies from dotnet/arcade (#19910)