mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Add back missing comments
This commit is contained in:
parent
57c6ed0c07
commit
5339bd1ebe
@ -240,6 +240,7 @@ pub fn is_whitespace(c: char) -> bool {
|
|||||||
|
|
||||||
matches!(
|
matches!(
|
||||||
c,
|
c,
|
||||||
|
// Usual ASCII suspects
|
||||||
'\u{0009}' // \t
|
'\u{0009}' // \t
|
||||||
| '\u{000A}' // \n
|
| '\u{000A}' // \n
|
||||||
| '\u{000B}' // vertical tab
|
| '\u{000B}' // vertical tab
|
||||||
|
@ -160,7 +160,7 @@ impl<'a> Parser<'a> {
|
|||||||
| token::Comma // e.g. `let (a |,)`.
|
| token::Comma // e.g. `let (a |,)`.
|
||||||
| token::CloseDelim(token::Bracket) // e.g. `let [a | ]`.
|
| token::CloseDelim(token::Bracket) // e.g. `let [a | ]`.
|
||||||
| token::CloseDelim(token::Paren) // 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) {
|
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.
|
&& !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 )`.
|
// Avoid `in`. Due to recovery in the list parser this messes with `for ( $pat in $expr )`.
|
||||||
&& !self.token.is_keyword(kw::In)
|
&& !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.
|
&& self.look_ahead(1, |t| !matches!(t.kind, token::OpenDelim(token::Paren) // A tuple struct pattern.
|
||||||
| token::OpenDelim(token::Brace) // A struct pattern.
|
| token::OpenDelim(token::Brace) // A struct pattern.
|
||||||
| token::DotDotDot | token::DotDotEq | token::DotDot // A range pattern.
|
| token::DotDotDot | token::DotDotEq | token::DotDot // A range pattern.
|
||||||
| token::ModSep // A tuple / struct variant pattern.
|
| token::ModSep // A tuple / struct variant pattern.
|
||||||
| token::Not))
|
| token::Not)) // A macro expanding to a pattern.
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses `ident` or `ident @ pat`.
|
/// Parses `ident` or `ident @ pat`.
|
||||||
|
@ -1005,6 +1005,7 @@ impl<'a> Resolver<'a> {
|
|||||||
fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String {
|
fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String {
|
||||||
let res = b.res();
|
let res = b.res();
|
||||||
if b.span.is_dummy() {
|
if b.span.is_dummy() {
|
||||||
|
// These already contain the "built-in" prefix or look bad with it.
|
||||||
let add_built_in =
|
let add_built_in =
|
||||||
!matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod);
|
!matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod);
|
||||||
let (built_in, from) = if from_prelude {
|
let (built_in, from) = if from_prelude {
|
||||||
|
Loading…
Reference in New Issue
Block a user