about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-15 19:50:50 +0000
committerbors <bors@rust-lang.org>2018-10-15 19:50:50 +0000
commit46880f41b7aeb897b8245474196bba9dc11f0e88 (patch)
tree62fe4510055d0d70dc6ea315af27bf09db4dff3b
parent5a52983d690bfdc0d0343c1db14c2c6b2359df2d (diff)
parent562625dda21cbfbce8206c7553991eacd09e714b (diff)
downloadrust-46880f41b7aeb897b8245474196bba9dc11f0e88.tar.gz
rust-46880f41b7aeb897b8245474196bba9dc11f0e88.zip
Auto merge of #55095 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests

Successful merges:

 - #54820 (Closes #54538: `unused_patterns` lint)
 - #54963 (Cleanup rustc/session)
 - #54991 (add test for #23189)
 - #55025 (Add missing lifetime fragment specifier to error message.)
 - #55047 (doc: make core::fmt::Error example more simple)
 - #55048 (Don't collect to vectors where unnecessary)
 - #55060 (clarify pointer add/sub function safety concerns)
 - #55062 (Make EvalContext::step public again)
 - #55066 (Fix incorrect link in println! documentation)
 - #55081 (Deduplicate tests)
 - #55088 (Update rustc documentation link)

Failed merges:

r? @ghost
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--src/libcore/fmt/mod.rs5
-rw-r--r--src/libcore/ptr.rs12
-rw-r--r--src/librustc/hir/lowering.rs5
-rw-r--r--src/librustc/session/config.rs214
-rw-r--r--src/librustc/session/filesearch.rs24
-rw-r--r--src/librustc/session/mod.rs50
-rw-r--r--src/librustc/session/search_paths.rs2
-rw-r--r--src/librustc_driver/driver.rs2
-rw-r--r--src/librustc_lint/unused.rs111
-rw-r--r--src/librustc_mir/interpret/step.rs4
-rw-r--r--src/librustc_traits/lowering.rs7
-rw-r--r--src/librustc_typeck/check/demand.rs10
-rw-r--r--src/libstd/macros.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs11
-rw-r--r--src/test/run-pass/binding/pat-tuple-7.rs1
-rw-r--r--src/test/ui/issues/issue-21356.stderr2
-rw-r--r--src/test/ui/issues/issue-23189.rs (renamed from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs)14
-rw-r--r--src/test/ui/issues/issue-23189.stderr9
-rw-r--r--src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr13
-rw-r--r--src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr13
-rw-r--r--src/test/ui/lint/issue-54538-unused-parens-lint.rs38
-rw-r--r--src/test/ui/lint/issue-54538-unused-parens-lint.stderr42
-rw-r--r--src/test/ui/lint/lint-group-style.rs36
-rw-r--r--src/test/ui/lint/lint-group-style.stderr67
-rw-r--r--src/test/ui/macros/macro-invalid-fragment-spec.stderr2
-rw-r--r--src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr2
27 files changed, 326 insertions, 374 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 49961d02dda..fe6bea9d8dc 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -646,7 +646,7 @@ are:
 * Don't be afraid to ask! The Rust community is friendly and helpful.
 
 [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html
-[gdfrustc]: http://manishearth.github.io/rust-internals-docs/rustc/
+[gdfrustc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
 [gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
 [rif]: http://internals.rust-lang.org
 [rr]: https://doc.rust-lang.org/book/README.html
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index bd253e69db3..75ec0d7d50b 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -96,9 +96,8 @@ pub type Result = result::Result<(), Error>;
 /// use std::fmt::{self, write};
 ///
 /// let mut output = String::new();
-/// match write(&mut output, format_args!("Hello {}!", "world")) {
-///     Err(fmt::Error) => panic!("An error occurred"),
-///     _ => (),
+/// if let Err(fmt::Error) = write(&mut output, format_args!("Hello {}!", "world")) {
+///     panic!("An error occurred");
 /// }
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index b8d7fcffbcc..1c761ba21b3 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -1037,7 +1037,7 @@ impl<T: ?Sized> *const T {
     /// Behavior:
     ///
     /// * Both the starting and resulting pointer must be either in bounds or one
-    ///   byte past the end of *the same* allocated object.
+    ///   byte past the end of the same allocated object.
     ///
     /// * The computed offset, **in bytes**, cannot overflow an `isize`.
     ///
@@ -1255,7 +1255,7 @@ impl<T: ?Sized> *const T {
     /// Behavior:
     ///
     /// * Both the starting and resulting pointer must be either in bounds or one
-    ///   byte past the end of an allocated object.
+    ///   byte past the end of the same allocated object.
     ///
     /// * The computed offset, **in bytes**, cannot overflow an `isize`.
     ///
@@ -1312,7 +1312,7 @@ impl<T: ?Sized> *const T {
     /// Behavior:
     ///
     /// * Both the starting and resulting pointer must be either in bounds or one
-    ///   byte past the end of an allocated object.
+    ///   byte past the end of the same allocated object.
     ///
     /// * The computed offset cannot exceed `isize::MAX` **bytes**.
     ///
@@ -1657,7 +1657,7 @@ impl<T: ?Sized> *mut T {
     /// Behavior:
     ///
     /// * Both the starting and resulting pointer must be either in bounds or one
-    ///   byte past the end of *the same* allocated object.
+    ///   byte past the end of the same allocated object.
     ///
     /// * The computed offset, **in bytes**, cannot overflow an `isize`.
     ///
@@ -1893,7 +1893,7 @@ impl<T: ?Sized> *mut T {
     /// Behavior:
     ///
     /// * Both the starting and resulting pointer must be either in bounds or one
-    ///   byte past the end of an allocated object.
+    ///   byte past the end of the same allocated object.
     ///
     /// * The computed offset, **in bytes**, cannot overflow an `isize`.
     ///
@@ -1950,7 +1950,7 @@ impl<T: ?Sized> *mut T {
     /// Behavior:
     ///
     /// * Both the starting and resulting pointer must be either in bounds or one
-    ///   byte past the end of an allocated object.
+    ///   byte past the end of the same allocated object.
     ///
     /// * The computed offset cannot exceed `isize::MAX` **bytes**.
     ///
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 4d51126621d..e99d6502496 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -60,7 +60,6 @@ use util::nodemap::{DefIdMap, NodeMap};
 
 use std::collections::BTreeMap;
 use std::fmt::Debug;
-use std::iter;
 use std::mem;
 use smallvec::SmallVec;
 use syntax::attr;
@@ -3888,9 +3887,7 @@ impl<'a> LoweringContext<'a> {
                     .collect::<P<[hir::Field]>>();
 
                 let is_unit = fields.is_empty();
-                let struct_path = iter::once("ops")
-                    .chain(iter::once(path))
-                    .collect::<Vec<_>>();
+                let struct_path = ["ops", path];
                 let struct_path = self.std_path(e.span, &struct_path, None, is_unit);
                 let struct_path = hir::QPath::Resolved(None, P(struct_path));
 
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index d8c36f81da3..569e7a24d23 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -490,10 +490,10 @@ pub enum Input {
 }
 
 impl Input {
-    pub fn filestem(&self) -> String {
+    pub fn filestem(&self) -> &str {
         match *self {
-            Input::File(ref ifile) => ifile.file_stem().unwrap().to_str().unwrap().to_string(),
-            Input::Str { .. } => "rust_out".to_string(),
+            Input::File(ref ifile) => ifile.file_stem().unwrap().to_str().unwrap(),
+            Input::Str { .. } => "rust_out",
         }
     }
 
@@ -736,19 +736,19 @@ macro_rules! options {
                     match (value, opt_type_desc) {
                         (Some(..), None) => {
                             early_error(error_format, &format!("{} option `{}` takes no \
-                                                              value", $outputname, key))
+                                                                value", $outputname, key))
                         }
                         (None, Some(type_desc)) => {
                             early_error(error_format, &format!("{0} option `{1}` requires \
-                                                              {2} ({3} {1}=<value>)",
-                                                             $outputname, key,
-                                                             type_desc, $prefix))
+                                                                {2} ({3} {1}=<value>)",
+                                                               $outputname, key,
+                                                               type_desc, $prefix))
                         }
                         (Some(value), Some(type_desc)) => {
                             early_error(error_format, &format!("incorrect value `{}` for {} \
-                                                              option `{}` - {} was expected",
-                                                             value, $outputname,
-                                                             key, type_desc))
+                                                                option `{}` - {} was expected",
+                                                               value, $outputname,
+                                                               key, type_desc))
                         }
                         (None, None) => bug!()
                     }
@@ -758,14 +758,13 @@ macro_rules! options {
             }
             if !found {
                 early_error(error_format, &format!("unknown {} option: `{}`",
-                                                 $outputname, key));
+                                                   $outputname, key));
             }
         }
         return op;
     }
 
     impl<'a> dep_tracking::DepTrackingHash for $struct_name {
-
         fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
             let mut sub_hashes = BTreeMap::new();
             $({
@@ -782,7 +781,7 @@ macro_rules! options {
 
     pub type $setter_name = fn(&mut $struct_name, v: Option<&str>) -> bool;
     pub const $stat: &'static [(&'static str, $setter_name,
-                                     Option<&'static str>, &'static str)] =
+                                Option<&'static str>, &'static str)] =
         &[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ];
 
     #[allow(non_upper_case_globals, dead_code)]
@@ -1062,8 +1061,8 @@ macro_rules! options {
 ) }
 
 options! {CodegenOptions, CodegenSetter, basic_codegen_options,
-         build_codegen_options, "C", "codegen",
-         CG_OPTIONS, cg_type_desc, cgsetters,
+          build_codegen_options, "C", "codegen",
+          CG_OPTIONS, cg_type_desc, cgsetters,
     ar: Option<String> = (None, parse_opt_string, [UNTRACKED],
         "this option is deprecated and does nothing"),
     linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
@@ -1107,13 +1106,13 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
     no_redzone: Option<bool> = (None, parse_opt_bool, [TRACKED],
         "disable the use of the redzone"),
     relocation_model: Option<String> = (None, parse_opt_string, [TRACKED],
-         "choose the relocation model to use (rustc --print relocation-models for details)"),
+        "choose the relocation model to use (rustc --print relocation-models for details)"),
     code_model: Option<String> = (None, parse_opt_string, [TRACKED],
-         "choose the code model to use (rustc --print code-models for details)"),
+        "choose the code model to use (rustc --print code-models for details)"),
     metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
-         "metadata to mangle symbol names with"),
+        "metadata to mangle symbol names with"),
     extra_filename: String = (String::new(), parse_string, [UNTRACKED],
-         "extra data to put in each output filename"),
+        "extra data to put in each output filename"),
     codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
         "divide crate into N units to optimize in parallel"),
     remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED],
@@ -1134,14 +1133,14 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
     panic: Option<PanicStrategy> = (None, parse_panic_strategy,
         [TRACKED], "panic strategy to compile crate with"),
     incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
-          "enable incremental compilation"),
+        "enable incremental compilation"),
     default_linker_libraries: Option<bool> = (None, parse_opt_bool, [UNTRACKED],
-          "allow the linker to link its default libraries"),
+        "allow the linker to link its default libraries"),
 }
 
 options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
-         build_debugging_options, "Z", "debugging",
-         DB_OPTIONS, db_type_desc, dbsetters,
+          build_debugging_options, "Z", "debugging",
+          DB_OPTIONS, db_type_desc, dbsetters,
     codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
         "the backend to use"),
     verbose: bool = (false, parse_bool, [UNTRACKED],
@@ -1211,26 +1210,26 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
     flowgraph_print_all: bool = (false, parse_bool, [UNTRACKED],
         "include all dataflow analysis data in -Z unpretty flowgraph output"),
     print_region_graph: bool = (false, parse_bool, [UNTRACKED],
-         "prints region inference graph. \
-          Use with RUST_REGION_GRAPH=help for more info"),
+        "prints region inference graph. \
+         Use with RUST_REGION_GRAPH=help for more info"),
     parse_only: bool = (false, parse_bool, [UNTRACKED],
-          "parse only; do not compile, assemble, or link"),
+        "parse only; do not compile, assemble, or link"),
     no_codegen: bool = (false, parse_bool, [TRACKED],
-          "run all passes except codegen; no output"),
+        "run all passes except codegen; no output"),
     treat_err_as_bug: bool = (false, parse_bool, [TRACKED],
-          "treat all errors that occur as bugs"),
+        "treat all errors that occur as bugs"),
     report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
-          "immediately print bugs registered with `delay_span_bug`"),
+        "immediately print bugs registered with `delay_span_bug`"),
     external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
-          "show macro backtraces even for non-local macros"),
+        "show macro backtraces even for non-local macros"),
     teach: bool = (false, parse_bool, [TRACKED],
-          "show extended diagnostic help"),
+        "show extended diagnostic help"),
     continue_parse_after_error: bool = (false, parse_bool, [TRACKED],
-          "attempt to recover from parse errors (experimental)"),
+        "attempt to recover from parse errors (experimental)"),
     incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
-          "enable incremental compilation (experimental)"),
+        "enable incremental compilation (experimental)"),
     incremental_queries: bool = (true, parse_bool, [UNTRACKED],
-          "enable incremental compilation support for queries (experimental)"),
+        "enable incremental compilation support for queries (experimental)"),
     incremental_info: bool = (false, parse_bool, [UNTRACKED],
         "print high-level information about incremental reuse (or the lack thereof)"),
     incremental_dump_hash: bool = (false, parse_bool, [UNTRACKED],
@@ -1240,64 +1239,64 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
     incremental_ignore_spans: bool = (false, parse_bool, [UNTRACKED],
         "ignore spans during ICH computation -- used for testing"),
     dump_dep_graph: bool = (false, parse_bool, [UNTRACKED],
-          "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"),
+        "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"),
     query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
-          "enable queries of the dependency graph for regression testing"),
+        "enable queries of the dependency graph for regression testing"),
     profile_queries: bool = (false, parse_bool, [UNTRACKED],
-          "trace and profile the queries of the incremental compilation framework"),
+        "trace and profile the queries of the incremental compilation framework"),
     profile_queries_and_keys: bool = (false, parse_bool, [UNTRACKED],
-          "trace and profile the queries and keys of the incremental compilation framework"),
+        "trace and profile the queries and keys of the incremental compilation framework"),
     no_analysis: bool = (false, parse_bool, [UNTRACKED],
-          "parse and expand the source, but run no analysis"),
+        "parse and expand the source, but run no analysis"),
     extra_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED],
         "load extra plugins"),
     unstable_options: bool = (false, parse_bool, [UNTRACKED],
-          "adds unstable command line options to rustc interface"),
+        "adds unstable command line options to rustc interface"),
     force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
-          "force overflow checks on or off"),
+        "force overflow checks on or off"),
     trace_macros: bool = (false, parse_bool, [UNTRACKED],
-          "for every macro invocation, print its name and arguments"),
+        "for every macro invocation, print its name and arguments"),
     debug_macros: bool = (false, parse_bool, [TRACKED],
-          "emit line numbers debug info inside macros"),
+        "emit line numbers debug info inside macros"),
     keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
-          "don't clear the hygiene data after analysis"),
+        "don't clear the hygiene data after analysis"),
     keep_ast: bool = (false, parse_bool, [UNTRACKED],
-          "keep the AST after lowering it to HIR"),
+        "keep the AST after lowering it to HIR"),
     show_span: Option<String> = (None, parse_opt_string, [TRACKED],
-          "show spans for compiler debugging (expr|pat|ty)"),
+        "show spans for compiler debugging (expr|pat|ty)"),
     print_type_sizes: bool = (false, parse_bool, [UNTRACKED],
-          "print layout information for each type encountered"),
+        "print layout information for each type encountered"),
     print_mono_items: Option<String> = (None, parse_opt_string, [UNTRACKED],
-          "print the result of the monomorphization collection pass"),
+        "print the result of the monomorphization collection pass"),
     mir_opt_level: usize = (1, parse_uint, [TRACKED],
-          "set the MIR optimization level (0-3, default: 1)"),
+        "set the MIR optimization level (0-3, default: 1)"),
     mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
-          "emit noalias metadata for mutable references (default: yes on LLVM >= 6)"),
+        "emit noalias metadata for mutable references (default: yes on LLVM >= 6)"),
     arg_align_attributes: bool = (false, parse_bool, [TRACKED],
-          "emit align metadata for reference arguments"),
+        "emit align metadata for reference arguments"),
     dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED],
-          "dump MIR state at various points in transforms"),
+        "dump MIR state at various points in transforms"),
     dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED],
-          "the directory the MIR is dumped into"),
+        "the directory the MIR is dumped into"),
     dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED],
-          "in addition to `.mir` files, create graphviz `.dot` files"),
+        "in addition to `.mir` files, create graphviz `.dot` files"),
     dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED],
-          "if set, exclude the pass number when dumping MIR (used in tests)"),
+        "if set, exclude the pass number when dumping MIR (used in tests)"),
     mir_emit_validate: usize = (0, parse_uint, [TRACKED],
-          "emit Validate MIR statements, interpreted e.g. by miri (0: do not emit; 1: if function \
-           contains unsafe block, only validate arguments; 2: always emit full validation)"),
+        "emit Validate MIR statements, interpreted e.g. by miri (0: do not emit; 1: if function \
+         contains unsafe block, only validate arguments; 2: always emit full validation)"),
     perf_stats: bool = (false, parse_bool, [UNTRACKED],
-          "print some performance-related statistics"),
+        "print some performance-related statistics"),
     hir_stats: bool = (false, parse_bool, [UNTRACKED],
-          "print some statistics about AST and HIR"),
+        "print some statistics about AST and HIR"),
     mir_stats: bool = (false, parse_bool, [UNTRACKED],
-          "print some statistics about MIR"),
+        "print some statistics about MIR"),
     always_encode_mir: bool = (false, parse_bool, [TRACKED],
-          "encode MIR of all functions into the crate metadata"),
+        "encode MIR of all functions into the crate metadata"),
     osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
-          "pass `-install_name @rpath/...` to the macOS linker"),
+        "pass `-install_name @rpath/...` to the macOS linker"),
     sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],
-                                   "Use a sanitizer"),
+                                    "Use a sanitizer"),
     linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
                                            "Linker flavor"),
     fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
@@ -1313,13 +1312,11 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
     profile: bool = (false, parse_bool, [TRACKED],
                      "insert profiling code"),
     pgo_gen: Option<String> = (None, parse_opt_string, [TRACKED],
-        "Generate PGO profile data, to a given file, or to the default \
-         location if it's empty."),
+        "Generate PGO profile data, to a given file, or to the default location if it's empty."),
     pgo_use: String = (String::new(), parse_string, [TRACKED],
         "Use PGO profile data from the given profile file."),
-    disable_instrumentation_preinliner: bool =
-        (false, parse_bool, [TRACKED], "Disable the instrumentation pre-inliner, \
-        useful for profiling / PGO."),
+    disable_instrumentation_preinliner: bool = (false, parse_bool, [TRACKED],
+        "Disable the instrumentation pre-inliner, useful for profiling / PGO."),
     relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
         "choose which RELRO level to use"),
     nll_subminimal_causes: bool = (false, parse_bool, [UNTRACKED],
@@ -1341,7 +1338,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
     inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
         "control whether #[inline] functions are in all cgus"),
     tls_model: Option<String> = (None, parse_opt_string, [TRACKED],
-         "choose the TLS model to use (rustc --print tls-models for details)"),
+        "choose the TLS model to use (rustc --print tls-models for details)"),
     saturating_float_casts: bool = (false, parse_bool, [TRACKED],
         "make float->int casts UB-free: numbers outside the integer type's range are clipped to \
          the max/min integer respectively, and NaN is mapped to 0"),
@@ -1362,31 +1359,31 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         `hir` (the HIR), `hir,identified`, or
         `hir,typed` (HIR with types for each node)."),
     run_dsymutil: Option<bool> = (None, parse_opt_bool, [TRACKED],
-          "run `dsymutil` and delete intermediate object files"),
+        "run `dsymutil` and delete intermediate object files"),
     ui_testing: bool = (false, parse_bool, [UNTRACKED],
-          "format compiler diagnostics in a way that's better suitable for UI testing"),
+        "format compiler diagnostics in a way that's better suitable for UI testing"),
     embed_bitcode: bool = (false, parse_bool, [TRACKED],
-          "embed LLVM bitcode in object files"),
+        "embed LLVM bitcode in object files"),
     strip_debuginfo_if_disabled: Option<bool> = (None, parse_opt_bool, [TRACKED],
         "tell the linker to strip debuginfo when building without debuginfo enabled."),
     share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED],
-          "make the current crate share its generic instantiations"),
+        "make the current crate share its generic instantiations"),
     chalk: bool = (false, parse_bool, [TRACKED],
-          "enable the experimental Chalk-based trait solving engine"),
+        "enable the experimental Chalk-based trait solving engine"),
     cross_lang_lto: CrossLangLto = (CrossLangLto::Disabled, parse_cross_lang_lto, [TRACKED],
-          "generate build artifacts that are compatible with linker-based LTO."),
+        "generate build artifacts that are compatible with linker-based LTO."),
     no_parallel_llvm: bool = (false, parse_bool, [UNTRACKED],
-          "don't run LLVM in parallel (while keeping codegen-units and ThinLTO)"),
+        "don't run LLVM in parallel (while keeping codegen-units and ThinLTO)"),
     no_leak_check: bool = (false, parse_bool, [UNTRACKED],
         "disables the 'leak check' for subtyping; unsound, but useful for tests"),
     crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
         "inject the given attribute in the crate"),
     self_profile: bool = (false, parse_bool, [UNTRACKED],
-          "run the self profiler"),
+        "run the self profiler"),
     profile_json: bool = (false, parse_bool, [UNTRACKED],
-          "output a json file with profiler results"),
+        "output a json file with profiler results"),
     emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
-          "emits a section containing stack size metadata"),
+        "emits a section containing stack size metadata"),
     plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
           "whether to use the PLT when calling into shared libraries;
           only has effect for PIC code on systems with ELF binaries
@@ -1409,6 +1406,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
     let atomic_cas = sess.target.target.options.atomic_cas;
 
     let mut ret = FxHashSet::default();
+    ret.reserve(6); // the minimum number of insertions
     // Target bindings.
     ret.insert((Symbol::intern("target_os"), Some(Symbol::intern(os))));
     if let Some(ref fam) = sess.target.target.options.target_family {
@@ -1455,7 +1453,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
     if sess.opts.crate_types.contains(&CrateType::ProcMacro) {
         ret.insert((Symbol::intern("proc_macro"), None));
     }
-    return ret;
+    ret
 }
 
 pub fn build_configuration(sess: &Session, mut user_cfg: ast::CrateConfig) -> ast::CrateConfig {
@@ -1471,15 +1469,12 @@ pub fn build_configuration(sess: &Session, mut user_cfg: ast::CrateConfig) -> as
 }
 
 pub fn build_target_config(opts: &Options, sp: &Handler) -> Config {
-    let target = match Target::search(&opts.target_triple) {
-        Ok(t) => t,
-        Err(e) => {
-            sp.struct_fatal(&format!("Error loading target specification: {}", e))
-                .help("Use `--print target-list` for a list of built-in targets")
-                .emit();
-            FatalError.raise();
-        }
-    };
+    let target = Target::search(&opts.target_triple).unwrap_or_else(|e| {
+        sp.struct_fatal(&format!("Error loading target specification: {}", e))
+          .help("Use `--print target-list` for a list of built-in targets")
+          .emit();
+        FatalError.raise();
+    });
 
     let (isize_ty, usize_ty) = match &target.target_pointer_width[..] {
         "16" => (ast::IntTy::I16, ast::UintTy::U16),
@@ -1502,7 +1497,6 @@ pub fn build_target_config(opts: &Options, sp: &Handler) -> Config {
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum OptionStability {
     Stable,
-
     Unstable,
 }
 
@@ -1845,18 +1839,17 @@ pub fn build_session_options_and_crate_config(
     };
 
     let edition = match matches.opt_str("edition") {
-        Some(arg) => match Edition::from_str(&arg){
-            Ok(edition) => edition,
-            Err(_) => early_error(
+        Some(arg) => Edition::from_str(&arg).unwrap_or_else(|_|
+            early_error(
                 ErrorOutputType::default(),
                 &format!(
                     "argument for --edition must be one of: \
-                    {}. (instead was `{}`)",
+                     {}. (instead was `{}`)",
                     EDITION_NAME_LIST,
                     arg
                 ),
             ),
-        }
+        ),
         None => DEFAULT_EDITION,
     };
 
@@ -1865,7 +1858,7 @@ pub fn build_session_options_and_crate_config(
                 ErrorOutputType::default(),
                 &format!(
                     "Edition {} is unstable and only \
-                    available for nightly builds of rustc.",
+                     available for nightly builds of rustc.",
                     edition,
                 )
         )
@@ -1925,9 +1918,8 @@ pub fn build_session_options_and_crate_config(
             for output_type in list.split(',') {
                 let mut parts = output_type.splitn(2, '=');
                 let shorthand = parts.next().unwrap();
-                let output_type = match OutputType::from_shorthand(shorthand) {
-                    Some(output_type) => output_type,
-                    None => early_error(
+                let output_type = OutputType::from_shorthand(shorthand).unwrap_or_else(||
+                    early_error(
                         error_format,
                         &format!(
                             "unknown emission type: `{}` - expected one of: {}",
@@ -1935,7 +1927,7 @@ pub fn build_session_options_and_crate_config(
                             OutputType::shorthands_display(),
                         ),
                     ),
-                };
+                );
                 let path = parts.next().map(PathBuf::from);
                 output_types.insert(output_type, path);
             }
@@ -2063,12 +2055,8 @@ pub fn build_session_options_and_crate_config(
     let target_triple = if let Some(target) = matches.opt_str("target") {
         if target.ends_with(".json") {
             let path = Path::new(&target);
-            match TargetTriple::from_path(&path) {
-                Ok(triple) => triple,
-                Err(_) => {
-                    early_error(error_format, &format!("target file {:?} does not exist", path))
-                }
-            }
+            TargetTriple::from_path(&path).unwrap_or_else(|_|
+                early_error(error_format, &format!("target file {:?} does not exist", path)))
         } else {
             TargetTriple::TargetTriple(target)
         }
@@ -2169,7 +2157,7 @@ pub fn build_session_options_and_crate_config(
             let mut name_parts = name.splitn(2, ':');
             let name = name_parts.next().unwrap();
             let new_name = name_parts.next();
-            (name.to_string(), new_name.map(|n| n.to_string()), kind)
+            (name.to_owned(), new_name.map(|n| n.to_owned()), kind)
         })
         .collect();
 
@@ -2223,10 +2211,8 @@ pub fn build_session_options_and_crate_config(
     let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
     for arg in &matches.opt_strs("extern") {
         let mut parts = arg.splitn(2, '=');
-        let name = match parts.next() {
-            Some(s) => s,
-            None => early_error(error_format, "--extern value must not be empty"),
-        };
+        let name = parts.next().unwrap_or_else(||
+            early_error(error_format, "--extern value must not be empty"));
         let location = parts.next().map(|s| s.to_string());
         if location.is_none() && !is_unstable_enabled {
             early_error(
@@ -2237,7 +2223,7 @@ pub fn build_session_options_and_crate_config(
         };
 
         externs
-            .entry(name.to_string())
+            .entry(name.to_owned())
             .or_default()
             .insert(location);
     }
@@ -2308,9 +2294,7 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
                 "cdylib" => CrateType::Cdylib,
                 "bin" => CrateType::Executable,
                 "proc-macro" => CrateType::ProcMacro,
-                _ => {
-                    return Err(format!("unknown crate type: `{}`", part));
-                }
+                _ => return Err(format!("unknown crate type: `{}`", part))
             };
             if !crate_types.contains(&new_part) {
                 crate_types.push(new_part)
diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs
index 0de5d3d03d5..f410c270bce 100644
--- a/src/librustc/session/filesearch.rs
+++ b/src/librustc/session/filesearch.rs
@@ -41,7 +41,7 @@ impl<'a> FileSearch<'a> {
         F: FnMut(&Path, PathKind)
     {
         let mut visited_dirs = FxHashSet::default();
-
+        visited_dirs.reserve(self.search_paths.paths.len() + 1);
         for (path, kind) in self.search_paths.iter(self.kind) {
             f(path, kind);
             visited_dirs.insert(path.to_path_buf());
@@ -160,7 +160,7 @@ pub fn get_or_default_sysroot() -> PathBuf {
     match env::current_exe() {
         Ok(exe) => {
             match canonicalize(Some(exe)) {
-                Some(mut p) => { p.pop(); p.pop(); return p; },
+                Some(mut p) => { p.pop(); p.pop(); p },
                 None => bug!("can't determine value for sysroot")
             }
         }
@@ -175,18 +175,9 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
     // to lib64/lib32. This would be more foolproof by basing the sysroot off
     // of the directory where librustc is located, rather than where the rustc
     // binary is.
-    //If --libdir is set during configuration to the value other than
+    // If --libdir is set during configuration to the value other than
     // "lib" (i.e. non-default), this value is used (see issue #16552).
 
-    match option_env!("CFG_LIBDIR_RELATIVE") {
-        Some(libdir) if libdir != "lib" => return libdir.into(),
-        _ => if sysroot.join(PRIMARY_LIB_DIR).join(RUST_LIB_DIR).exists() {
-            return PRIMARY_LIB_DIR.into();
-        } else {
-            return SECONDARY_LIB_DIR.into();
-        }
-    }
-
     #[cfg(target_pointer_width = "64")]
     const PRIMARY_LIB_DIR: &'static str = "lib64";
 
@@ -194,6 +185,15 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
     const PRIMARY_LIB_DIR: &'static str = "lib32";
 
     const SECONDARY_LIB_DIR: &'static str = "lib";
+
+    match option_env!("CFG_LIBDIR_RELATIVE") {
+        Some(libdir) if libdir != "lib" => libdir.into(),
+        _ => if sysroot.join(PRIMARY_LIB_DIR).join(RUST_LIB_DIR).exists() {
+            PRIMARY_LIB_DIR.into()
+        } else {
+            SECONDARY_LIB_DIR.into()
+        }
+    }
 }
 
 // The name of rustc's own place to organize libraries.
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 10a506da4ea..e983ddc3108 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -703,8 +703,8 @@ impl Session {
         match self.opts.maybe_sysroot {
             Some(ref sysroot) => sysroot,
             None => self.default_sysroot
-                .as_ref()
-                .expect("missing sysroot and default_sysroot in Session"),
+                        .as_ref()
+                        .expect("missing sysroot and default_sysroot in Session"),
         }
     }
     pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
@@ -727,14 +727,8 @@ impl Session {
     pub fn set_incr_session_load_dep_graph(&self, load: bool) {
         let mut incr_comp_session = self.incr_comp_session.borrow_mut();
 
-        match *incr_comp_session {
-            IncrCompSession::Active {
-                ref mut load_dep_graph,
-                ..
-            } => {
-                *load_dep_graph = load;
-            }
-            _ => {}
+        if let IncrCompSession::Active { ref mut load_dep_graph, .. } = *incr_comp_session {
+            *load_dep_graph = load;
         }
     }
 
@@ -872,9 +866,9 @@ impl Session {
     /// This expends fuel if applicable, and records fuel if applicable.
     pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool {
         let mut ret = true;
-        match self.optimization_fuel_crate {
-            Some(ref c) if c == crate_name => {
-                assert!(self.query_threads() == 1);
+        if let Some(ref c) = self.optimization_fuel_crate {
+            if c == crate_name {
+                assert_eq!(self.query_threads(), 1);
                 let fuel = self.optimization_fuel_limit.get();
                 ret = fuel != 0;
                 if fuel == 0 && !self.out_of_fuel.get() {
@@ -884,14 +878,12 @@ impl Session {
                     self.optimization_fuel_limit.set(fuel - 1);
                 }
             }
-            _ => {}
         }
-        match self.print_fuel_crate {
-            Some(ref c) if c == crate_name => {
-                assert!(self.query_threads() == 1);
+        if let Some(ref c) = self.print_fuel_crate {
+            if c == crate_name {
+                assert_eq!(self.query_threads(), 1);
                 self.print_fuel.set(self.print_fuel.get() + 1);
             }
-            _ => {}
         }
         ret
     }
@@ -1108,14 +1100,11 @@ pub fn build_session_(
     source_map: Lrc<source_map::SourceMap>,
 ) -> Session {
     let host_triple = TargetTriple::from_triple(config::host_triple());
-    let host = match Target::search(&host_triple) {
-        Ok(t) => t,
-        Err(e) => {
-            span_diagnostic
-                .fatal(&format!("Error loading host specification: {}", e))
-                .raise();
-        }
-    };
+    let host = Target::search(&host_triple).unwrap_or_else(|e|
+        span_diagnostic
+            .fatal(&format!("Error loading host specification: {}", e))
+            .raise()
+    );
     let target_cfg = config::build_target_config(&sopts, &span_diagnostic);
 
     let p_s = parse::ParseSess::with_span_handler(span_diagnostic, source_map);
@@ -1135,12 +1124,11 @@ pub fn build_session_(
     let print_fuel_crate = sopts.debugging_opts.print_fuel.clone();
     let print_fuel = LockCell::new(0);
 
-    let working_dir = match env::current_dir() {
-        Ok(dir) => dir,
-        Err(e) => p_s.span_diagnostic
+    let working_dir = env::current_dir().unwrap_or_else(|e|
+        p_s.span_diagnostic
             .fatal(&format!("Current directory is invalid: {}", e))
-            .raise(),
-    };
+            .raise()
+    );
     let working_dir = file_path_mapping.map_prefix(working_dir);
 
     let cgu_reuse_tracker = if sopts.debugging_opts.query_dep_graph {
diff --git a/src/librustc/session/search_paths.rs b/src/librustc/session/search_paths.rs
index be1bfcc0894..768d4f1e5fb 100644
--- a/src/librustc/session/search_paths.rs
+++ b/src/librustc/session/search_paths.rs
@@ -14,7 +14,7 @@ use session::{early_error, config};
 
 #[derive(Clone, Debug)]
 pub struct SearchPaths {
-    paths: Vec<(PathKind, PathBuf)>,
+    crate paths: Vec<(PathKind, PathBuf)>,
 }
 
 pub struct Iter<'a> {
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index b4f95b915eb..223df7cbb18 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -1657,7 +1657,7 @@ pub fn build_output_filenames(
                 .crate_name
                 .clone()
                 .or_else(|| attr::find_crate_name(attrs).map(|n| n.to_string()))
-                .unwrap_or_else(|| input.filestem());
+                .unwrap_or_else(|| input.filestem().to_owned());
 
             OutputFilenames {
                 out_directory: dirpath,
diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs
index 720f2ca7f67..76717548521 100644
--- a/src/librustc_lint/unused.rs
+++ b/src/librustc_lint/unused.rs
@@ -272,7 +272,7 @@ declare_lint! {
 pub struct UnusedParens;
 
 impl UnusedParens {
-    fn check_unused_parens_core(&self,
+    fn check_unused_parens_expr(&self,
                                 cx: &EarlyContext,
                                 value: &ast::Expr,
                                 msg: &str,
@@ -281,46 +281,57 @@ impl UnusedParens {
             let necessary = struct_lit_needs_parens &&
                             parser::contains_exterior_struct_lit(&inner);
             if !necessary {
-                let span_msg = format!("unnecessary parentheses around {}", msg);
-                let mut err = cx.struct_span_lint(UNUSED_PARENS,
-                                                  value.span,
-                                                  &span_msg);
-                // Remove exactly one pair of parentheses (rather than naïvely
-                // stripping all paren characters)
-                let mut ate_left_paren = false;
-                let mut ate_right_paren = false;
-                let parens_removed = pprust::expr_to_string(value)
-                    .trim_matches(|c| {
-                        match c {
-                            '(' => {
-                                if ate_left_paren {
-                                    false
-                                } else {
-                                    ate_left_paren = true;
-                                    true
-                                }
-                            },
-                            ')' => {
-                                if ate_right_paren {
-                                    false
-                                } else {
-                                    ate_right_paren = true;
-                                    true
-                                }
-                            },
-                            _ => false,
-                        }
-                    }).to_owned();
-                err.span_suggestion_short_with_applicability(
-                    value.span,
-                    "remove these parentheses",
-                    parens_removed,
-                    Applicability::MachineApplicable
-                );
-                err.emit();
+                let pattern = pprust::expr_to_string(value);
+                Self::remove_outer_parens(cx, value.span, &pattern, msg);
             }
         }
     }
+
+    fn check_unused_parens_pat(&self,
+                                cx: &EarlyContext,
+                                value: &ast::Pat,
+                                msg: &str) {
+        if let ast::PatKind::Paren(_) = value.node {
+            let pattern = pprust::pat_to_string(value);
+            Self::remove_outer_parens(cx, value.span, &pattern, msg);
+        }
+    }
+
+    fn remove_outer_parens(cx: &EarlyContext, span: Span, pattern: &str, msg: &str) {
+        let span_msg = format!("unnecessary parentheses around {}", msg);
+        let mut err = cx.struct_span_lint(UNUSED_PARENS, span, &span_msg);
+        let mut ate_left_paren = false;
+        let mut ate_right_paren = false;
+        let parens_removed = pattern
+            .trim_matches(|c| {
+                match c {
+                    '(' => {
+                        if ate_left_paren {
+                            false
+                        } else {
+                            ate_left_paren = true;
+                            true
+                        }
+                    },
+                    ')' => {
+                        if ate_right_paren {
+                            false
+                        } else {
+                            ate_right_paren = true;
+                            true
+                        }
+                    },
+                    _ => false,
+                }
+            }).to_owned();
+        err.span_suggestion_short_with_applicability(
+                span,
+                "remove these parentheses",
+                parens_removed,
+                Applicability::MachineApplicable
+            );
+        err.emit();
+    }
 }
 
 impl LintPass for UnusedParens {
@@ -349,7 +360,9 @@ impl EarlyLintPass for UnusedParens {
                     // first "argument" is self (which sometimes needs parens)
                     MethodCall(_, ref args) => (&args[1..], "method"),
                     // actual catch-all arm
-                    _ => { return; }
+                    _ => {
+                        return;
+                    }
                 };
                 // Don't lint if this is a nested macro expansion: otherwise, the lint could
                 // trigger in situations that macro authors shouldn't have to care about, e.g.,
@@ -362,18 +375,32 @@ impl EarlyLintPass for UnusedParens {
                 }
                 let msg = format!("{} argument", call_kind);
                 for arg in args_to_check {
-                    self.check_unused_parens_core(cx, arg, &msg, false);
+                    self.check_unused_parens_expr(cx, arg, &msg, false);
                 }
                 return;
             }
         };
-        self.check_unused_parens_core(cx, &value, msg, struct_lit_needs_parens);
+        self.check_unused_parens_expr(cx, &value, msg, struct_lit_needs_parens);
+    }
+
+    fn check_pat(&mut self, cx: &EarlyContext, p: &ast::Pat) {
+        use ast::PatKind::{Paren, Range};
+        // The lint visitor will visit each subpattern of `p`. We do not want to lint any range
+        // pattern no matter where it occurs in the pattern. For something like `&(a..=b)`, there
+        // is a recursive `check_pat` on `a` and `b`, but we will assume that if there are
+        // unnecessry parens they serve a purpose of readability.
+        if let Paren(ref pat) = p.node {
+            match pat.node {
+                Range(..) => {}
+                _ => self.check_unused_parens_pat(cx, &p, "pattern")
+            }
+        }
     }
 
     fn check_stmt(&mut self, cx: &EarlyContext, s: &ast::Stmt) {
         if let ast::StmtKind::Local(ref local) = s.node {
             if let Some(ref value) = local.init {
-                self.check_unused_parens_core(cx, &value, "assigned value", false);
+                self.check_unused_parens_expr(cx, &value, "assigned value", false);
             }
         }
     }
diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs
index d5e87154480..d15867eacdd 100644
--- a/src/librustc_mir/interpret/step.rs
+++ b/src/librustc_mir/interpret/step.rs
@@ -52,7 +52,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
     }
 
     /// Returns true as long as there are more things to do.
-    fn step(&mut self) -> EvalResult<'tcx, bool> {
+    ///
+    /// This is used by [priroda](https://github.com/oli-obk/priroda)
+    pub fn step(&mut self) -> EvalResult<'tcx, bool> {
         if self.stack.is_empty() {
             return Ok(false);
         }
diff --git a/src/librustc_traits/lowering.rs b/src/librustc_traits/lowering.rs
index 181106d3f84..1e3f0a21cef 100644
--- a/src/librustc_traits/lowering.rs
+++ b/src/librustc_traits/lowering.rs
@@ -306,8 +306,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
     let wf_conditions = iter::once(ty::Binder::dummy(trait_pred.lower()))
         .chain(
             where_clauses
-                .iter()
-                .cloned()
+                .into_iter()
                 .map(|wc| wc.map_bound(|goal| goal.into_well_formed_goal()))
         );
 
@@ -350,15 +349,13 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId
     // `WC`
     let where_clauses = tcx.predicates_of(def_id).predicates
         .into_iter()
-        .map(|(wc, _)| wc.lower())
-        .collect::<Vec<_>>();
+        .map(|(wc, _)| wc.lower());
 
     // `Implemented(A0: Trait<A1..An>) :- WC`
     let clause = ProgramClause {
         goal: trait_pred,
         hypotheses: tcx.mk_goals(
             where_clauses
-                .into_iter()
                 .map(|wc| tcx.mk_goal(GoalKind::from_poly_domain_goal(wc, tcx))),
         ),
     };
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 85b6bcbd144..d82d36a1937 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -115,7 +115,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         // field is of the found type, suggest such variants. See Issue
         // #42764.
         if let ty::Adt(expected_adt, substs) = expected.sty {
-            let compatible_variants = expected_adt.variants
+            let mut compatible_variants = expected_adt.variants
                                                   .iter()
                                                   .filter(|variant| variant.fields.len() == 1)
                                                   .filter_map(|variant| {
@@ -127,12 +127,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                 } else {
                     None
                 }
-            }).collect::<Vec<_>>();
+            }).peekable();
 
-            if !compatible_variants.is_empty() {
+            if compatible_variants.peek().is_some() {
                 let expr_text = print::to_string(print::NO_ANN, |s| s.print_expr(expr));
-                let suggestions = compatible_variants.iter()
-                    .map(|v| format!("{}({})", v, expr_text)).collect::<Vec<_>>();
+                let suggestions = compatible_variants.map(|v|
+                    format!("{}({})", v, expr_text)).collect::<Vec<_>>();
                 err.span_suggestions_with_applicability(
                      expr.span,
                      "try using a variant of the expected type",
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 16a3aecfc18..34bbbb53d5f 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -139,7 +139,7 @@ macro_rules! print {
 ///
 /// [`format!`]: ../std/macro.format.html
 /// [`std::fmt`]: ../std/fmt/index.html
-/// [`eprintln!`]: ../std/macro.eprint.html
+/// [`eprintln!`]: ../std/macro.eprintln.html
 /// # Panics
 ///
 /// Panics if writing to `io::stdout` fails.
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 214bc9cffc4..87ade278c68 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -34,6 +34,10 @@ use std::collections::hash_map::Entry;
 use rustc_data_structures::sync::Lrc;
 use errors::Applicability;
 
+const VALID_FRAGMENT_NAMES_MSG: &str = "valid fragment specifiers are \
+    `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, \
+    `path`, `meta`, `tt`, `item` and `vis`";
+
 pub struct ParserAnyMacro<'a> {
     parser: Parser<'a>,
 
@@ -708,8 +712,7 @@ fn check_matcher_core(sess: &ParseSess,
                 if let Err(bad_frag) = has_legal_fragment_specifier(sess, features, attrs, token) {
                     let msg = format!("invalid fragment specifier `{}`", bad_frag);
                     sess.span_diagnostic.struct_span_err(token.span(), &msg)
-                        .help("valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, \
-                              `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`")
+                        .help(VALID_FRAGMENT_NAMES_MSG)
                         .emit();
                     // (This eliminates false positives and duplicates
                     // from error messages.)
@@ -938,9 +941,7 @@ fn is_in_follow(tok: &quoted::TokenTree, frag: &str) -> Result<bool, (String, &'
             },
             "" => Ok(true), // keywords::Invalid
             _ => Err((format!("invalid fragment specifier `{}`", frag),
-                     "valid fragment specifiers are `ident`, `block`, \
-                      `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt`, \
-                      `literal`, `item` and `vis`"))
+                     VALID_FRAGMENT_NAMES_MSG))
         }
     }
 }
diff --git a/src/test/run-pass/binding/pat-tuple-7.rs b/src/test/run-pass/binding/pat-tuple-7.rs
index c32b52eac33..06bd14d188e 100644
--- a/src/test/run-pass/binding/pat-tuple-7.rs
+++ b/src/test/run-pass/binding/pat-tuple-7.rs
@@ -11,6 +11,7 @@
 // run-pass
 
 fn main() {
+    #[allow(unused_parens)]
     match 0 {
         (pat) => assert_eq!(pat, 0)
     }
diff --git a/src/test/ui/issues/issue-21356.stderr b/src/test/ui/issues/issue-21356.stderr
index 5787476c2f2..924767fb5e1 100644
--- a/src/test/ui/issues/issue-21356.stderr
+++ b/src/test/ui/issues/issue-21356.stderr
@@ -4,7 +4,7 @@ error: invalid fragment specifier `t_ty`
 LL | macro_rules! test { ($wrong:t_ty ..) => () }
    |                      ^^^^^^^^^^^
    |
-   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs b/src/test/ui/issues/issue-23189.rs
index 78e6dc2d3e7..7a475d1a6ab 100644
--- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs
+++ b/src/test/ui/issues/issue-23189.rs
@@ -1,4 +1,4 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -7,13 +7,9 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-struct Ref<'a, 'b> {
-    a: &'a u32,
-    b: &'b u32,
-}
 
-fn foo(mut x: Ref) {
-    x.a = x.b; //~ ERROR lifetime mismatch
-}
+mod module {}
 
-fn main() {}
+fn main() {
+    let _ = module { x: 0 }; //~ERROR expected struct
+}
diff --git a/src/test/ui/issues/issue-23189.stderr b/src/test/ui/issues/issue-23189.stderr
new file mode 100644
index 00000000000..c7bbab4524d
--- /dev/null
+++ b/src/test/ui/issues/issue-23189.stderr
@@ -0,0 +1,9 @@
+error[E0574]: expected struct, variant or union type, found module `module`
+  --> $DIR/issue-23189.rs:14:13
+   |
+LL |     let _ = module { x: 0 }; //~ERROR expected struct
+   |             ^^^^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr
deleted file mode 100644
index 4f0efe24cf7..00000000000
--- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error: unsatisfied lifetime constraints
-  --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:5
-   |
-LL | fn foo(mut x: Ref) {
-   |        -----
-   |        |
-   |        has type `Ref<'_, '1>`
-   |        has type `Ref<'2, '_>`
-LL |     x.a = x.b; //~ ERROR lifetime mismatch
-   |     ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr
deleted file mode 100644
index ccc5e02ab70..00000000000
--- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0623]: lifetime mismatch
-  --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11
-   |
-LL | fn foo(mut x: Ref) {
-   |               ---
-   |               |
-   |               this type is declared with multiple lifetimes...
-LL |     x.a = x.b; //~ ERROR lifetime mismatch
-   |           ^^^ ...but data with one lifetime flows into the other here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.rs b/src/test/ui/lint/issue-54538-unused-parens-lint.rs
new file mode 100644
index 00000000000..97a2dd59a62
--- /dev/null
+++ b/src/test/ui/lint/issue-54538-unused-parens-lint.rs
@@ -0,0 +1,38 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-pass
+
+#![allow(unreachable_patterns)]
+#![allow(unused_variables)]
+#![warn(unused_parens)]
+
+fn main() {
+    match 1 {
+        (_) => {}         //~ WARNING: unnecessary parentheses around pattern
+        (y) => {}         //~ WARNING: unnecessary parentheses around pattern
+        (ref r) => {}     //~ WARNING: unnecessary parentheses around pattern
+        (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern
+        (1..=2) => {}     // Non ambiguous range pattern should not warn
+        e @ (3..=4) => {} // Non ambiguous range pattern should not warn
+    }
+
+    match &1 {
+        (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern
+        &(_) => {}           //~ WARNING: unnecessary parentheses around pattern
+        e @ &(1...2) => {}   // Ambiguous range pattern should not warn
+        &(1..=2) => {}       // Ambiguous range pattern should not warn
+    }
+
+    match &1 {
+        e @ &(1...2) | e @ &(3..=4) => {} // Complex ambiguous pattern should not warn
+        &_ => {}
+    }
+}
diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr
new file mode 100644
index 00000000000..b76b969fd2b
--- /dev/null
+++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr
@@ -0,0 +1,42 @@
+warning: unnecessary parentheses around pattern
+  --> $DIR/issue-54538-unused-parens-lint.rs:19:9
+   |
+LL |         (_) => {}         //~ WARNING: unnecessary parentheses around pattern
+   |         ^^^ help: remove these parentheses
+   |
+note: lint level defined here
+  --> $DIR/issue-54538-unused-parens-lint.rs:15:9
+   |
+LL | #![warn(unused_parens)]
+   |         ^^^^^^^^^^^^^
+
+warning: unnecessary parentheses around pattern
+  --> $DIR/issue-54538-unused-parens-lint.rs:20:9
+   |
+LL |         (y) => {}         //~ WARNING: unnecessary parentheses around pattern
+   |         ^^^ help: remove these parentheses
+
+warning: unnecessary parentheses around pattern
+  --> $DIR/issue-54538-unused-parens-lint.rs:21:9
+   |
+LL |         (ref r) => {}     //~ WARNING: unnecessary parentheses around pattern
+   |         ^^^^^^^ help: remove these parentheses
+
+warning: unnecessary parentheses around pattern
+  --> $DIR/issue-54538-unused-parens-lint.rs:22:9
+   |
+LL |         (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern
+   |         ^^^^^^^^^^^ help: remove these parentheses
+
+warning: unnecessary parentheses around pattern
+  --> $DIR/issue-54538-unused-parens-lint.rs:28:9
+   |
+LL |         (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern
+   |         ^^^^^^^^^^^^^^ help: remove these parentheses
+
+warning: unnecessary parentheses around pattern
+  --> $DIR/issue-54538-unused-parens-lint.rs:29:10
+   |
+LL |         &(_) => {}           //~ WARNING: unnecessary parentheses around pattern
+   |          ^^^ help: remove these parentheses
+
diff --git a/src/test/ui/lint/lint-group-style.rs b/src/test/ui/lint/lint-group-style.rs
deleted file mode 100644
index 55d6168e6e0..00000000000
--- a/src/test/ui/lint/lint-group-style.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(nonstandard_style)]
-#![allow(dead_code)]
-
-fn CamelCase() {} //~ ERROR should have a snake
-
-#[allow(nonstandard_style)]
-mod test {
-    fn CamelCase() {}
-
-    #[forbid(nonstandard_style)]
-    mod bad {
-        fn CamelCase() {} //~ ERROR should have a snake
-
-        static bad: isize = 1; //~ ERROR should have an upper
-    }
-
-    mod warn {
-        #![warn(nonstandard_style)]
-
-        fn CamelCase() {} //~ WARN should have a snake
-
-        struct snake_case; //~ WARN should have a camel
-    }
-}
-
-fn main() {}
diff --git a/src/test/ui/lint/lint-group-style.stderr b/src/test/ui/lint/lint-group-style.stderr
deleted file mode 100644
index 6b91ce5b93c..00000000000
--- a/src/test/ui/lint/lint-group-style.stderr
+++ /dev/null
@@ -1,67 +0,0 @@
-error: function `CamelCase` should have a snake case name such as `camel_case`
-  --> $DIR/lint-group-style.rs:14:1
-   |
-LL | fn CamelCase() {} //~ ERROR should have a snake
-   | ^^^^^^^^^^^^^^^^^
-   |
-note: lint level defined here
-  --> $DIR/lint-group-style.rs:11:9
-   |
-LL | #![deny(nonstandard_style)]
-   |         ^^^^^^^^^^^^^^^^^
-   = note: #[deny(non_snake_case)] implied by #[deny(nonstandard_style)]
-
-error: function `CamelCase` should have a snake case name such as `camel_case`
-  --> $DIR/lint-group-style.rs:22:9
-   |
-LL |         fn CamelCase() {} //~ ERROR should have a snake
-   |         ^^^^^^^^^^^^^^^^^
-   |
-note: lint level defined here
-  --> $DIR/lint-group-style.rs:20:14
-   |
-LL |     #[forbid(nonstandard_style)]
-   |              ^^^^^^^^^^^^^^^^^
-   = note: #[forbid(non_snake_case)] implied by #[forbid(nonstandard_style)]
-
-error: static variable `bad` should have an upper case name such as `BAD`
-  --> $DIR/lint-group-style.rs:24:9
-   |
-LL |         static bad: isize = 1; //~ ERROR should have an upper
-   |         ^^^^^^^^^^^^^^^^^^^^^^
-   |
-note: lint level defined here
-  --> $DIR/lint-group-style.rs:20:14
-   |
-LL |     #[forbid(nonstandard_style)]
-   |              ^^^^^^^^^^^^^^^^^
-   = note: #[forbid(non_upper_case_globals)] implied by #[forbid(nonstandard_style)]
-
-warning: function `CamelCase` should have a snake case name such as `camel_case`
-  --> $DIR/lint-group-style.rs:30:9
-   |
-LL |         fn CamelCase() {} //~ WARN should have a snake
-   |         ^^^^^^^^^^^^^^^^^
-   |
-note: lint level defined here
-  --> $DIR/lint-group-style.rs:28:17
-   |
-LL |         #![warn(nonstandard_style)]
-   |                 ^^^^^^^^^^^^^^^^^
-   = note: #[warn(non_snake_case)] implied by #[warn(nonstandard_style)]
-
-warning: type `snake_case` should have a camel case name such as `SnakeCase`
-  --> $DIR/lint-group-style.rs:32:9
-   |
-LL |         struct snake_case; //~ WARN should have a camel
-   |         ^^^^^^^^^^^^^^^^^^
-   |
-note: lint level defined here
-  --> $DIR/lint-group-style.rs:28:17
-   |
-LL |         #![warn(nonstandard_style)]
-   |                 ^^^^^^^^^^^^^^^^^
-   = note: #[warn(non_camel_case_types)] implied by #[warn(nonstandard_style)]
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/macros/macro-invalid-fragment-spec.stderr b/src/test/ui/macros/macro-invalid-fragment-spec.stderr
index 765621f51d4..e683d47cf54 100644
--- a/src/test/ui/macros/macro-invalid-fragment-spec.stderr
+++ b/src/test/ui/macros/macro-invalid-fragment-spec.stderr
@@ -4,7 +4,7 @@ error: invalid fragment specifier `foo`
 LL |     ($x:foo) => ()
    |      ^^^^^^
    |
-   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr
index 88435878905..20b1ae690ec 100644
--- a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr
+++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr
@@ -4,7 +4,7 @@ error: invalid fragment specifier `t_ty`
 LL |     ($wrong:t_ty) => () //~ ERROR invalid fragment specifier `t_ty`
    |      ^^^^^^^^^^^
    |
-   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
 
 error: aborting due to previous error