Allow ascii whitespace char for doc aliases
This commit is contained in:
parent
efbaa41306
commit
a215151cd3
@ -287,8 +287,9 @@ impl CheckAttrVisitor<'tcx> {
|
||||
self.doc_alias_str_error(meta);
|
||||
return false;
|
||||
}
|
||||
if let Some(c) =
|
||||
doc_alias.chars().find(|&c| c == '"' || c == '\'' || c.is_whitespace())
|
||||
if let Some(c) = doc_alias
|
||||
.chars()
|
||||
.find(|&c| c == '"' || c == '\'' || (c.is_whitespace() && c != ' '))
|
||||
{
|
||||
self.tcx
|
||||
.sess
|
||||
|
@ -11,6 +11,5 @@ pub struct Bar;
|
||||
#[doc(alias = "\n")] //~ ERROR
|
||||
#[doc(alias = "
|
||||
")] //~^ ERROR
|
||||
#[doc(alias = " ")] //~ ERROR
|
||||
#[doc(alias = "\t")] //~ ERROR
|
||||
pub struct Foo;
|
||||
|
@ -36,17 +36,11 @@ LL | #[doc(alias = "
|
||||
LL | | ")]
|
||||
| |_^
|
||||
|
||||
error: ' ' character isn't allowed in `#[doc(alias = "...")]`
|
||||
--> $DIR/check-doc-alias-attr.rs:14:7
|
||||
|
|
||||
LL | #[doc(alias = " ")]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: '\t' character isn't allowed in `#[doc(alias = "...")]`
|
||||
--> $DIR/check-doc-alias-attr.rs:15:7
|
||||
--> $DIR/check-doc-alias-attr.rs:14:7
|
||||
|
|
||||
LL | #[doc(alias = "\t")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
@ -11,6 +11,5 @@ pub struct Bar;
|
||||
#[doc(alias = "\n")] //~ ERROR
|
||||
#[doc(alias = "
|
||||
")] //~^ ERROR
|
||||
#[doc(alias = " ")] //~ ERROR
|
||||
#[doc(alias = "\t")] //~ ERROR
|
||||
pub struct Foo;
|
||||
|
@ -36,17 +36,11 @@ LL | #[doc(alias = "
|
||||
LL | | ")]
|
||||
| |_^
|
||||
|
||||
error: ' ' character isn't allowed in `#[doc(alias = "...")]`
|
||||
--> $DIR/check-doc-alias-attr.rs:14:7
|
||||
|
|
||||
LL | #[doc(alias = " ")]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: '\t' character isn't allowed in `#[doc(alias = "...")]`
|
||||
--> $DIR/check-doc-alias-attr.rs:15:7
|
||||
--> $DIR/check-doc-alias-attr.rs:14:7
|
||||
|
|
||||
LL | #[doc(alias = "\t")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user