diff options
| author | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2025-06-18 22:27:35 +0300 |
|---|---|---|
| committer | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2025-06-23 22:48:20 +0300 |
| commit | aa80a2b62cde51fc9796a66dfed013a581bff706 (patch) | |
| tree | fa2f84142c37f4762399cce580233940c5ff594e /compiler/rustc_attr_parsing/src/parser.rs | |
| parent | 42245d34d22ade32b3f276dcf74deb826841594c (diff) | |
| download | rust-aa80a2b62cde51fc9796a66dfed013a581bff706.tar.gz rust-aa80a2b62cde51fc9796a66dfed013a581bff706.zip | |
Port `#[rustc_skip_during_method_dispatch]` to the new attribute system
Diffstat (limited to 'compiler/rustc_attr_parsing/src/parser.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/parser.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/rustc_attr_parsing/src/parser.rs b/compiler/rustc_attr_parsing/src/parser.rs index e02dc098127..aecaae947c9 100644 --- a/compiler/rustc_attr_parsing/src/parser.rs +++ b/compiler/rustc_attr_parsing/src/parser.rs @@ -169,9 +169,15 @@ impl<'a> ArgParser<'a> { } } - /// Asserts that there are no arguments - pub fn no_args(&self) -> bool { - matches!(self, Self::NoArgs) + /// Assert that there were no args. + /// If there were, get a span to the arguments + /// (to pass to [`AcceptContext::expected_no_args`](crate::context::AcceptContext::expected_no_args)). + pub fn no_args(&self) -> Result<(), Span> { + match self { + Self::NoArgs => Ok(()), + Self::List(args) => Err(args.span), + Self::NameValue(args) => Err(args.eq_span.to(args.value_span)), + } } } |
