Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAmend RFC 550 with (expanded) abstract specification rather than algorithm #1384
Conversation
This comment has been minimized.
This comment has been minimized.
|
I forgot to mention it in amendment as currently written, but: This change is strongly motivated by rust-lang/rust#25658 (that is, this change, along with an implementation I am prototyping, is meant to fix that issue). One thing I have not addressed at all here is whether the change described here would go through warning cycle. I am not sure whether I can easily do that (though in principle I guess I could just run both analyses, and set the new one to warn for the initial release cycle). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
One thing that we may want, in order to land this in practice, is a fragment specifier for the subclass of expressions that corresponds to expressions that can be used as a test in an The reason that we may want such a fragment specifier is because a crater run with my prototype signaled that some crates in the wild are relying on the ability to put Adding a new fragment specifier that those crates could use instead of
|
This comment has been minimized.
This comment has been minimized.
|
This is excellent work @pnkfelix. |
This comment has been minimized.
This comment has been minimized.
|
I found a typo, but I can't find it again... |
cmr
reviewed
Nov 30, 2015
| ``` | ||
|
|
||
| Examples of FOLLOW (expressed as equality relations between sets, to avoid | ||
| incoporating details of FOLLOW(NT) in these examples): |
This comment has been minimized.
This comment has been minimized.
pnkfelix
added some commits
Nov 30, 2015
This comment has been minimized.
This comment has been minimized.
|
So hopefully I'll have a chance soon to incorporate this properly into the RFC, but two new things:
|
This comment has been minimized.
This comment has been minimized.
|
Did a new crater run (the previous one was bad because I was comparing against an old baseline, and so the set of crates had changed in the meantime). Very promising results. Summary:
As a fun aside, the prototype does fix one crate (though I suspect its not a terribly vital one): https://github.com/arthurtw/echo-rs/blob/master/src/lib.rs#L37 |
This was referenced Dec 2, 2015
huonw
reviewed
Dec 3, 2015
|
|
||
| The current legal fragment specifiers are: `item`, `block`, `stmt`, `pat`, | ||
| `expr`, `ty`, `ident`, `path`, `meta`, and `tt`. | ||
|
|
||
| - `FOLLOW(pat)` = `{FatArrow, Comma, Eq}` | ||
| - `FOLLOW(pat)` = `{FatArrow, Comma, Eq, Or, Ident(if), Ident(in)}` |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
pnkfelix
Dec 4, 2015
Author
Member
so how would that work in the presence of closures, i.e. let f = |VariantA(x, _)|VariantB(_, x)| { ... }; ? Seems hard to parse to me.
This comment has been minimized.
This comment has been minimized.
pnkfelix
Dec 4, 2015
Author
Member
(though I guess we would just not allow the generalized pattern form in that context?)
This comment has been minimized.
This comment has been minimized.
pnkfelix
Dec 4, 2015
Author
Member
((which is guess is basically what you said in the comment you linked...))
This comment has been minimized.
This comment has been minimized.
|
Hear ye, hear ye! This RFC amendment is now entering final comment period. |
nikomatsakis
added
the
final-comment-period
label
Dec 4, 2015
This comment has been minimized.
This comment has been minimized.
|
For those like me coming from the subteams report and lacking context: RFC 550 is Macro future-proofing. |
nrc
assigned
pnkfelix
Dec 8, 2015
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis @huonw so, what do you two think: Should I take My personal inclination is to add |
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix I say add it |
This comment has been minimized.
This comment has been minimized.
|
lang team discussed, and decided RFC amendment is good as-is (i.e., it is okay that it is adding |
pnkfelix
added a commit
that referenced
this pull request
Dec 17, 2015
pnkfelix
merged commit 3a16a14
into
rust-lang:master
Dec 17, 2015
pnkfelix
referenced this pull request
Dec 17, 2015
Closed
Tracking issue for RFC amendment #1384 #30450
This comment has been minimized.
This comment has been minimized.
|
and also durka42 on irc asked about the |
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 4, 2016
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 4, 2016
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 4, 2016
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 4, 2016
pnkfelix
referenced this pull request
Jan 5, 2016
Closed
Enable `$($pattern)|+` or equivalent in `macro_rules!` #20843
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 5, 2016
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 5, 2016
This was referenced Jan 7, 2016
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 7, 2016
pnkfelix
added a commit
to pnkfelix/rust
that referenced
this pull request
Jan 7, 2016
This comment has been minimized.
This comment has been minimized.
|
This is making invalid a macro that I’ve been using for about a year, and I don’t know how to fix it. I’d appreciate some help: https://users.rust-lang.org/t/macro-rules-used-like-a-match-expression/4328 |
This comment has been minimized.
This comment has been minimized.
|
I replied in the Discourse thread. It's not pretty :) On Mon, Jan 18, 2016 at 12:50 PM, Simon Sapin notifications@github.com
|
pnkfelix commentedNov 27, 2015
(tracking issue: rust-lang/rust#30450)
Massive redo of Detailed Design of RFC #550; expanded parts of spec in passing.
As noted in the Edit History addition:
$e:expr { stuff }being accepted (which match fragments likebreak { stuff }, significantly limiting future language extensions),tyto includeOpenDelim(Brace), Ident(where), Or(since Rust's grammar already requires all of|foo:TY| {},fn foo() -> TY {}andfn foo() -> TY where {}to work).patto includeOr(since Rust's grammar already requiresmatch (true,false) { PAT | PAT => {} }and|PAT| {}to work). See also RFC issue #1336.Not noted in Edit History addition:
specification from detailed design to explain why each is valid/invalid.
moved the discussion of the algorithm to a non-binding appendix.
diff of amendment (split view)