diff options
| author | jyn <github@jyn.dev> | 2025-03-16 22:27:09 -0400 |
|---|---|---|
| committer | jyn <github@jyn.dev> | 2025-03-17 01:16:47 -0400 |
| commit | 10bc5acf0d6736bc0a99d55beae739878f94de16 (patch) | |
| tree | 0f8598178cf2c939351bc8f9938aa27a17e1615c /tests | |
| parent | 0998d4095b0f11061f78a3f9c77a87838a4c1cb7 (diff) | |
| download | rust-10bc5acf0d6736bc0a99d55beae739878f94de16.tar.gz rust-10bc5acf0d6736bc0a99d55beae739878f94de16.zip | |
Document `#![register_tool]`
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/tool-attributes/crate-attr.rs | 5 | ||||
| -rw-r--r-- | tests/ui/tool-attributes/multiple-registered.rs | 7 | ||||
| -rw-r--r-- | tests/ui/tool-attributes/nested-disallowed.rs | 4 | ||||
| -rw-r--r-- | tests/ui/tool-attributes/nested-disallowed.stderr | 8 |
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/tool-attributes/crate-attr.rs b/tests/ui/tool-attributes/crate-attr.rs new file mode 100644 index 00000000000..c6d7974945f --- /dev/null +++ b/tests/ui/tool-attributes/crate-attr.rs @@ -0,0 +1,5 @@ +//@ check-pass +//@ compile-flags: -Z crate-attr=feature(register_tool) -Z crate-attr=register_tool(foo) + +#[allow(foo::bar)] +fn main() {} diff --git a/tests/ui/tool-attributes/multiple-registered.rs b/tests/ui/tool-attributes/multiple-registered.rs new file mode 100644 index 00000000000..4d54c2dcb08 --- /dev/null +++ b/tests/ui/tool-attributes/multiple-registered.rs @@ -0,0 +1,7 @@ +//@ check-pass + +#![feature(register_tool)] +#![register_tool(foo, bar, baz)] + +#[allow(foo::a, bar::b, baz::c)] +fn main() {} diff --git a/tests/ui/tool-attributes/nested-disallowed.rs b/tests/ui/tool-attributes/nested-disallowed.rs new file mode 100644 index 00000000000..8e780427761 --- /dev/null +++ b/tests/ui/tool-attributes/nested-disallowed.rs @@ -0,0 +1,4 @@ +#![feature(register_tool)] +#![register_tool(foo::bar)] //~ ERROR only accepts identifiers + +fn main() {} diff --git a/tests/ui/tool-attributes/nested-disallowed.stderr b/tests/ui/tool-attributes/nested-disallowed.stderr new file mode 100644 index 00000000000..1af73fc2f19 --- /dev/null +++ b/tests/ui/tool-attributes/nested-disallowed.stderr @@ -0,0 +1,8 @@ +error: `register_tool` only accepts identifiers + --> $DIR/nested-disallowed.rs:2:18 + | +LL | #![register_tool(foo::bar)] + | ^^^^^^^^ not an identifier + +error: aborting due to 1 previous error + |
