Skip to content

Commit 25e2c2d

Browse files
committed
comments explaining custom objc error messages
1 parent 7c7cb08 commit 25e2c2d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
169169
return None;
170170
};
171171
let Some(classname) = nv.value_as_str() else {
172+
// `#[rustc_objc_class = ...]` is expected to be used as an implementatioin detail
173+
// inside a standard library macro, but `cx.expected_string_literal` exposes too much.
174+
// Use a custom error message instead.
172175
cx.emit_err(ObjcClassExpectedStringLiteral { span: nv.value_span });
173176
return None;
174177
};
@@ -198,6 +201,9 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcSelectorParser {
198201
return None;
199202
};
200203
let Some(methname) = nv.value_as_str() else {
204+
// `#[rustc_objc_selector = ...]` is expected to be used as an implementatioin detail
205+
// inside a standard library macro, but `cx.expected_string_literal` exposes too much.
206+
// Use a custom error message instead.
201207
cx.emit_err(ObjcSelectorExpectedStringLiteral { span: nv.value_span });
202208
return None;
203209
};

0 commit comments

Comments
 (0)