]> git.lizzy.rs Git - rust.git/commitdiff
Merge #5766
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Sun, 16 Aug 2020 20:03:06 +0000 (20:03 +0000)
committerGitHub <noreply@github.com>
Sun, 16 Aug 2020 20:03:06 +0000 (20:03 +0000)
5766: Hacky support for fn-like proc macros r=matklad a=jonas-schievink

It turns out that this is all that's needed to get something like this working:

```rust
#[proc_macro]
pub fn function_like_macro(_args: TokenStream) -> TokenStream {
    TokenStream::from_str("fn fn_success() {}").unwrap()
}
```

```rust
function_like_macro!();

fn f() {
    fn_success();
}
```

The drawback is that it also makes this work, because there is no distinction between different proc macro kinds in the rest of r-a:

```rust
#[derive(function_like_macro)]
struct S {}

fn f() {
    fn_success();
}
```

Another issue is that it seems to panic, and then panic, when using this on the rustc code base, due to some issue in the inscrutable proc macro bridge code.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

Trivial merge