about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-08-31 03:35:33 +0000
committerbors <bors@rust-lang.org>2018-08-31 03:35:33 +0000
commit1114ab684fbad001c4e580326d8eb4d8c4e917d3 (patch)
treeca7e8212e95a1a99912f17d9df0c0313f75b8a0b /src/libsyntax/parse
parent8adc69a5a873dd7e840b7d002ae48a4c638ef7ee (diff)
parent6b1fffae20ce2c542fb6ee860b3ecfadd055abd2 (diff)
downloadrust-1114ab684fbad001c4e580326d8eb4d8c4e917d3.tar.gz
rust-1114ab684fbad001c4e580326d8eb4d8c4e917d3.zip
Auto merge of #53832 - pietroalbini:rollup, r=pietroalbini
Rollup of 20 pull requests

Successful merges:

 - #51760 (Add another PartialEq example)
 - #53113 (Add example for Cow)
 - #53129 (remove `let x = baz` which was obscuring the real error)
 - #53389 (document effect of join on memory ordering)
 - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.)
 - #53476 (Add partialeq implementation for TryFromIntError type)
 - #53513 (Force-inline `shallow_resolve` at its hottest call site.)
 - #53655 (set applicability)
 - #53702 (Fix stabilisation version for macro_vis_matcher.)
 - #53727 (Do not suggest dereferencing in macro)
 - #53732 (save-analysis: Differentiate foreign functions and statics.)
 - #53740 (add llvm-readobj to llvm-tools-preview)
 - #53743 (fix a typo: taget_env -> target_env)
 - #53747 (Rustdoc fixes)
 - #53753 (expand keep-stage --help text)
 - #53756 (Fix typo in comment)
 - #53768 (move file-extension based .gitignore down to src/)
 - #53785 (Fix a comment in src/libcore/slice/mod.rs)
 - #53786 (Replace usages of 'bad_style' with 'nonstandard_style'.)
 - #53806 (Fix UI issues on Implementations on Foreign types)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs6
-rw-r--r--src/libsyntax/parse/mod.rs8
-rw-r--r--src/libsyntax/parse/parser.rs14
3 files changed, 19 insertions, 9 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 448ff9676c9..96584a580f1 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1831,10 +1831,10 @@ mod tests {
     use errors;
     use feature_gate::UnstableFeatures;
     use parse::token;
-    use std::collections::HashSet;
     use std::io;
     use std::path::PathBuf;
     use diagnostics::plugin::ErrorMap;
+    use rustc_data_structures::fx::FxHashSet;
     use rustc_data_structures::sync::Lock;
     use with_globals;
     fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
@@ -1845,10 +1845,10 @@ mod tests {
         ParseSess {
             span_diagnostic: errors::Handler::with_emitter(true, false, Box::new(emitter)),
             unstable_features: UnstableFeatures::from_environment(),
-            config: CrateConfig::new(),
+            config: CrateConfig::default(),
             included_mod_stack: Lock::new(Vec::new()),
             code_map: cm,
-            missing_fragment_specifiers: Lock::new(HashSet::new()),
+            missing_fragment_specifiers: Lock::new(FxHashSet::default()),
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
             non_modrs_mods: Lock::new(vec![]),
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 1136cda5ee3..28d63399b44 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -24,8 +24,8 @@ use symbol::Symbol;
 use tokenstream::{TokenStream, TokenTree};
 use diagnostics::plugin::ErrorMap;
 
+use rustc_data_structures::fx::FxHashSet;
 use std::borrow::Cow;
-use std::collections::HashSet;
 use std::iter;
 use std::path::{Path, PathBuf};
 use std::str;
@@ -46,7 +46,7 @@ pub struct ParseSess {
     pub span_diagnostic: Handler,
     pub unstable_features: UnstableFeatures,
     pub config: CrateConfig,
-    pub missing_fragment_specifiers: Lock<HashSet<Span>>,
+    pub missing_fragment_specifiers: Lock<FxHashSet<Span>>,
     /// Places where raw identifiers were used. This is used for feature gating
     /// raw identifiers
     pub raw_identifier_spans: Lock<Vec<Span>>,
@@ -75,8 +75,8 @@ impl ParseSess {
         ParseSess {
             span_diagnostic: handler,
             unstable_features: UnstableFeatures::from_environment(),
-            config: HashSet::new(),
-            missing_fragment_specifiers: Lock::new(HashSet::new()),
+            config: FxHashSet::default(),
+            missing_fragment_specifiers: Lock::new(FxHashSet::default()),
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
             included_mod_stack: Lock::new(vec![]),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1695d3a8f96..6c50b9c82f2 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -786,7 +786,12 @@ impl<'a> Parser<'a> {
         } else {
             err.span_label(self.span, "expected identifier");
             if self.token == token::Comma && self.look_ahead(1, |t| t.is_ident()) {
-                err.span_suggestion(self.span, "remove this comma", String::new());
+                err.span_suggestion_with_applicability(
+                    self.span,
+                    "remove this comma",
+                    String::new(),
+                    Applicability::MachineApplicable,
+                );
             }
         }
         err
@@ -6083,7 +6088,12 @@ impl<'a> Parser<'a> {
                                                                 self.this_token_to_string()));
                 if self.token.is_ident() {
                     // This is likely another field; emit the diagnostic and keep going
-                    err.span_suggestion(sp, "try adding a comma", ",".into());
+                    err.span_suggestion_with_applicability(
+                        sp,
+                        "try adding a comma",
+                        ",".into(),
+                        Applicability::MachineApplicable,
+                    );
                     err.emit();
                 } else {
                     return Err(err)