diff options
| author | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-02-11 13:18:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-11 13:18:04 +0000 |
| commit | da4c09937559e8d93cc6499ec8510a3571449061 (patch) | |
| tree | 4b36e5eb19e477d4221c8f6121e416873c2a8955 /src/tools/rust-analyzer | |
| parent | 4883966818650b8e0f6125f13269244cd8bb6c86 (diff) | |
| parent | 4036a7a77d04e48b0237baac07c7e4d9fc7dd6de (diff) | |
| download | rust-da4c09937559e8d93cc6499ec8510a3571449061.tar.gz rust-da4c09937559e8d93cc6499ec8510a3571449061.zip | |
Merge pull request #19117 from gohome001/implicit-drop-inlay-hints-bug
Fix: don't emit implicit drop inlay hints for macro
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs b/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs index 27c7c3d4981..58dc0fdf62c 100644 --- a/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs +++ b/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs @@ -54,7 +54,8 @@ pub(super) fn hints( }; let range = match terminator.span { MirSpan::ExprId(e) => match source_map.expr_syntax(e) { - Ok(s) => { + // don't show inlay hint for macro + Ok(s) if !s.file_id.is_macro() => { let root = &s.file_syntax(sema.db); let expr = s.value.to_node(root); let expr = expr.syntax(); @@ -69,7 +70,7 @@ pub(super) fn hints( } } } - Err(_) => continue, + _ => continue, }, MirSpan::PatId(p) => match source_map.pat_syntax(p) { Ok(s) => s.value.text_range(), @@ -231,4 +232,25 @@ mod tests { "#, ); } + + #[test] + fn ignore_inlay_hint_for_macro_call() { + check_with_config( + ONLY_DROP_CONFIG, + r#" + struct X; + + macro_rules! my_macro { + () => {{ + let bbb = X; + bbb + }}; + } + + fn test() -> X { + my_macro!() + } +"#, + ); + } } |
