1
Fork 0

Enforce whitespace ascii character check for doc alias

This commit is contained in:
Guillaume Gomez 2020-10-06 14:29:42 +02:00
parent accc26abc0
commit 11f3476c59
5 changed files with 40 additions and 2 deletions

View file

@ -303,6 +303,16 @@ impl CheckAttrVisitor<'tcx> {
.emit();
return false;
}
if doc_alias.starts_with(' ') || doc_alias.ends_with(' ') {
self.tcx
.sess
.struct_span_err(
meta.span(),
"`#[doc(alias = \"...\")]` cannot start or end with ' '",
)
.emit();
return false;
}
if let Some(err) = match target {
Target::Impl => Some("implementation block"),
Target::ForeignMod => Some("extern block"),