Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/attribute.rs')
-rw-r--r--crates/ide-completion/src/tests/attribute.rs82
1 files changed, 82 insertions, 0 deletions
diff --git a/crates/ide-completion/src/tests/attribute.rs b/crates/ide-completion/src/tests/attribute.rs
index 2a6238997b..9ff490f904 100644
--- a/crates/ide-completion/src/tests/attribute.rs
+++ b/crates/ide-completion/src/tests/attribute.rs
@@ -61,6 +61,7 @@ pub struct Foo(#[m$0] i32);
at target_feature(enable = "…")
at test
at track_caller
+ at unsafe(…)
at used
at warn(…)
md mac
@@ -95,6 +96,7 @@ struct Foo;
at no_mangle
at non_exhaustive
at repr(…)
+ at unsafe(…)
at warn(…)
md proc_macros
kw crate::
@@ -173,6 +175,7 @@ fn attr_on_source_file() {
at no_std
at recursion_limit = "…"
at type_length_limit = …
+ at unsafe(…)
at warn(…)
at windows_subsystem = "…"
kw crate::
@@ -201,6 +204,7 @@ fn attr_on_module() {
at must_use
at no_mangle
at path = "…"
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -224,6 +228,7 @@ fn attr_on_module() {
at must_use
at no_implicit_prelude
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -252,6 +257,7 @@ fn attr_on_macro_rules() {
at macro_use
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -277,6 +283,7 @@ fn attr_on_macro_def() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -303,6 +310,7 @@ fn attr_on_extern_crate() {
at macro_use
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -328,6 +336,7 @@ fn attr_on_use() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -353,6 +362,7 @@ fn attr_on_type_alias() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -387,6 +397,7 @@ struct Foo;
at no_mangle
at non_exhaustive
at repr(…)
+ at unsafe(…)
at warn(…)
md core
kw crate::
@@ -416,6 +427,7 @@ fn attr_on_enum() {
at no_mangle
at non_exhaustive
at repr(…)
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -441,6 +453,7 @@ fn attr_on_const() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -470,6 +483,7 @@ fn attr_on_static() {
at link_section = "…"
at must_use
at no_mangle
+ at unsafe(…)
at used
at warn(…)
kw crate::
@@ -497,6 +511,7 @@ fn attr_on_trait() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -524,6 +539,7 @@ fn attr_on_impl() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -545,6 +561,7 @@ fn attr_on_impl() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -572,6 +589,7 @@ fn attr_with_qualifier() {
at forbid(…)
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
"#]],
);
@@ -592,12 +610,44 @@ fn attr_with_qualifier() {
at must_use
at no_mangle
at on_unimplemented
+ at unsafe(…)
at warn(…)
"#]],
);
}
#[test]
+fn attr_on_unsafe_attr() {
+ check(
+ r#"#[unsafe($0)] static FOO: () = ()"#,
+ expect![[r#"
+ at allow(…)
+ at cfg(…)
+ at cfg_attr(…)
+ at deny(…)
+ at deprecated
+ at doc = "…"
+ at doc = include_str!("…")
+ at doc(alias = "…")
+ at doc(hidden)
+ at expect(…)
+ at export_name = "…"
+ at forbid(…)
+ at global_allocator
+ at link_name = "…"
+ at link_section = "…"
+ at must_use
+ at no_mangle
+ at unsafe(…)
+ at used
+ at warn(…)
+ kw crate::
+ kw self::
+ "#]],
+ );
+}
+
+#[test]
fn attr_diagnostic_on_unimplemented() {
check(
r#"#[diagnostic::on_unimplemented($0)] trait Foo {}"#,
@@ -643,6 +693,7 @@ fn attr_on_extern_block() {
at link
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -665,6 +716,7 @@ fn attr_on_extern_block() {
at link
at must_use
at no_mangle
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -723,6 +775,7 @@ fn attr_on_fn() {
at target_feature(enable = "…")
at test
at track_caller
+ at unsafe(…)
at warn(…)
kw crate::
kw self::
@@ -773,6 +826,7 @@ fn attr_in_source_file_end() {
at target_feature(enable = "…")
at test
at track_caller
+ at unsafe(…)
at used
at warn(…)
kw crate::
@@ -929,6 +983,34 @@ mod cfg {
}
#[test]
+ fn complete_key_attr() {
+ check_edit(
+ "test",
+ r#"
+//- /main.rs cfg:test,dbg=false,opt_level=2
+#[cfg($0)]
+"#,
+ r#"
+#[cfg(test)]
+"#,
+ );
+ }
+
+ #[test]
+ fn complete_key_value_attr() {
+ check_edit(
+ "opt_level",
+ r#"
+//- /main.rs cfg:test,dbg=false,opt_level=2
+#[cfg($0)]
+"#,
+ r#"
+#[cfg(opt_level = $0)]
+"#,
+ );
+ }
+
+ #[test]
fn cfg_target_endian() {
check(
r#"#[cfg(target_endian = $0"#,