Consider precedence btw pat : type
(ascription) & p0 | ... | pn
(or_patterns)
#67309
Labels
A-parser
Area: The parsing of Rust source code to an AST
F-bindings_after_at
`#![feature(bindings_after_at)]`
F-or_patterns
`#![feature(or_patterns)]`
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
We should ensure that we consider the precedence of type ascription in relation to or-patterns, e.g.
should probably bind as
(A(x)) | (B(y): T)
and not(A(x) | B(x)): T
. This might not make a semantic difference because both sides should be of the same type, but parsing in the right way is a more iron-clad guarantee of forward-compatibility.For
@
-patterns, this should ideally also bind asbinding @ (sub: T)
as opposed to(binding @ sub): T
when writing e.g.let binding @ sub: T;
. This might be observable via type checking of things likelet ref binding @ A(_): T = scrutinee;
but fortunatelybinding: &T
holds here and notbinding: T
so like with or-patterns above we might be good. Still, before stabilizingF-bindings_after_at
(e.g.binding @ Some(sub_binding)
) we should endeavor to be more sure.The text was updated successfully, but these errors were encountered: