diff options
| author | Jana Dönszelmann <jana@donsz.nl> | 2025-08-22 20:52:20 +0200 |
|---|---|---|
| committer | Jana Dönszelmann <jana@donsz.nl> | 2025-08-22 22:30:00 +0200 |
| commit | f6ac728aadbb997eb08feb0499390c034454f9d5 (patch) | |
| tree | 1103b0bec140223ad37b881ae9fa49cf492c00b8 /compiler/rustc_attr_parsing/src/context.rs | |
| parent | f5703d5dd3eec176f86a6e9bf7e668b48b84eabb (diff) | |
| download | rust-f6ac728aadbb997eb08feb0499390c034454f9d5.tar.gz rust-f6ac728aadbb997eb08feb0499390c034454f9d5.zip | |
convert strings to symbols in attr diagnostics
Diffstat (limited to 'compiler/rustc_attr_parsing/src/context.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/context.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index d79177076c7..c5bf23838e2 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -502,10 +502,11 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { }) } + /// produces an error along the lines of `expected one of [foo, meow]` pub(crate) fn expected_specific_argument( &self, span: Span, - possibilities: Vec<&'static str>, + possibilities: &[Symbol], ) -> ErrorGuaranteed { self.emit_err(AttributeParseError { span, @@ -521,10 +522,12 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { }) } + /// produces an error along the lines of `expected one of [foo, meow] as an argument`. + /// i.e. slightly different wording to [`expected_specific_argument`](Self::expected_specific_argument). pub(crate) fn expected_specific_argument_and_list( &self, span: Span, - possibilities: Vec<&'static str>, + possibilities: &[Symbol], ) -> ErrorGuaranteed { self.emit_err(AttributeParseError { span, @@ -540,10 +543,11 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { }) } + /// produces an error along the lines of `expected one of ["foo", "meow"]` pub(crate) fn expected_specific_argument_strings( &self, span: Span, - possibilities: Vec<&'static str>, + possibilities: &[Symbol], ) -> ErrorGuaranteed { self.emit_err(AttributeParseError { span, |
