--- title: T-spec meeting 2025-04-24 tags: ["T-spec", "meeting", "minutes"] date: 2025-04-24 discussion: https://rust-lang.zulipchat.com/#narrow/stream/399173-t-spec/topic/Meeting.202025-04-24 url: https://hackmd.io/S1JRdRkxThqqcfAnUiyopA --- Attendees: - Joel Marcey (30 minutes only) - Pete LeVasseur (30 minutes) - Pierre-Emmanuel Patry - TC - Eric Huss - Jack Huey - Josh Triplett Regrets: - Niko Matsakis Agenda: - Any updates to the agenda? - New Reference Issues and PRs - `let` chains documentation - Reference and FLS chapter comparison ## Agenda Updates - [Lexing update](https://mjw.woodcraft.me.uk/2025-lexeywan/) using a PEG (parsing expression grammar) from [Matthew Woodcraft](https://rust-lang.zulipchat.com/#narrow/channel/399173-t-spec/topic/Lexing/near/513945890)? TC: We talked about this on the lang side (or was it on an earlier spec call, I don't recall); this was before the PEG update. In our discussion, we were happy with doing this in the DFA style that the Reference does, and the Reference does already have coverage here. The change to use PEG is unlikely to affect this, and this could end up making this sort of work difficult to merge. Probably it's worth trying to understand what Matthew's motivation is for a separate document here, and it'd be worth going through his document and seeing if anything is missing from the Reference. Joel: Someone (Joel?) to ping Matthew to gauge the motivation for this work as it relates to what is already described in the reference. ## New Reference Issues These are the new reference issues and PRs that have come in since the last meeting: - PR: [Rename "unsized" coercion as "unsizing"](https://github.com/rust-lang/reference/pull/1797) - PR: [Improve documentation of struct expressions](https://github.com/rust-lang/reference/pull/1799) - PR: [Document changes from `feature(more_qualified_paths)`](https://github.com/rust-lang/reference/pull/1800) - Issue: [The reference lacks the specification about the variance of lifetime parameters that have different variances in each position](https://github.com/rust-lang/reference/issues/1801) ## `let` chains documentation https://github.com/rust-lang/reference/pull/1740 TC: There are some issues with this PR, particularly on the grammar, that we should review. Eric: Things changed late in the stabilization here, and that's made this challenging to understand. Josh: `while let` got approved for earlier editions, but there is no expectation that this will affect the current stabilization work. TC: This grammar below which I sketched is known to be wrong, in the sense that it handles `||` but does not handle the other lower-precedence binary operators for which the restriction must also apply. But what it does do correctly is to parse the `||` and `&&` in the right precedence order. ```rust IfExpression -> `if` CondsAndLetExprs BlockExpression IfElse? IfElse -> `else` ( BlockExpression | IfExpression ) CondsAndLetExprs -> LetExpr AfterLetExpr* | AndConds ( ( `||` AndConds )+ | AfterLetExpr+ )? LetExpr -> `let` Pattern `=` EagerScrutinee AndConds -> EagerScrutinee ( `&&` EagerScrutinee )* AfterLetExpr -> `&&` ( LetExpr | EagerScrutinee ) EagerScrutinee -> Scrutinee _except [LazyBooleanExpression]_ ``` TC: Interestingly, in choosing `&&` as the connector for `&& let ..`, it's fortunate that it's unlikely we'd need lower precedence binary operators in the scrutinee, as those don't work at all.` ```rust if let $pat = 1..10 && true {} //~ ERROR if let $pat = 1..(10 && true) {} // How it's parsed. ``` Josh: Observation: some of these examples and corner cases would be simpler if we didn't allow mixing `||` and `&&` without parentheses. Josh: As we go through these, we should maybe look at how we can simply the grammar of Rust itself. TC: In that context, here are other interesting ones: ```rust _ = if move |_| {} {}; //~ OK _ = if move |_| {} + {} {}; //~ OK _ = if move |_| S {} {}; //~ ERROR _ = if break S {} {}; //~ OK, but strange _ = if S {} == S {} {}; //~ ERROR _ = if x == S {} {}; //~ ERROR, but one could debate ``` Type ascription suggested some of these restrictions: - https://github.com/rust-lang/rust/pull/59981 And `Struct { field }` also has the same ambiguity. ## Reference and FLS chapter comparison Still TODO for us.