Merge #5766

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>
tree: 67baa61adac64374fc70cf22947212abb83be29f
  1. .cargo/
  2. .github/
  3. .vscode/
  4. crates/
  5. docs/
  6. editors/
  7. xtask/
  8. .gitattributes
  9. .gitignore
  10. bors.toml
  11. Cargo.lock
  12. Cargo.toml
  13. LICENSE-APACHE
  14. LICENSE-MIT
  15. README.md
  16. rustfmt.toml
README.md

rust-analyzer is an experimental modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.

Work on rust-analyzer is sponsored by

Quick Start

https://rust-analyzer.github.io/manual.html#installation

Documentation

If you want to contribute to rust-analyzer or are just curious about how things work under the hood, check the ./docs/dev folder.

If you want to use rust-analyzer's language server with your editor of choice, check the manual folder. It also contains some tips & tricks to help you be more productive when using rust-analyzer.

Communication

For usage and troubleshooting requests, please use “IDEs and Editors” category of the Rust forum:

https://users.rust-lang.org/c/ide/14

For questions about development and implementation, join rls-2.0 working group on Zulip:

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frls-2.2E0

Quick Links

License

Rust analyzer is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.