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
Indexing a struct with no index method is accepted by Sema: captures[1] prints "" in an f-string, invalid MIR when typed #1253
let m = /(a)(b)/.captures("ab").unwrap() // std.regex Captures: get(i) -> Option[Match], text(i) -> str; no index method
print(f"[{m[1]}] [{m[2]}] [{m.text(1)}]") // prints: [] [] [a] — no diagnostic
let x: i32 = m[1] // error: invalid MIR before codegen: use rvalue does not resolve to a concrete MIR type (place local=1 local_ty=96 projs=1 proj0_kind=1)
Sema lets m[1] through on a struct type that implements no indexing (Captures has no IndexPlace/get-by-int surface); MirLower emits an index projection on a struct local. The validator catches it only when the value is demanded at a concrete type; in an f-string the garbage projection renders as an empty string, silently. Expected: a Sema error at m[1] ("type Captures cannot be indexed") — the tool must not stay silent (a rewrite script keyed on c[1] silently rewrote nothing).
Activity
A subscript on a type with no index surface is an error, not a silent…