-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
C-lowTechnical complexity: LowTechnical complexity: LowC-socialComplexity: Social in natureComplexity: Social in natureK-tracking-issueKind: Tracking issueKind: Tracking issueP-lowPriority: LowPriority: LowS-actionableStatus: ActionableStatus: Actionable
Description
-
S { 0 }is legal as a pattern but not as an expression- it's a "shorthand" for the unwritable
S { 0: 0 }where both0s are identifiers - ideally we'd reject both I think (would need to crater ofc)
- but I'm also fine with allowing
S { 0 }in expressions just to achieve consistency
- it's a "shorthand" for the unwritable
- tuple field access
$expr.0usizeis illegal (since very recently) but$expr.0x0,$expr.0e1(but not$expr.0e+1thankfully) etc. is still legal- (however
$expr.1!=$expr.01and$expr.0!=$expr.0_, so it all doesn't really matter) - the same thing applies to
builtin # offset_of(…)/core::mem::offset_of!(…)
- (however
-
match () { X }is accepted but notmatch () { X, }(under featurenever_patterns)- a comma may only follow if the pattern "may contain a never pattern" (which includes all macro calls)
- I'm not very happy to have such a heuristic essentially in the grammar
- this issue basically only exists because of
,→|recovery in patterns - to restrict a feature just to keep a nice diagnostic + recovery is questionable imo
- moreover, we could move that diagnostic to a later compiler stage
- const block items permit visibility
- this is mentioned in the tracking issue: Tracking Issue for item-level
constblocks rust-lang/rust#149226 - however, it's under Unresolved Questions while it's clearly undesirable
- we literally have a lint for
pub const _: … = …;now - moreover, I doubt that this could be useful for macro DSLs
- finally, rustc rejects
fn f() { pub const {} }already anyway - I'm going to open an issue or a PR if this doesn't get fixed within the next 6 months (today is 2026-02-08)
- this is mentioned in the tracking issue: Tracking Issue for item-level
- we consider
impl F() -> impl X + Y,impl F() -> dyn X + Yetc. ambiguous but notimpl Fn() -> for<> X + Y- super minor, maybe not even a bug? my head is spinning
- (obviously
impl Fn() -> X + Yis intentionally not considered ambiguous) - similarly,
dyn F() -> fn() -> X + Yis not considered ambiguous - in conclusion, it's quite an artificial & specialized restriction
- more weirdly even, we're allowing
fn f<T: F() -> 'a + Copy>(){}and counting theCopyas a sibling ofF, not of'a; so it gets parsed as(Fn() -> 'a+) + Copy, notFn() -> ('a + Copy) - that happens because we check for the presence of
+when encountering'ain type position without checking whether "+is allowed" in this context (it isn't)
- we accept
(use<>)+even though you're not allowed to parenthesizeuse<…>in "normal" bounds
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-lowTechnical complexity: LowTechnical complexity: LowC-socialComplexity: Social in natureComplexity: Social in natureK-tracking-issueKind: Tracking issueKind: Tracking issueP-lowPriority: LowPriority: LowS-actionableStatus: ActionableStatus: Actionable