about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-15 06:21:19 +0000
committerbors <bors@rust-lang.org>2024-05-15 06:21:19 +0000
commit44fa5fd39a1d2af41bd7f43bc246a5e4f6d94696 (patch)
treeae05395b8a88ed41b9f129a6ca76daa5184948bf /tests
parent9e7aff794539aa040362f4424eb29207449ffce0 (diff)
parent5f1a120ee5b5dfda12c557cd66853ee93e00232b (diff)
downloadrust-44fa5fd39a1d2af41bd7f43bc246a5e4f6d94696.tar.gz
rust-44fa5fd39a1d2af41bd7f43bc246a5e4f6d94696.zip
Auto merge of #125136 - matthiaskrgr:rollup-ljm15m3, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #124990 (Also expand weak alias tys inside consts inside `expand_weak_alias_tys`)
 - #125108 (coverage: `CoverageIdsInfo::mcdc_bitmap_bytes` is never needed)
 - #125132 (Add `on_unimplemented" typo suggestions)
 - #125135 (Fix the dedup error because of spans from suggestion)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/diagnostic_namespace/suggest_typos.rs18
-rw-r--r--tests/ui/diagnostic_namespace/suggest_typos.stderr40
-rw-r--r--tests/ui/macros/macro-span-issue-116502.rs16
-rw-r--r--tests/ui/macros/macro-span-issue-116502.stderr30
4 files changed, 104 insertions, 0 deletions
diff --git a/tests/ui/diagnostic_namespace/suggest_typos.rs b/tests/ui/diagnostic_namespace/suggest_typos.rs
new file mode 100644
index 00000000000..b25f097a8ad
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/suggest_typos.rs
@@ -0,0 +1,18 @@
+#![deny(unknown_or_malformed_diagnostic_attributes)]
+
+#[diagnostic::onunimplemented]
+//~^ERROR unknown diagnostic attribute
+//~^^HELP an attribute with a similar name exists
+trait X{}
+
+#[diagnostic::un_onimplemented]
+//~^ERROR unknown diagnostic attribute
+//~^^HELP an attribute with a similar name exists
+trait Y{}
+
+#[diagnostic::on_implemented]
+//~^ERROR unknown diagnostic attribute
+//~^^HELP an attribute with a similar name exists
+trait Z{}
+
+fn main(){}
diff --git a/tests/ui/diagnostic_namespace/suggest_typos.stderr b/tests/ui/diagnostic_namespace/suggest_typos.stderr
new file mode 100644
index 00000000000..307311258f2
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/suggest_typos.stderr
@@ -0,0 +1,40 @@
+error: unknown diagnostic attribute
+  --> $DIR/suggest_typos.rs:3:15
+   |
+LL | #[diagnostic::onunimplemented]
+   |               ^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/suggest_typos.rs:1:9
+   |
+LL | #![deny(unknown_or_malformed_diagnostic_attributes)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: an attribute with a similar name exists
+   |
+LL | #[diagnostic::on_unimplemented]
+   |               ~~~~~~~~~~~~~~~~
+
+error: unknown diagnostic attribute
+  --> $DIR/suggest_typos.rs:8:15
+   |
+LL | #[diagnostic::un_onimplemented]
+   |               ^^^^^^^^^^^^^^^^
+   |
+help: an attribute with a similar name exists
+   |
+LL | #[diagnostic::on_unimplemented]
+   |               ~~~~~~~~~~~~~~~~
+
+error: unknown diagnostic attribute
+  --> $DIR/suggest_typos.rs:13:15
+   |
+LL | #[diagnostic::on_implemented]
+   |               ^^^^^^^^^^^^^^
+   |
+help: an attribute with a similar name exists
+   |
+LL | #[diagnostic::on_unimplemented]
+   |               ~~~~~~~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/macros/macro-span-issue-116502.rs b/tests/ui/macros/macro-span-issue-116502.rs
new file mode 100644
index 00000000000..4c254289ee6
--- /dev/null
+++ b/tests/ui/macros/macro-span-issue-116502.rs
@@ -0,0 +1,16 @@
+#![allow(dead_code)]
+#![allow(unused_variables)]
+
+fn bug() {
+    macro_rules! m {
+        () => {
+            _ //~ ERROR the placeholder `_` is not allowed within types on item signatures for structs
+        };
+    }
+    struct S<T = m!()>(m!(), T)
+    where
+        T: Trait<m!()>;
+}
+trait Trait<T> {}
+
+fn main() {}
diff --git a/tests/ui/macros/macro-span-issue-116502.stderr b/tests/ui/macros/macro-span-issue-116502.stderr
new file mode 100644
index 00000000000..da02855660a
--- /dev/null
+++ b/tests/ui/macros/macro-span-issue-116502.stderr
@@ -0,0 +1,30 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
+  --> $DIR/macro-span-issue-116502.rs:7:13
+   |
+LL |             _
+   |             ^
+   |             |
+   |             not allowed in type signatures
+   |             not allowed in type signatures
+   |             not allowed in type signatures
+...
+LL |     struct S<T = m!()>(m!(), T)
+   |                  ----  ---- in this macro invocation
+   |                  |
+   |                  in this macro invocation
+LL |     where
+LL |         T: Trait<m!()>;
+   |                  ---- in this macro invocation
+   |
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: use type parameters instead
+   |
+LL ~             U
+LL |         };
+LL |     }
+LL ~     struct S<U>(m!(), T)
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0121`.