Skip to content

Commit 9ff59b0

Browse files
Add assertion
1 parent 2f2a767 commit 9ff59b0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎compiler/rustc_attr_parsing/src/interface.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ impl<'sess> AttributeParser<'sess> {
145145
/// This can be used for attributes that would be removed before `rustc_ast_lowering`, such as attributes on macro calls.
146146
///
147147
/// Try to use this as little as possible. Attributes *should* be lowered during
148-
/// `rustc_ast_lowering`. Some attributes require access to features to parse, which would
149-
/// crash if you tried to do so through [`parse_limited_all`](Self::parse_limited_all).
150-
/// Therefore, if `parse_filter` is None, then features *must* be provided.
148+
/// `rustc_ast_lowering`.
151149
pub fn parse_limited_all(
152150
sess: &'sess Session,
153151
attrs: &[ast::Attribute],
@@ -159,6 +157,10 @@ impl<'sess> AttributeParser<'sess> {
159157
should_emit: ShouldEmit,
160158
attr_tools: Option<&'sess RegisteredTools>,
161159
) -> Vec<Attribute> {
160+
// Some attributes require access to features to parse.
161+
// Therefore, if `parse_filter` is None, then features *must* be provided.
162+
assert!(parse_filter.is_some() || features.is_some());
163+
162164
let mut p = AttributeParser { features, attr_tools, parse_filter, sess, should_emit };
163165
p.parse_attribute_list(
164166
attrs,

0 commit comments

Comments
 (0)