diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-10-06 14:29:42 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-10-06 14:29:42 +0200 |
| commit | 11f3476c59ee013c017e669676cfaca00a67b3f1 (patch) | |
| tree | 4843dad076d552642cc643250221796dd8239c09 /compiler | |
| parent | accc26abc0e53067d7a97d0fb19800c37a24f844 (diff) | |
| download | rust-11f3476c59ee013c017e669676cfaca00a67b3f1.tar.gz rust-11f3476c59ee013c017e669676cfaca00a67b3f1.zip | |
Enforce whitespace ascii character check for doc alias
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index e8e54c3cfaa..1acaa4c6eff 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -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"), |
