<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libsyntax/ext/expand.rs, branch 1.6.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.6.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.6.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2015-12-04T08:46:29+00:00</updated>
<entry>
<title>Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelix</title>
<updated>2015-12-04T08:46:29+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2015-12-04T08:46:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=77ed39cfe37a17737e0b2256b1a1689e01c32b26'/>
<id>urn:sha1:77ed39cfe37a17737e0b2256b1a1689e01c32b26</id>
<content type='text'>
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701

- Added syntax support for attributes on expressions and all syntax nodes in statement position.
- Extended `#[cfg]` folder to allow removal of statements, and
of expressions in optional positions like expression lists and trailing
block expressions.
- Extended lint checker to recognize lint levels on expressions and
locals.
- As per RFC, attributes are not yet accepted on `if` expressions.

Examples:
  ```rust
let x = y;
{
        ...
}
assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3));

let FOO = 0;
```

Implementation wise, there are a few rough corners and open questions:
- The parser work ended up a bit ugly.
- The pretty printer change was based mostly on guessing.
- Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts,
  but where it seemed weird to accept attributes and hence the parser doesn't. This includes:
  - const expressions in patterns
  - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls)
  - on range expressions, since `#[attr] x .. y` parses as  `(#[attr] x) .. y`, which is inconsistent with
    `#[attr] .. y` which would parse as `#[attr] (.. y)`
- Attributes are added as additional `Option&lt;Box&lt;Vec&lt;Attribute&gt;&gt;&gt;` fields in expressions and locals.
- Memory impact has not been measured yet.
- A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work:
```rust
let x = {
    #[cfg(foo)]
    Foo { data: x }
    #[cfg(not(foo))]
    Foo { data: y }
};
```
- One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way.
- Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point?
- Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder.
- The work on pretty printer tests for this did trigger, but not fix errors regarding macros:
  - expression `foo![]` prints as `foo!()`
  - expression `foo!{}` prints as `foo!()`
  - statement `foo![];` prints as `foo!();`
  - statement `foo!{};` prints as `foo!();`
  - statement `foo!{}` triggers a `None` unwrap ICE.
</content>
</entry>
<entry>
<title>Improved comments around dropped attributes in the macro expander</title>
<updated>2015-11-30T21:26:03+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2015-11-30T21:26:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3f33cbcbff47182fef3437040c301c8ea30a5afc'/>
<id>urn:sha1:3f33cbcbff47182fef3437040c301c8ea30a5afc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Added stmt_expr_attribute feature gate</title>
<updated>2015-11-26T20:47:44+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2015-11-24T13:56:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=296c3613ca7ed1117788f4e56259d2e426e992d7'/>
<id>urn:sha1:296c3613ca7ed1117788f4e56259d2e426e992d7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Some TLC for the MoveMap trait</title>
<updated>2015-11-26T20:46:12+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2015-11-15T20:19:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c56b47ab8cd2906e30960f05d51855f9f7f5255b'/>
<id>urn:sha1:c56b47ab8cd2906e30960f05d51855f9f7f5255b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fixed macro expander not folding attributes (though I'm not sure if that is actually neccessary)</title>
<updated>2015-11-26T20:46:12+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2015-11-15T17:20:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0608b1d4146fc9fb76860bf71ff2363164f17326'/>
<id>urn:sha1:0608b1d4146fc9fb76860bf71ff2363164f17326</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add syntax support for attributes on expressions and all syntax</title>
<updated>2015-11-26T20:46:12+00:00</updated>
<author>
<name>Marvin Löbel</name>
<email>loebel.marvin@gmail.com</email>
</author>
<published>2015-11-03T16:39:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2a8f358de7ee71934b8129dff5d908730454d7b1'/>
<id>urn:sha1:2a8f358de7ee71934b8129dff5d908730454d7b1</id>
<content type='text'>
nodes in statement position.

Extended #[cfg] folder to allow removal of statements, and
of expressions in optional positions like expression lists and trailing
block expressions.

Extended lint checker to recognize lint levels on expressions and
locals.
</content>
</entry>
<entry>
<title>Add suggestion of similar macro names to `macro undefined` error message</title>
<updated>2015-11-25T23:21:38+00:00</updated>
<author>
<name>Florian Hartwig</name>
<email>florian.j.hartwig@gmail.com</email>
</author>
<published>2015-11-25T23:21:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a5e5c6775629b912fd058e2a595f70e5457b3d46'/>
<id>urn:sha1:a5e5c6775629b912fd058e2a595f70e5457b3d46</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Look up macro names as well when suggesting replacements for function resolve errors</title>
<updated>2015-11-22T01:18:46+00:00</updated>
<author>
<name>Manish Goregaokar</name>
<email>manishsmail@gmail.com</email>
</author>
<published>2015-11-21T09:37:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=99925fb562086ff789df95220104f9d8d5fc8b3c'/>
<id>urn:sha1:99925fb562086ff789df95220104f9d8d5fc8b3c</id>
<content type='text'>
fixes #5780
</content>
</entry>
<entry>
<title>rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`</title>
<updated>2015-11-16T09:35:30+00:00</updated>
<author>
<name>Oliver Schneider</name>
<email>git-spam-no-reply9815368754983@oli-obk.de</email>
</author>
<published>2015-11-13T13:15:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d09220de13a72b283d824285a2883da9e014f3f7'/>
<id>urn:sha1:d09220de13a72b283d824285a2883da9e014f3f7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use deref coercions</title>
<updated>2015-11-10T11:16:28+00:00</updated>
<author>
<name>Seo Sanghyeon</name>
<email>sanxiyn@gmail.com</email>
</author>
<published>2015-11-10T11:16:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=791003ad3c014c1ca12a29d35b4f8530aa4b7b76'/>
<id>urn:sha1:791003ad3c014c1ca12a29d35b4f8530aa4b7b76</id>
<content type='text'>
</content>
</entry>
</feed>
