diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-01-05 20:04:49 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-05 20:04:49 +0000 |
| commit | 149981fbfca9ef2eb3f7636ae99ca97a6b96cb02 (patch) | |
| tree | 6da33b8991f842d6840564762630adff334b46fd | |
| parent | 97838b183c57f2b09304e3cfcfcb94b970e8a1b7 (diff) | |
| parent | b8f4667aa9ff18ebc7730b7b69a0e0f616ef709a (diff) | |
| download | rust-149981fbfca9ef2eb3f7636ae99ca97a6b96cb02.tar.gz rust-149981fbfca9ef2eb3f7636ae99ca97a6b96cb02.zip | |
Merge #11200
11200: Always put a space after dyn in macro pretty-printing r=Veykril a=jplatte Fixes #11100. Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
| -rw-r--r-- | crates/ide_assists/src/handlers/add_missing_impl_members.rs | 41 | ||||
| -rw-r--r-- | crates/ide_db/src/helpers/insert_whitespace_into_node.rs | 2 |
2 files changed, 42 insertions, 1 deletions
diff --git a/crates/ide_assists/src/handlers/add_missing_impl_members.rs b/crates/ide_assists/src/handlers/add_missing_impl_members.rs index a10eca10d11..b6af72cbac5 100644 --- a/crates/ide_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ide_assists/src/handlers/add_missing_impl_members.rs @@ -942,4 +942,45 @@ impl FooB for Foo { "#, ) } + + #[test] + fn macro_trait_dyn_absolute_path() { + // https://github.com/rust-analyzer/rust-analyzer/issues/11100 + check_assist( + add_missing_impl_members, + r#" +macro_rules! foo { + () => { + trait MacroTrait { + fn trait_method(_: &dyn ::core::marker::Sized); + } + } +} +foo!(); +struct Foo; + +impl MacroTrait for Foo { + $0 +} +"#, + r#" +macro_rules! foo { + () => { + trait MacroTrait { + fn trait_method(_: &dyn ::core::marker::Sized); + } + } +} +foo!(); +struct Foo; + +impl MacroTrait for Foo { + fn trait_method(_: &dyn ::core::marker::Sized) { + ${0:todo!()} + } + +} +"#, + ) + } } diff --git a/crates/ide_db/src/helpers/insert_whitespace_into_node.rs b/crates/ide_db/src/helpers/insert_whitespace_into_node.rs index 251a4caa132..9d31966cea6 100644 --- a/crates/ide_db/src/helpers/insert_whitespace_into_node.rs +++ b/crates/ide_db/src/helpers/insert_whitespace_into_node.rs @@ -88,7 +88,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode { LIFETIME_IDENT if is_next(|it| is_text(it), true) => { mods.push(do_ws(after, tok)); } - AS_KW => { + AS_KW | DYN_KW => { mods.push(do_ws(after, tok)); } T![;] => { |
