<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libproc_macro, branch 1.25.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.25.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.25.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2018-02-06T14:43:01+00:00</updated>
<entry>
<title>proc_macro: don't panic parsing ..= (fix #47950)</title>
<updated>2018-02-06T14:43:01+00:00</updated>
<author>
<name>Alex Burka</name>
<email>alex@alexburka.com</email>
</author>
<published>2018-02-06T14:43:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3cf73f40fb7217471dfe7394b73e67f53cfefc49'/>
<id>urn:sha1:3cf73f40fb7217471dfe7394b73e67f53cfefc49</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Auto merge of #46551 - jseyfried:improve_legacy_modern_macro_interaction, r=nrc</title>
<updated>2018-01-12T10:00:09+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2018-01-12T10:00:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0b90e4e8cd068910f604f3e1fb5d03cc01f1658f'/>
<id>urn:sha1:0b90e4e8cd068910f604f3e1fb5d03cc01f1658f</id>
<content type='text'>
macros: improve 1.0/2.0 interaction

This PR supports using unhygienic macros from hygienic macros without breaking the latter's hygiene.
```rust
// crate A:
#[macro_export]
macro_rules! m1 { () =&gt; {
    f(); // unhygienic: this macro needs `f` in its environment
    fn g() {} // (1) unhygienic: `g` is usable outside the macro definition
} }

// crate B:
#![feature(decl_macro)]
extern crate A;
use A::m1;

macro m2() {
    fn f() {} // (2)
    m1!(); // After this PR, `f()` in the expansion resolves to (2), not (3)
    g(); // After this PR, this resolves to `fn g() {}` from the above expansion.
         // Today, it is a resolution error.
}

fn test() {
    fn f() {} // (3)
    m2!(); // Today, `m2!()` can see (3) even though it should be hygienic.
    fn g() {} // Today, this conflicts with `fn g() {}` from the expansion, even though it should be hygienic.
}
```

Once this PR lands, you can make an existing unhygienic macro hygienic by wrapping it in a hygienic macro. There is an [example](https://github.com/rust-lang/rust/pull/46551/commits/b766fa887dc0e4b923a38751fe4d570e35a75710) of this in the tests.

r? @nrc
</content>
</entry>
<entry>
<title>Auto merge of #47099 - SergioBenitez:master, r=jseyfried</title>
<updated>2018-01-06T12:02:36+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2018-01-06T12:02:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a9a03d9bfb0e82322439fe6c252ebd4ba6f23d98'/>
<id>urn:sha1:a9a03d9bfb0e82322439fe6c252ebd4ba6f23d98</id>
<content type='text'>
Add 'Span::parent()' and 'Span::source()' to proc_macro API.

As the title suggests: a couple of useful methods for `proc_macro`.
</content>
</entry>
<entry>
<title>Rollup merge of #47150 - dtolnay:join, r=jseyfried</title>
<updated>2018-01-05T09:22:08+00:00</updated>
<author>
<name>kennytm</name>
<email>kennytm@gmail.com</email>
</author>
<published>2018-01-05T09:22:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5a5b16ad065aa4fdd21f4ad696ab91a825f8f781'/>
<id>urn:sha1:5a5b16ad065aa4fdd21f4ad696ab91a825f8f781</id>
<content type='text'>
Return None from Span::join if in different files

Fixes #47148. r? @abonander
</content>
</entry>
<entry>
<title>Add 'Span.parent()' and 'Span.source()' to proc_macro API.</title>
<updated>2018-01-03T08:20:33+00:00</updated>
<author>
<name>Sergio Benitez</name>
<email>sb@sergio.bz</email>
</author>
<published>2018-01-01T02:30:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ab365be1406919d4da42442b70c153296980ba52'/>
<id>urn:sha1:ab365be1406919d4da42442b70c153296980ba52</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Span::resolved_at and Span::located_at to combine behavior of two spans</title>
<updated>2018-01-03T07:43:52+00:00</updated>
<author>
<name>David Tolnay</name>
<email>dtolnay@gmail.com</email>
</author>
<published>2018-01-03T07:29:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=000e907c1fc73ca249252cba3b2c9b1a20de857d'/>
<id>urn:sha1:000e907c1fc73ca249252cba3b2c9b1a20de857d</id>
<content type='text'>
Proc macro spans serve two mostly unrelated purposes: controlling name
resolution and controlling error messages. It can be useful to mix the
name resolution behavior of one span with the line/column error message
locations of a different span.

In particular, consider the case of a trait brought into scope within
the def_site of a custom derive. I want to invoke trait methods on the
fields of the user's struct. If the field type does not implement the
right trait, I want the error message to underline the corresponding
struct field.

Generating the method call with the def_site span is not ideal -- it
compiles and runs but error messages sadly always point to the derive
attribute like we saw with Macros 1.1.

```
  |
4 | #[derive(HeapSize)]
  |          ^^^^^^^^
```

Generating the method call with the same span as the struct field's
ident or type is not correct -- it shows the right underlines but fails
to resolve to the trait in scope at the def_site.

```
  |
7 |     bad: std::thread::Thread,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
```

The correct span for the method call is one that combines the def_site's
name resolution with the struct field's line/column.

```
field.span.resolved_at(Span::def_site())

// equivalently
Span::def_site().located_at(field.span)
```

Adding both because which one is more natural will depend on context.
</content>
</entry>
<entry>
<title>Return None from Span::join if in different files</title>
<updated>2018-01-03T07:37:36+00:00</updated>
<author>
<name>David Tolnay</name>
<email>dtolnay@gmail.com</email>
</author>
<published>2018-01-03T07:37:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2b9add2c165c4e397aeb02e1d11c57621ad11dbe'/>
<id>urn:sha1:2b9add2c165c4e397aeb02e1d11c57621ad11dbe</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #46690 - mystor:pub_line_column, r=jseyfried</title>
<updated>2017-12-15T14:26:58+00:00</updated>
<author>
<name>Steve Klabnik</name>
<email>steve@steveklabnik.com</email>
</author>
<published>2017-12-15T14:26:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1375be833af1ee94edac08cad87e1f64c9ab827f'/>
<id>urn:sha1:1375be833af1ee94edac08cad87e1f64c9ab827f</id>
<content type='text'>
Expose the line and column fields from the proc_macro::LineColumn struct

Right now the `LineColumn` struct is pretty useless because the fields are private.

This patch just marks the fields as public, which seems like the easiest solution.
</content>
</entry>
<entry>
<title>Use PathBuf instead of String where applicable</title>
<updated>2017-12-14T10:22:08+00:00</updated>
<author>
<name>Oliver Schneider</name>
<email>git-spam-no-reply9815368754983@oli-obk.de</email>
</author>
<published>2017-12-14T07:09:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d732da813bac73d2c81caddd06df3df3d9609e3d'/>
<id>urn:sha1:d732da813bac73d2c81caddd06df3df3d9609e3d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Improve interaction between macros 2.0 and `macro_rules!`.</title>
<updated>2017-12-13T21:33:03+00:00</updated>
<author>
<name>Jeffrey Seyfried</name>
<email>jeffrey.seyfried@gmail.com</email>
</author>
<published>2017-11-29T09:05:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d052d28d70b31fac942765da137f794835e6536e'/>
<id>urn:sha1:d052d28d70b31fac942765da137f794835e6536e</id>
<content type='text'>
</content>
</entry>
</feed>
