1
Fork 0

Migrate doc_comment_on_fn_param, forbidden_attr_on_fn_param

This commit is contained in:
finalchild 2022-08-18 17:46:01 +09:00
parent 269c85390c
commit c6903c04b1
3 changed files with 24 additions and 12 deletions

View file

@ -372,19 +372,9 @@ impl<'a> AstValidator<'a> {
})
.for_each(|attr| {
if attr.is_doc_comment() {
self.err_handler()
.struct_span_err(
attr.span,
"documentation comments cannot be applied to function parameters",
)
.span_label(attr.span, "doc comments are not allowed here")
.emit();
self.session.emit_err(DocCommentOnFnParam { span: attr.span });
} else {
self.err_handler().span_err(
attr.span,
"allow, cfg, cfg_attr, deny, expect, \
forbid, and warn are the only allowed built-in attributes in function parameters",
);
self.session.emit_err(ForbiddenAttrOnFnParam { span: attr.span });
}
});
}