Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
src/libsyntax/feature_gate.rs
Outdated
There was a problem hiding this comment.
Is there a better span to use here?
I suppose used_beginning_vert could become Option<Span>...
There was a problem hiding this comment.
It should be possible to call emit_feature_err immediately from parse_arm, the precise span is available there.
In addition, changes to AST (used_beginning_vert: bool) will likely break rustfmt and you'll have to send PR to rustfmt repo as well, do submodule updates, etc, so I recommend against it.
There was a problem hiding this comment.
Oh, I didn't know that features were already available during parsing!
There was a problem hiding this comment.
I don't know if they are available as well, but it's worth trying, because the alternative is not especially pleasant.
There was a problem hiding this comment.
This needs a // gate-test-match_beginning_vert annotation, so the test is counted as a feature gate test.
There was a problem hiding this comment.
That shouldn't be necessary as long as the test is named correctly, no? That's what tidy said, and most of the other tests (ex) don't have them.
There was a problem hiding this comment.
Okay, if this passes testing, then it's good.
src/libsyntax/parse/parser.rs
Outdated
There was a problem hiding this comment.
This should be just
let beginning_vert = if self.eat(&token::BinOp(token::Or)) {
Some(self.prev_span)
} else {
None
};edit: Nevermind, that can work as well.
c9bb16e to
f4dc91a
Compare
|
I can't find any way to query features in the parser, and I'm pretty sure it doesn't exist. Nothing else in the parser (outside of libsyntax_ext) uses features, and the features need to be parsed! I see a few paths forward:
|
Ok, sorry for pointing the wrong way.
Not issues, just possible inconveniences with updating rustfmt and rls. |
|
r? @arielb1 |
|
r? @petrochenkov - he's our parser guy |
|
But currently, I think a feature gate is wide-open |
src/libsyntax/parse/parser.rs
Outdated
There was a problem hiding this comment.
You should use sess.features.borrow().match_beginning_vert here, otherwise the feature gate won't work
There was a problem hiding this comment.
sess is a ParseSess which does not have a features field.
|
@arielb1 yep! waiting for confirmation that a feature gate is necessary/desired before I reimplement it by mucking with the AST. |
|
@mattico
Let's add a feature gate. |
|
@petrochenkov sounds good, will do! |
f531b24 to
e631b8d
Compare
|
Interesting failures. Taking a look. |
|
I ran a build of rustfmt, it works fine with this change. They only access single fields of Arm, so it doesn't break anything. RLS also works. Clippy was already broken before these changes. |
|
@bors r+ |
|
📌 Commit 22ca03b has been approved by |
|
☀️ Test successful - status-appveyor, status-travis |
cc #44101