Repository: rust-lang/rust-analyzer
Pull request #13670 (2022-11-24 21:27:21)

Add `deriveHelper` to `semanticTokenTypes` section of package.json


Patch:
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index f13088cd90..8f93dad06e 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -360,20 +360,13 @@ impl FlycheckActor {
     }
 }
 
-struct JodGroupChild(GroupChild);
-
-impl Drop for JodGroupChild {
-    fn drop(&mut self) {
-        _ = self.0.kill();
-        _ = self.0.wait();
-    }
-}
+struct JodChild(GroupChild);
 
 /// A handle to a cargo process used for fly-checking.
 struct CargoHandle {
     /// The handle to the actual cargo process. As we cannot cancel directly from with
     /// a read syscall dropping and therefore terminating the process is our best option.
-    child: JodGroupChild,
+    child: JodChild,
     thread: jod_thread::JoinHandle<io::Result<(bool, String)>>,
     receiver: Receiver<CargoMessage>,
 }
@@ -381,7 +374,7 @@ struct CargoHandle {
 impl CargoHandle {
     fn spawn(mut command: Command) -> std::io::Result<CargoHandle> {
         command.stdout(Stdio::piped()).stderr(Stdio::piped()).stdin(Stdio::null());
-        let mut child = command.group_spawn().map(JodGroupChild)?;
+        let mut child = command.group_spawn().map(JodChild)?;
 
         let stdout = child.0.inner().stdout.take().unwrap();
         let stderr = child.0.inner().stderr.take().unwrap();
diff --git a/crates/hir-expand/src/builtin_fn_macro.rs b/crates/hir-expand/src/builtin_fn_macro.rs
index 985954d44e..7b19518e25 100644
--- a/crates/hir-expand/src/builtin_fn_macro.rs
+++ b/crates/hir-expand/src/builtin_fn_macro.rs
@@ -379,10 +379,15 @@ fn compile_error_expand(
     tt: &tt::Subtree,
 ) -> ExpandResult<ExpandedEager> {
     let err = match &*tt.token_trees {
-        [tt::TokenTree::Leaf(tt::Leaf::Literal(it))] => match unquote_str(it) {
-            Some(unquoted) => ExpandError::Other(unquoted.into()),
-            None => ExpandError::Other("`compile_error!` argument must be a string".into()),
-        },
+        [tt::TokenTree::Leaf(tt::Leaf::Literal(it))] => {
+            let text = it.text.as_str();
+            if text.starts_with('"') && text.ends_with('"') {
+                // FIXME: does not handle raw strings
+                ExpandError::Other(text[1..text.len() - 1].into())
+            } else {
+                ExpandError::Other("`compile_error!` argument must be a string".into())
+            }
+        }
         _ => ExpandError::Other("`compile_error!` argument must be a string".into()),
     };
 
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 161bcc5c8d..2b3793659c 100644
--- a/crates/ide-assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
@@ -107,14 +107,6 @@ fn add_missing_impl_members_inner(
 ) -> Option<()> {
     let _p = profile::span("add_missing_impl_members_inner");
     let impl_def = ctx.find_node_at_offset::<ast::Impl>()?;
-
-    if ctx.token_at_offset().all(|t| {
-        t.parent_ancestors()
-            .any(|s| ast::BlockExpr::can_cast(s.kind()) || ast::ParamList::can_cast(s.kind()))
-    }) {
-        return None;
-    }
-
     let target_scope = ctx.sema.scope(impl_def.syntax())?;
     let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?;
 
@@ -1351,95 +1343,4 @@ impl PartialEq for SomeStruct {
 "#,
         );
     }
-
-    #[test]
-    fn test_ignore_function_body() {
-        check_assist_not_applicable(
-            add_missing_default_members,
-            r#"
-trait Trait {
-    type X;
-    fn foo(&self);
-    fn bar(&self) {}
-}
-
-impl Trait for () {
-    type X = u8;
-    fn foo(&self) {$0
-        let x = 5;
-    }
-}"#,
-        )
-    }
-
-    #[test]
-    fn test_ignore_param_list() {
-        check_assist_not_applicable(
-            add_missing_impl_members,
-            r#"
-trait Trait {
-    type X;
-    fn foo(&self);
-    fn bar(&self);
-}
-
-impl Trait for () {
-    type X = u8;
-    fn foo(&self$0) {
-        let x = 5;
-    }
-}"#,
-        )
-    }
-
-    #[test]
-    fn test_ignore_scope_inside_function() {
-        check_assist_not_applicable(
-            add_missing_impl_members,
-            r#"
-trait Trait {
-    type X;
-    fn foo(&self);
-    fn bar(&self);
-}
-
-impl Trait for () {
-    type X = u8;
-    fn foo(&self) {
-        let x = async {$0 5 };
-    }
-}"#,
-        )
-    }
-
-    #[test]
-    fn test_apply_outside_function() {
-        check_assist(
-            add_missing_default_members,
-            r#"
-trait Trait {
-    type X;
-    fn foo(&self);
-    fn bar(&self) {}
-}
-
-impl Trait for () {
-    type X = u8;
-    fn foo(&self)$0 {}
-}"#,
-            r#"
-trait Trait {
-    type X;
-    fn foo(&self);
-    fn bar(&self) {}
-}
-
-impl Trait for () {
-    type X = u8;
-    fn foo(&self) {}
-
-    $0fn bar(&self) {}
-}"#,
-        )
-    }
 }
diff --git a/crates/ide-assists/src/handlers/generate_impl.rs b/crates/ide-assists/src/handlers/generate_impl.rs
index 690c97e26d..9af26c04eb 100644
--- a/crates/ide-assists/src/handlers/generate_impl.rs
+++ b/crates/ide-assists/src/handlers/generate_impl.rs
@@ -1,17 +1,14 @@
 use syntax::ast::{self, AstNode, HasName};
 
-use crate::{
-    utils::{generate_impl_text, generate_trait_impl_text},
-    AssistContext, AssistId, AssistKind, Assists,
-};
+use crate::{utils::generate_impl_text, AssistContext, AssistId, AssistKind, Assists};
 
 // Assist: generate_impl
 //
 // Adds a new inherent impl for a type.
 //
 // ```
-// struct Ctx$0<T: Clone> {
-//     data: T,
+// struct Ctx<T: Clone> {
+//     data: T,$0
 // }
 // ```
 // ->
@@ -29,10 +26,6 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
     let name = nominal.name()?;
     let target = nominal.syntax().text_range();
 
-    if let Some(_) = ctx.find_node_at_offset::<ast::RecordFieldList>() {
-        return None;
-    }
-
     acc.add(
         AssistId("generate_impl", AssistKind::Generate),
         format!("Generate impl for `{name}`"),
@@ -53,393 +46,145 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
     )
 }
 
-// Assist: generate_trait_impl
-//
-// Adds a new trait impl for a type.
-//
-// ```
-// struct $0Ctx<T: Clone> {
-//     data: T,
-// }
-// ```
-// ->
-// ```
-// struct Ctx<T: Clone> {
-//     data: T,
-// }
-//
-// impl<T: Clone> $0 for Ctx<T> {
-//
-// }
-// ```
-pub(crate) fn generate_trait_impl(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
-    let nominal = ctx.find_node_at_offset::<ast::Adt>()?;
-    let name = nominal.name()?;
-    let target = nominal.syntax().text_range();
-
-    if let Some(_) = ctx.find_node_at_offset::<ast::RecordFieldList>() {
-        return None;
-    }
-
-    acc.add(
-        AssistId("generate_trait_impl", AssistKind::Generate),
-        format!("Generate trait impl for `{name}`"),
-        target,
-        |edit| {
-            let start_offset = nominal.syntax().text_range().end();
-            match ctx.config.snippet_cap {
-                Some(cap) => {
-                    let snippet = generate_trait_impl_text(&nominal, "$0", "");
-                    edit.insert_snippet(cap, start_offset, snippet);
-                }
-                None => {
-                    let text = generate_trait_impl_text(&nominal, "", "");
-                    edit.insert(start_offset, text);
-                }
-            }
-        },
-    )
-}
-
 #[cfg(test)]
 mod tests {
     use crate::tests::{check_assist, check_assist_target};
 
     use super::*;
 
+    // FIXME: break up into separate test fns
     #[test]
     fn test_add_impl() {
         check_assist(
             generate_impl,
-            r#"
-                struct Foo$0 {}
-            "#,
-            r#"
-                struct Foo {}
-
-                impl Foo {
-                    $0
-                }
-            "#,
+            "struct Foo {$0}\n",
+            "struct Foo {}\n\nimpl Foo {\n    $0\n}\n",
         );
-    }
-
-    #[test]
-    fn test_add_impl_with_generics() {
         check_assist(
             generate_impl,
-            r#"
-                struct Foo$0<T: Clone> {}
-            "#,
-            r#"
-                struct Foo<T: Clone> {}
-
-                impl<T: Clone> Foo<T> {
-                    $0
-                }
-            "#,
+            "struct Foo<T: Clone> {$0}",
+            "struct Foo<T: Clone> {}\n\nimpl<T: Clone> Foo<T> {\n    $0\n}",
         );
-    }
-
-    #[test]
-    fn test_add_impl_with_generics_and_lifetime_parameters() {
         check_assist(
             generate_impl,
-            r#"
-                struct Foo<'a, T: Foo<'a>>$0 {}
-            "#,
-            r#"
-                struct Foo<'a, T: Foo<'a>> {}
-
-                impl<'a, T: Foo<'a>> Foo<'a, T> {
-                    $0
-                }
-            "#,
+            "struct Foo<'a, T: Foo<'a>> {$0}",
+            "struct Foo<'a, T: Foo<'a>> {}\n\nimpl<'a, T: Foo<'a>> Foo<'a, T> {\n    $0\n}",
         );
-    }
-
-    #[test]
-    fn test_add_impl_with_attributes() {
         check_assist(
             generate_impl,
             r#"
-                #[cfg(feature = "foo")]
-                struct Foo<'a, T: Foo$0<'a>> {}
-            "#,
+            struct MyOwnArray<T, const S: usize> {}$0"#,
             r#"
-                #[cfg(feature = "foo")]
-                struct Foo<'a, T: Foo<'a>> {}
+            struct MyOwnArray<T, const S: usize> {}
 
-                #[cfg(feature = "foo")]
-                impl<'a, T: Foo<'a>> Foo<'a, T> {
-                    $0
-                }
-            "#,
+            impl<T, const S: usize> MyOwnArray<T, S> {
+                $0
+            }"#,
         );
-    }
-
-    #[test]
-    fn test_add_impl_with_default_generic() {
         check_assist(
             generate_impl,
             r#"
-                struct Defaulted$0<T = i32> {}
-            "#,
+            #[cfg(feature = "foo")]
+            struct Foo<'a, T: Foo<'a>> {$0}"#,
             r#"
-                struct Defaulted<T = i32> {}
+            #[cfg(feature = "foo")]
+            struct Foo<'a, T: Foo<'a>> {}
 
-                impl<T> Defaulted<T> {
-                    $0
-                }
-            "#,
+            #[cfg(feature = "foo")]
+            impl<'a, T: Foo<'a>> Foo<'a, T> {
+                $0
+            }"#,
         );
-    }
 
-    #[test]
-    fn test_add_impl_with_constrained_default_generic() {
         check_assist(
             generate_impl,
             r#"
-                struct Defaulted$0<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
-            "#,
+            #[cfg(not(feature = "foo"))]
+            struct Foo<'a, T: Foo<'a>> {$0}"#,
             r#"
-                struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
+            #[cfg(not(feature = "foo"))]
+            struct Foo<'a, T: Foo<'a>> {}
 
-                impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b, const S: usize> Defaulted<'a, 'b, T, S> {
-                    $0
-                }
-            "#,
+            #[cfg(not(feature = "foo"))]
+            impl<'a, T: Foo<'a>> Foo<'a, T> {
+                $0
+            }"#,
         );
-    }
 
-    #[test]
-    fn test_add_impl_with_const_defaulted_generic() {
         check_assist(
             generate_impl,
             r#"
-                struct Defaulted$0<const N: i32 = 0> {}
-            "#,
+            struct Defaulted<T = i32> {}$0"#,
             r#"
-                struct Defaulted<const N: i32 = 0> {}
+            struct Defaulted<T = i32> {}
 
-                impl<const N: i32> Defaulted<N> {
-                    $0
-                }
-            "#,
+            impl<T> Defaulted<T> {
+                $0
+            }"#,
         );
-    }
 
-    #[test]
-    fn test_add_impl_with_trait_constraint() {
         check_assist(
             generate_impl,
             r#"
-                pub trait Trait {}
-                struct Struct$0<T>
-                where
-                    T: Trait,
-                {
-                    inner: T,
-                }
-            "#,
+            struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}$0"#,
             r#"
-                pub trait Trait {}
-                struct Struct<T>
-                where
-                    T: Trait,
-                {
-                    inner: T,
-                }
+            struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
 
-                impl<T> Struct<T>
-                where
-                    T: Trait,
-                {
-                    $0
-                }
-            "#,
+            impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b, const S: usize> Defaulted<'a, 'b, T, S> {
+                $0
+            }"#,
         );
-    }
 
-    #[test]
-    fn add_impl_target() {
-        check_assist_target(
-            generate_impl,
-            r#"
-                struct SomeThingIrrelevant;
-                /// Has a lifetime parameter
-                struct Foo$0<'a, T: Foo<'a>> {}
-                struct EvenMoreIrrelevant;
-            "#,
-            "/// Has a lifetime parameter\nstruct Foo<'a, T: Foo<'a>> {}",
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl() {
         check_assist(
-            generate_trait_impl,
-            r#"
-                struct Foo$0 {}
-            "#,
-            r#"
-                struct Foo {}
-
-                impl $0 for Foo {
-
-                }
-            "#,
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl_with_generics() {
-        check_assist(
-            generate_trait_impl,
-            r#"
-                struct Foo$0<T: Clone> {}
-            "#,
-            r#"
-                struct Foo<T: Clone> {}
-
-                impl<T: Clone> $0 for Foo<T> {
-
-                }
-            "#,
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl_with_generics_and_lifetime_parameters() {
-        check_assist(
-            generate_trait_impl,
-            r#"
-                struct Foo<'a, T: Foo<'a>>$0 {}
-            "#,
-            r#"
-                struct Foo<'a, T: Foo<'a>> {}
-
-                impl<'a, T: Foo<'a>> $0 for Foo<'a, T> {
-
-                }
-            "#,
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl_with_attributes() {
-        check_assist(
-            generate_trait_impl,
-            r#"
-                #[cfg(feature = "foo")]
-                struct Foo<'a, T: Foo$0<'a>> {}
-            "#,
-            r#"
-                #[cfg(feature = "foo")]
-                struct Foo<'a, T: Foo<'a>> {}
-
-                #[cfg(feature = "foo")]
-                impl<'a, T: Foo<'a>> $0 for Foo<'a, T> {
-
-                }
-            "#,
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl_with_default_generic() {
-        check_assist(
-            generate_trait_impl,
-            r#"
-                struct Defaulted$0<T = i32> {}
-            "#,
-            r#"
-                struct Defaulted<T = i32> {}
-
-                impl<T> $0 for Defaulted<T> {
-
-                }
-            "#,
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl_with_constrained_default_generic() {
-        check_assist(
-            generate_trait_impl,
-            r#"
-                struct Defaulted$0<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
-            "#,
-            r#"
-                struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
-
-                impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b, const S: usize> $0 for Defaulted<'a, 'b, T, S> {
-
-                }
-            "#,
-        );
-    }
-
-    #[test]
-    fn test_add_trait_impl_with_const_defaulted_generic() {
-        check_assist(
-            generate_trait_impl,
+            generate_impl,
             r#"
-                struct Defaulted$0<const N: i32 = 0> {}
-            "#,
+            struct Defaulted<const N: i32 = 0> {}$0"#,
             r#"
-                struct Defaulted<const N: i32 = 0> {}
+            struct Defaulted<const N: i32 = 0> {}
 
-                impl<const N: i32> $0 for Defaulted<N> {
-
-                }
-            "#,
+            impl<const N: i32> Defaulted<N> {
+                $0
+            }"#,
         );
-    }
 
-    #[test]
-    fn test_add_trait_impl_with_trait_constraint() {
         check_assist(
-            generate_trait_impl,
-            r#"
-                pub trait Trait {}
-                struct Struct$0<T>
-                where
-                    T: Trait,
-                {
-                    inner: T,
-                }
-            "#,
-            r#"
-                pub trait Trait {}
-                struct Struct<T>
-                where
-                    T: Trait,
-                {
-                    inner: T,
-                }
-
-                impl<T> $0 for Struct<T>
-                where
-                    T: Trait,
-                {
+            generate_impl,
+            r#"pub trait Trait {}
+struct Struct<T>$0
+where
+    T: Trait,
+{
+    inner: T,
+}"#,
+            r#"pub trait Trait {}
+struct Struct<T>
+where
+    T: Trait,
+{
+    inner: T,
+}
 
-                }
-            "#,
+impl<T> Struct<T>
+where
+    T: Trait,
+{
+    $0
+}"#,
         );
     }
 
     #[test]
-    fn add_trait_impl_target() {
+    fn add_impl_target() {
         check_assist_target(
-            generate_trait_impl,
-            r#"
-                struct SomeThingIrrelevant;
-                /// Has a lifetime parameter
-                struct Foo$0<'a, T: Foo<'a>> {}
-                struct EvenMoreIrrelevant;
-            "#,
-            "/// Has a lifetime parameter\nstruct Foo<'a, T: Foo<'a>> {}",
+            generate_impl,
+            "
+struct SomeThingIrrelevant;
+/// Has a lifetime parameter
+struct Foo<'a, T: Foo<'a>> {$0}
+struct EvenMoreIrrelevant;
+",
+            "/// Has a lifetime parameter
+struct Foo<'a, T: Foo<'a>> {}",
         );
     }
 }
diff --git a/crates/ide-assists/src/lib.rs b/crates/ide-assists/src/lib.rs
index b12f99cc53..387cc63142 100644
--- a/crates/ide-assists/src/lib.rs
+++ b/crates/ide-assists/src/lib.rs
@@ -247,7 +247,6 @@ mod handlers {
             generate_from_impl_for_enum::generate_from_impl_for_enum,
             generate_function::generate_function,
             generate_impl::generate_impl,
-            generate_impl::generate_trait_impl,
             generate_is_empty_from_len::generate_is_empty_from_len,
             generate_new::generate_new,
             inline_call::inline_call,
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 6c0d712a4f..6b2f22faa7 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -182,7 +182,7 @@ config_data! {
         /// `["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
         ///
         /// Aliased as `"checkOnSave.targets"`.
-        checkOnSave_target | checkOnSave_targets: Option<CheckOnSaveTargets>           = "null",
+        checkOnSave_target | checkOnSave_targets: CheckOnSaveTargets           = "[]",
 
         /// Toggles the additional completions that automatically add imports when completed.
         /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
@@ -1153,15 +1153,10 @@ impl Config {
             }
             Some(_) | None => FlycheckConfig::CargoCommand {
                 command: self.data.checkOnSave_command.clone(),
-                target_triples: self
-                    .data
-                    .checkOnSave_target
-                    .clone()
-                    .and_then(|targets| match &targets.0[..] {
-                        [] => None,
-                        targets => Some(targets.into()),
-                    })
-                    .unwrap_or_else(|| self.data.cargo_target.clone().into_iter().collect()),
+                target_triples: match &self.data.checkOnSave_target.0[..] {
+                    [] => self.data.cargo_target.clone().into_iter().collect(),
+                    targets => targets.into(),
+                },
                 all_targets: self.data.checkOnSave_allTargets,
                 no_default_features: self
                     .data
@@ -2131,11 +2126,8 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
                 "The command will be executed in the project root."
             ],
         },
-        "Option<CheckOnSaveTargets>" => set! {
+        "CheckOnSaveTargets" => set! {
             "anyOf": [
-                {
-                    "type": "null"
-                },
                 {
                     "type": "string",
                 },
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index db41c7bf10..57f950034c 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -190,7 +190,7 @@ cargo check --workspace --message-format=json --all-targets
 ```
 .
 --
-[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`)::
+[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `[]`)::
 +
 --
 Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
diff --git a/editors/code/package.json b/editors/code/package.json
index a3385a3868..eb4f258120 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -640,11 +640,8 @@
                 },
                 "rust-analyzer.checkOnSave.target": {
                     "markdownDescription": "Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.\n\nCan be a single target, e.g. `\"x86_64-unknown-linux-gnu\"` or a list of targets, e.g.\n`[\"aarch64-apple-darwin\", \"x86_64-apple-darwin\"]`.\n\nAliased as `\"checkOnSave.targets\"`.",
-                    "default": null,
+                    "default": [],
                     "anyOf": [
-                        {
-                            "type": "null"
-                        },
                         {
                             "type": "string"
                         },
@@ -1496,6 +1493,11 @@
                 "description": "Style for derives",
                 "superType": "attribute"
             },
+            {
+                "id": "deriveHelper",
+                "description": "Style for derive helpers",
+                "superType": "attribute"
+            },
             {
                 "id": "dot",
                 "description": "Style for .",


Test patch:
diff --git a/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs b/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
index bb45266725..c04cd16519 100644
--- a/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
+++ b/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
@@ -163,8 +163,7 @@ macro_rules! compile_error {
 }
 
 // This expands to nothing (since it's in item position), but emits an error.
-compile_error!("error, with an escaped quote: \"");
-compile_error!(r"this is a raw string");
+compile_error!("error!");
 "#,
         expect![[r##"
 #[rustc_builtin_macro]
@@ -173,8 +172,7 @@ macro_rules! compile_error {
     ($msg:expr,) => ({ /* compiler built-in */ })
 }
 
-/* error: error, with an escaped quote: " */
-/* error: this is a raw string */
+/* error: error! */
 "##]],
     );
 }
diff --git a/crates/ide-assists/src/tests/generated.rs b/crates/ide-assists/src/tests/generated.rs
index d797f07767..c09317572a 100644
--- a/crates/ide-assists/src/tests/generated.rs
+++ b/crates/ide-assists/src/tests/generated.rs
@@ -1249,8 +1249,8 @@ fn doctest_generate_impl() {
     check_doc_test(
         "generate_impl",
         r#####"
-struct Ctx$0<T: Clone> {
-    data: T,
+struct Ctx<T: Clone> {
+    data: T,$0
 }
 "#####,
         r#####"
@@ -1341,27 +1341,6 @@ impl Person {
     )
 }
 
-#[test]
-fn doctest_generate_trait_impl() {
-    check_doc_test(
-        "generate_trait_impl",
-        r#####"
-struct $0Ctx<T: Clone> {
-    data: T,
-}
-"#####,
-        r#####"
-struct Ctx<T: Clone> {
-    data: T,
-}
-
-impl<T: Clone> $0 for Ctx<T> {
-
-}
-"#####,
-    )
-}
-
 #[test]
 fn doctest_inline_call() {
     check_doc_test(