about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-26 16:14:51 +0000
committerbors <bors@rust-lang.org>2022-07-26 16:14:51 +0000
commitc2eebd7a50faa2578376a80ceba91bdc75d748e2 (patch)
treecf9ee9f5302ec3cbbd455143aafb0dda30d59a8b /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
parent7a30f62ecf5642174dbc52de122fc0b21e1c15e1 (diff)
parentadd33b65dda4b59b46b5192f3a88a83b771af844 (diff)
downloadrust-c2eebd7a50faa2578376a80ceba91bdc75d748e2.tar.gz
rust-c2eebd7a50faa2578376a80ceba91bdc75d748e2.zip
Auto merge of #12877 - zachs18:inline-def-in-macro, r=zachs18
fix: Insert spaces when inlining a function defined in a macro.

(partially) fixes #12860.

This PR (only) addresses the whitespace issue when inlining functions defined in macros.

Additionally, the indentation/spacing is not ideal, but works, e.g.
```rs
macro_rules! define_function {
    () => { fn test_function_macro() {
        if let Some(3) = 3i32.checked_add(0) {
            println!("3 + 0 == 3");
        }
    } };
}
define_function!();
fn main() {
    test_function_macro();
}
// previously became
// ...
fn main() {
    ifletSome(3)=3i32.checked_add(0){println!("3 + 0 == 3");};
}
// now becomes
// ...
fn main() {
    if let Some(3) = 3i32.checked_add(0){
        println!("3 + 0 == 3");

      };
}
```

The `self` -> `this` problem[^this] is (probably?) a separate problem that I am also looking into.

[^this]: As mentioned in [my comment on the above issue](https://github.com/rust-lang/rust-analyzer/issues/12860#issuecomment-1193231766), inlining a method defined in a macro does not properly replace `self` with the new local `this`.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions