这是indexloc提供的服务,不要输入任何密码
Skip to content

2020-08-17

  • 2020-08-17
  • 0b2b9a5
  • Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
  • Choose a tag to compare

  • 2020-08-17
  • 0b2b9a5
  • Choose a tag to compare

  • Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@bors bors tagged this 16 Aug 20:03
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>
Assets 2
Loading