diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index 7e50d72e60f7d..3a4319d5d9aad 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -189,7 +189,9 @@ impl<'a> Classifier<'a> {
// leading identifier.
TokenKind::Bang if self.in_macro => {
self.in_macro = false;
- Class::Macro
+ sink(Highlight::Token { text, class: None });
+ sink(Highlight::ExitSpan);
+ return;
}
// Assume that '&' or '*' is the reference or dereference operator
@@ -298,7 +300,9 @@ impl<'a> Classifier<'a> {
},
TokenKind::Ident | TokenKind::RawIdent if lookahead == Some(TokenKind::Bang) => {
self.in_macro = true;
- Class::Macro
+ sink(Highlight::EnterSpan { class: Class::Macro });
+ sink(Highlight::Token { text, class: None });
+ return;
}
TokenKind::Ident => match text {
"ref" | "mut" => Class::RefKeyWord,
diff --git a/src/librustdoc/html/highlight/fixtures/dos_line.html b/src/librustdoc/html/highlight/fixtures/dos_line.html
index 4400f85681d8a..1c8dbffe78c22 100644
--- a/src/librustdoc/html/highlight/fixtures/dos_line.html
+++ b/src/librustdoc/html/highlight/fixtures/dos_line.html
@@ -1,3 +1,3 @@
pub fn foo() {
-println!("foo");
+println!("foo");
}
diff --git a/src/librustdoc/html/highlight/fixtures/sample.html b/src/librustdoc/html/highlight/fixtures/sample.html
index d937246f4665a..4966e0ac6bbd3 100644
--- a/src/librustdoc/html/highlight/fixtures/sample.html
+++ b/src/librustdoc/html/highlight/fixtures/sample.html
@@ -17,11 +17,11 @@
let _ = &foo;
let _ = &&foo;
let _ = *foo;
- mac!(foo, &mut bar);
- assert!(self.length < N && index <= self.length);
+ mac!(foo, &mut bar);
+ assert!(self.length < N && index <= self.length);
}
-macro_rules! bar {
+macro_rules! bar {
($foo:tt) => {};
}