about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-10-27 10:55:26 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-10-30 10:13:41 -0400
commit5339bd1ebeb76ea7304ff07dcf8e6c317ba0ced8 (patch)
treedea8fd60ec5b2aa448b12e491cf8d23053a7892a /compiler
parent57c6ed0c07aaea9c89a192e54b3274464ebe6fbf (diff)
downloadrust-5339bd1ebeb76ea7304ff07dcf8e6c317ba0ced8.tar.gz
rust-5339bd1ebeb76ea7304ff07dcf8e6c317ba0ced8.zip
Add back missing comments
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lexer/src/lib.rs1
-rw-r--r--compiler/rustc_parse/src/parser/pat.rs5
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs1
3 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs
index 84ae2e9dd71..6539419aefb 100644
--- a/compiler/rustc_lexer/src/lib.rs
+++ b/compiler/rustc_lexer/src/lib.rs
@@ -240,6 +240,7 @@ pub fn is_whitespace(c: char) -> bool {
 
     matches!(
         c,
+        // Usual ASCII suspects
         '\u{0009}'   // \t
         | '\u{000A}' // \n
         | '\u{000B}' // vertical tab
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs
index 93a23e3a91a..196790a0ab3 100644
--- a/compiler/rustc_parse/src/parser/pat.rs
+++ b/compiler/rustc_parse/src/parser/pat.rs
@@ -160,7 +160,7 @@ impl<'a> Parser<'a> {
             | token::Comma // e.g. `let (a |,)`.
             | token::CloseDelim(token::Bracket) // e.g. `let [a | ]`.
             | token::CloseDelim(token::Paren) // e.g. `let (a | )`.
-            | token::CloseDelim(token::Brace)
+            | token::CloseDelim(token::Brace) // e.g. `let A { f: a | }`.
             )
         });
         match (is_end_ahead, &self.token.kind) {
@@ -768,11 +768,12 @@ impl<'a> Parser<'a> {
         && !self.token.is_path_segment_keyword() // Avoid e.g. `Self` as it is a path.
         // Avoid `in`. Due to recovery in the list parser this messes with `for ( $pat in $expr )`.
         && !self.token.is_keyword(kw::In)
+        // Try to do something more complex?
         && self.look_ahead(1, |t| !matches!(t.kind, token::OpenDelim(token::Paren) // A tuple struct pattern.
             | token::OpenDelim(token::Brace) // A struct pattern.
             | token::DotDotDot | token::DotDotEq | token::DotDot // A range pattern.
             | token::ModSep // A tuple / struct variant pattern.
-            | token::Not))
+            | token::Not)) // A macro expanding to a pattern.
     }
 
     /// Parses `ident` or `ident @ pat`.
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 6a915727ef1..4e115c62c9e 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -1005,6 +1005,7 @@ impl<'a> Resolver<'a> {
     fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String {
         let res = b.res();
         if b.span.is_dummy() {
+            // These already contain the "built-in" prefix or look bad with it.
             let add_built_in =
                 !matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod);
             let (built_in, from) = if from_prelude {