]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #56557 - pietroalbini:rollup, r=pietroalbini
authorbors <bors@rust-lang.org>
Thu, 6 Dec 2018 12:41:30 +0000 (12:41 +0000)
committerbors <bors@rust-lang.org>
Thu, 6 Dec 2018 12:41:30 +0000 (12:41 +0000)
Rollup of 11 pull requests

Successful merges:

 - #56315 (Rustdoc inline macro reexport)
 - #56332 ([rustdoc] Specific crate search)
 - #56362 (Stabilise exhaustive integer patterns)
 - #56426 (libsyntax_pos: A few tweaks)
 - #56441 (rustbuild: Fix issues with compiler docs)
 - #56446 (pass the parameter environment to `traits::find_associated_item`)
 - #56500 (cleanup: remove static lifetimes from consts)
 - #56525 (Avoid extra copy and syscall in std::env::current_exe)
 - #56528 (Remove unused dependency (rustc_lint -> rustc_mir))
 - #56548 (Optimized string FromIterator + Extend impls)
 - #56553 (Don't print the profiling summary to stdout when -Zprofile-json is set)

Failed merges:

r? @ghost

101 files changed:
Cargo.lock
src/bootstrap/doc.rs
src/grammar/parser-lalr.y
src/liballoc/string.rs
src/libcore/fmt/mod.rs
src/libcore/unicode/printable.rs
src/librustc/dep_graph/dep_node.rs
src/librustc/hir/lowering.rs
src/librustc/hir/map/mod.rs
src/librustc/hir/mod.rs
src/librustc/hir/print.rs
src/librustc/ich/impls_syntax.rs
src/librustc/ich/mod.rs
src/librustc/middle/liveness.rs
src/librustc/session/config.rs
src/librustc/session/filesearch.rs
src/librustc/session/mod.rs
src/librustc/traits/specialize/mod.rs
src/librustc/traits/structural_impls.rs
src/librustc/ty/context.rs
src/librustc/ty/instance.rs
src/librustc/ty/sty.rs
src/librustc/util/common.rs
src/librustc_codegen_ssa/back/symbol_export.rs
src/librustc_codegen_utils/symbol_names.rs
src/librustc_driver/driver.rs
src/librustc_incremental/assert_module_sources.rs
src/librustc_incremental/persist/file_format.rs
src/librustc_incremental/persist/fs.rs
src/librustc_lint/Cargo.toml
src/librustc_lint/lib.rs
src/librustc_lint/unused.rs
src/librustc_metadata/schema.rs
src/librustc_mir/borrow_check/mutability_errors.rs
src/librustc_mir/dataflow/graphviz.rs
src/librustc_mir/diagnostics.rs
src/librustc_mir/hair/pattern/_match.rs
src/librustc_mir/util/pretty.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/error_reporting.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_target/spec/mod.rs
src/librustc_typeck/collect.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/layout.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/down-arrow.svg [new file with mode: 0644]
src/librustdoc/html/static/main.js
src/librustdoc/html/static/rustdoc.css
src/librustdoc/html/static/themes/dark.css
src/librustdoc/html/static/themes/light.css
src/librustdoc/html/static_files.rs
src/librustdoc/visit_ast.rs
src/libstd/sys/unix/os.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/quoted.rs
src/libsyntax/feature_gate.rs
src/libsyntax/parse/attr.rs
src/libsyntax/parse/lexer/unicode_chars.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libsyntax/std_inject.rs
src/libsyntax_ext/asm.rs
src/libsyntax_ext/deriving/clone.rs
src/libsyntax_ext/deriving/generic/mod.rs
src/libsyntax_ext/global_asm.rs
src/libsyntax_ext/proc_macro_decls.rs
src/libsyntax_pos/edition.rs
src/libsyntax_pos/hygiene.rs
src/libsyntax_pos/symbol.rs
src/test/run-pass/issue-55380.rs [new file with mode: 0644]
src/test/rustdoc-js/filter-crate.js [new file with mode: 0644]
src/test/rustdoc/inline_local/macro_by_example.rs [new file with mode: 0644]
src/test/ui/consts/const-match-check.eval1.stderr
src/test/ui/consts/const-match-check.eval2.stderr
src/test/ui/consts/const-match-check.matchck.stderr
src/test/ui/consts/const-pattern-irrefutable.rs
src/test/ui/consts/const-pattern-irrefutable.stderr
src/test/ui/exhaustive_integer_patterns.rs
src/test/ui/exhaustive_integer_patterns.stderr
src/test/ui/feature-gate-exhaustive_integer_patterns.rs [deleted file]
src/test/ui/feature-gate-exhaustive_integer_patterns.stderr [deleted file]
src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs [new file with mode: 0644]
src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr [new file with mode: 0644]
src/test/ui/for/for-loop-refutable-pattern-error-message.stderr
src/test/ui/match/match-non-exhaustive.stderr
src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs [new file with mode: 0644]
src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr [new file with mode: 0644]
src/test/ui/non-exhaustive/non-exhaustive-match.rs
src/test/ui/non-exhaustive/non-exhaustive-match.stderr
src/test/ui/precise_pointer_size_matching.rs [new file with mode: 0644]
src/test/ui/precise_pointer_size_matching.stderr [new file with mode: 0644]
src/test/ui/refutable-pattern-errors.rs
src/test/ui/refutable-pattern-errors.stderr
src/test/ui/rust-2018/dyn-trait-compatibility.rs
src/test/ui/rust-2018/dyn-trait-compatibility.stderr
src/tools/rustdoc-js/tester.js

index 69d929e913a9a8d276ffde9d93a61d56aa91fbda..02c63200a28c3c3ecceb2d55ae722e736bdc1440 100644 (file)
@@ -2352,7 +2352,6 @@ dependencies = [
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc 0.0.0",
  "rustc_data_structures 0.0.0",
- "rustc_mir 0.0.0",
  "rustc_target 0.0.0",
  "syntax 0.0.0",
  "syntax_pos 0.0.0",
index 201129b92df054f6ef8e3a5a26bcda8a4f754f64..e9c27a3f3cf31f9fec8835fbcc2489ee05ea8efe 100644 (file)
@@ -697,9 +697,6 @@ fn run(self, builder: &Builder) {
             return;
         }
 
-        // Build libstd docs so that we generate relative links.
-        builder.ensure(Std { stage, target });
-
         // Build rustc.
         builder.ensure(compile::Rustc { compiler, target });
 
@@ -718,12 +715,16 @@ fn run(self, builder: &Builder) {
 
         // Find dependencies for top level crates.
         let mut compiler_crates = HashSet::new();
-        for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] {
+        for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
             let interned_root_crate = INTERNER.intern_str(root_crate);
             find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
         }
 
         for krate in &compiler_crates {
+            // Create all crate output directories first to make sure rustdoc uses
+            // relative links.
+            // FIXME: Cargo should probably do this itself.
+            t!(fs::create_dir_all(out_dir.join(krate)));
             cargo.arg("-p").arg(krate);
         }
 
@@ -797,8 +798,8 @@ fn run(self, builder: &Builder) {
             return;
         }
 
-        // Build libstd docs so that we generate relative links.
-        builder.ensure(Std { stage, target });
+        // Build rustc docs so that we generate relative links.
+        builder.ensure(Rustc { stage, target });
 
         // Build rustdoc.
         builder.ensure(tool::Rustdoc { host: compiler.host });
@@ -822,6 +823,10 @@ fn run(self, builder: &Builder) {
             &[]
         );
 
+        // Only include compiler crates, no dependencies of those, such as `libc`.
+        cargo.arg("--no-deps");
+        cargo.arg("-p").arg("rustdoc");
+
         cargo.env("RUSTDOCFLAGS", "--document-private-items");
         builder.run(&mut cargo);
     }
index a7da69f65faf2b3532cdc6537cff92a167a139ac..8ea1cb26dc0c7f0239dac52fa1f67ef48165042d 100644 (file)
@@ -741,14 +741,14 @@ fn_anon_params
 ;
 
 fn_params_with_self
-: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')'              { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
+: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')'              { $$ = mk_node("SelfLower", 3, $2, $4, $5); }
 | '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')'          { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
 | '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
 | '(' maybe_params ')'                                                       { $$ = mk_node("SelfStatic", 1, $2); }
 ;
 
 fn_anon_params_with_self
-: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')'              { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
+: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')'              { $$ = mk_node("SelfLower", 3, $2, $4, $5); }
 | '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')'          { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
 | '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
 | '(' maybe_anon_params ')'                                                       { $$ = mk_node("SelfStatic", 1, $2); }
index 662f8ae614fcbed729514b50ce9e70c897cd3c7a..006c602649b74675af53e13a407db736bcb0128c 100644 (file)
@@ -577,7 +577,7 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> Cow<'a, str> {
             return Cow::Borrowed("");
         };
 
-        const REPLACEMENT: &'static str = "\u{FFFD}";
+        const REPLACEMENT: &str = "\u{FFFD}";
 
         let mut res = String::with_capacity(v.len());
         res.push_str(first_valid);
@@ -1732,18 +1732,37 @@ fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {
 #[stable(feature = "extend_string", since = "1.4.0")]
 impl FromIterator<String> for String {
     fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> String {
-        let mut buf = String::new();
-        buf.extend(iter);
-        buf
+        let mut iterator = iter.into_iter();
+
+        // Because we're iterating over `String`s, we can avoid at least
+        // one allocation by getting the first string from the iterator
+        // and appending to it all the subsequent strings.
+        match iterator.next() {
+            None => String::new(),
+            Some(mut buf) => {
+                buf.extend(iterator);
+                buf
+            }
+        }
     }
 }
 
 #[stable(feature = "herd_cows", since = "1.19.0")]
 impl<'a> FromIterator<Cow<'a, str>> for String {
     fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
-        let mut buf = String::new();
-        buf.extend(iter);
-        buf
+        let mut iterator = iter.into_iter();
+
+        // Because we're iterating over CoWs, we can (potentially) avoid at least
+        // one allocation by getting the first item and appending to it all the
+        // subsequent items.
+        match iterator.next() {
+            None => String::new(),
+            Some(cow) => {
+                let mut buf = cow.into_owned();
+                buf.extend(iterator);
+                buf
+            }
+        }
     }
 }
 
@@ -1753,9 +1772,7 @@ fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I) {
         let iterator = iter.into_iter();
         let (lower_bound, _) = iterator.size_hint();
         self.reserve(lower_bound);
-        for ch in iterator {
-            self.push(ch)
-        }
+        iterator.for_each(move |c| self.push(c));
     }
 }
 
@@ -1769,27 +1786,21 @@ fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iter: I) {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Extend<&'a str> for String {
     fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
-        for s in iter {
-            self.push_str(s)
-        }
+        iter.into_iter().for_each(move |s| self.push_str(s));
     }
 }
 
 #[stable(feature = "extend_string", since = "1.4.0")]
 impl Extend<String> for String {
     fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {
-        for s in iter {
-            self.push_str(&s)
-        }
+        iter.into_iter().for_each(move |s| self.push_str(&s));
     }
 }
 
 #[stable(feature = "herd_cows", since = "1.19.0")]
 impl<'a> Extend<Cow<'a, str>> for String {
     fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I) {
-        for s in iter {
-            self.push_str(&s)
-        }
+        iter.into_iter().for_each(move |s| self.push_str(&s));
     }
 }
 
index 75ec0d7d50be6e7398d190b9e551918b0b5152cc..0c5256b981e5cc63d1cb9abc9d348b5b9f1c0162 100644 (file)
@@ -1381,7 +1381,7 @@ fn write_bytes(buf: &mut dyn Write, s: &[u8]) -> Result {
         for part in formatted.parts {
             match *part {
                 flt2dec::Part::Zero(mut nzeroes) => {
-                    const ZEROES: &'static str = // 64 zeroes
+                    const ZEROES: &str = // 64 zeroes
                         "0000000000000000000000000000000000000000000000000000000000000000";
                     while nzeroes > ZEROES.len() {
                         self.buf.write_str(ZEROES)?;
index 519dd17bb9b3f9d2864d0961f32b369028059497..32e4b6b0fa512e7eb3618c56eeb52ebf06078df8 100644 (file)
@@ -80,7 +80,7 @@ pub(crate) fn is_printable(x: char) -> bool {
     }
 }
 
-const SINGLETONS0U: &'static [(u8, u8)] = &[
+const SINGLETONS0U: &[(u8, u8)] = &[
     (0x00, 1),
     (0x03, 5),
     (0x05, 6),
@@ -122,7 +122,7 @@ pub(crate) fn is_printable(x: char) -> bool {
     (0xfe, 3),
     (0xff, 9),
 ];
-const SINGLETONS0L: &'static [u8] = &[
+const SINGLETONS0L: &[u8] = &[
     0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
     0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
     0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
@@ -162,7 +162,7 @@ pub(crate) fn is_printable(x: char) -> bool {
     0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9,
     0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
 ];
-const SINGLETONS1U: &'static [(u8, u8)] = &[
+const SINGLETONS1U: &[(u8, u8)] = &[
     (0x00, 6),
     (0x01, 1),
     (0x03, 1),
@@ -197,7 +197,7 @@ pub(crate) fn is_printable(x: char) -> bool {
     (0xf0, 4),
     (0xf9, 4),
 ];
-const SINGLETONS1L: &'static [u8] = &[
+const SINGLETONS1L: &[u8] = &[
     0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
     0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
     0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
@@ -219,7 +219,7 @@ pub(crate) fn is_printable(x: char) -> bool {
     0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0,
     0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b,
 ];
-const NORMAL0: &'static [u8] = &[
+const NORMAL0: &[u8] = &[
     0x00, 0x20,
     0x5f, 0x22,
     0x82, 0xdf, 0x04,
@@ -363,7 +363,7 @@ pub(crate) fn is_printable(x: char) -> bool {
     0x1b, 0x03,
     0x0f, 0x0d,
 ];
-const NORMAL1: &'static [u8] = &[
+const NORMAL1: &[u8] = &[
     0x5e, 0x22,
     0x7b, 0x05,
     0x03, 0x04,
index 388bbc52c3b1a1bbb4649f020bc0601446879abd..a20d04972fd75e3b6d6ded58ceda05a265ccbedb 100644 (file)
@@ -381,7 +381,7 @@ pub fn has_label_string(label: &str) -> bool {
         #[allow(dead_code, non_upper_case_globals)]
         pub mod label_strs {
            $(
-                pub const $variant: &'static str = stringify!($variant);
+                pub const $variant: &str = stringify!($variant);
             )*
         }
     );
index dc8baa112bb59a79ec38d1dbb81a6dc8369bd822..a485af0a5eef9fa1a989f0d614660c81b4ba0868 100644 (file)
@@ -1201,7 +1201,7 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::T
                 None,
                 P(hir::Path {
                     def: self.expect_full_def(t.id),
-                    segments: hir_vec![hir::PathSegment::from_ident(keywords::SelfType.ident())],
+                    segments: hir_vec![hir::PathSegment::from_ident(keywords::SelfUpper.ident())],
                     span: t.span,
                 }),
             )),
@@ -2425,7 +2425,7 @@ fn lower_generic_param(&mut self,
                 // Don't expose `Self` (recovered "keyword used as ident" parse error).
                 // `rustc::ty` expects `Self` to be only used for a trait's `Self`.
                 // Instead, use gensym("Self") to create a distinct name that looks the same.
-                let ident = if param.ident.name == keywords::SelfType.name() {
+                let ident = if param.ident.name == keywords::SelfUpper.name() {
                     param.ident.gensym()
                 } else {
                     param.ident
@@ -2981,7 +2981,7 @@ fn lower_use_tree(
 
                 // Correctly resolve `self` imports
                 if path.segments.len() > 1
-                    && path.segments.last().unwrap().ident.name == keywords::SelfValue.name()
+                    && path.segments.last().unwrap().ident.name == keywords::SelfLower.name()
                 {
                     let _ = path.segments.pop();
                     if rename.is_none() {
index ef777abfbc41aa1780d132895682adef63b06b82..4ac07d78a26137f0d4003a639bdfefa5a8ce1d7d 100644 (file)
@@ -475,7 +475,7 @@ pub fn ty_param_owner(&self, id: NodeId) -> NodeId {
 
     pub fn ty_param_name(&self, id: NodeId) -> Name {
         match self.get(id) {
-            Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfType.name(),
+            Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfUpper.name(),
             Node::GenericParam(param) => param.name.ident().name,
             _ => bug!("ty_param_name: {} not a type parameter", self.node_to_string(id)),
         }
index 1674320165e65f7fa0260eba170ae4cab3e5b35e..85bf257df237fa3052614cb9431e990ea726adbf 100644 (file)
@@ -311,7 +311,7 @@ pub struct Path {
 
 impl Path {
     pub fn is_global(&self) -> bool {
-        !self.segments.is_empty() && self.segments[0].ident.name == keywords::CrateRoot.name()
+        !self.segments.is_empty() && self.segments[0].ident.name == keywords::PathRoot.name()
     }
 }
 
index 9a0ceddcf1b4a6d920832498b234d1648ddd635c..484722f8c131bb04834367253caffa801b11a964 100644 (file)
@@ -65,7 +65,7 @@ fn try_fetch_item(&self, _: ast::NodeId) -> Option<&hir::Item> {
 
 pub struct NoAnn;
 impl PpAnn for NoAnn {}
-pub const NO_ANN: &'static dyn PpAnn = &NoAnn;
+pub const NO_ANN: &dyn PpAnn = &NoAnn;
 
 impl PpAnn for hir::Crate {
     fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {
@@ -1622,7 +1622,7 @@ pub fn print_path(&mut self,
             if i > 0 {
                 self.s.word("::")?
             }
-            if segment.ident.name != keywords::CrateRoot.name() &&
+            if segment.ident.name != keywords::PathRoot.name() &&
                segment.ident.name != keywords::DollarCrate.name() {
                self.print_ident(segment.ident)?;
                segment.with_generic_args(|generic_args| {
@@ -1636,7 +1636,7 @@ pub fn print_path(&mut self,
     }
 
     pub fn print_path_segment(&mut self, segment: &hir::PathSegment) -> io::Result<()> {
-        if segment.ident.name != keywords::CrateRoot.name() &&
+        if segment.ident.name != keywords::PathRoot.name() &&
            segment.ident.name != keywords::DollarCrate.name() {
            self.print_ident(segment.ident)?;
            segment.with_generic_args(|generic_args| {
@@ -1664,7 +1664,7 @@ pub fn print_qpath(&mut self,
                     if i > 0 {
                         self.s.word("::")?
                     }
-                    if segment.ident.name != keywords::CrateRoot.name() &&
+                    if segment.ident.name != keywords::PathRoot.name() &&
                        segment.ident.name != keywords::DollarCrate.name() {
                         self.print_ident(segment.ident)?;
                         segment.with_generic_args(|generic_args| {
index 439c6e42e1a3f105120f2193c914ab7d92cd5a31..db643e4fd726ba5c07bbb7ae0ad9a081c8a03a83 100644 (file)
@@ -134,14 +134,10 @@ fn to_stable_hash_key(&self,
     const_stability
 });
 
-impl<'a> HashStable<StableHashingContext<'a>>
-for ::syntax::edition::Edition {
-    fn hash_stable<W: StableHasherResult>(&self,
-                                          hcx: &mut StableHashingContext<'a>,
-                                          hasher: &mut StableHasher<W>) {
-        mem::discriminant(self).hash_stable(hcx, hasher);
-    }
-}
+impl_stable_hash_for!(enum ::syntax::edition::Edition {
+    Edition2015,
+    Edition2018,
+});
 
 impl<'a> HashStable<StableHashingContext<'a>>
 for ::syntax::attr::StabilityLevel {
index 9751c560acd1e0535a4aa057b945bfc27188a974..fc2f1ee6ff892d4f241616e1afd05bf29c6fe083 100644 (file)
 mod impls_ty;
 mod impls_syntax;
 
-pub const ATTR_DIRTY: &'static str = "rustc_dirty";
-pub const ATTR_CLEAN: &'static str = "rustc_clean";
-pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
-pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
-pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused";
-pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened";
-pub const ATTR_EXPECTED_CGU_REUSE: &'static str = "rustc_expected_cgu_reuse";
+pub const ATTR_DIRTY: &str = "rustc_dirty";
+pub const ATTR_CLEAN: &str = "rustc_clean";
+pub const ATTR_IF_THIS_CHANGED: &str = "rustc_if_this_changed";
+pub const ATTR_THEN_THIS_WOULD_NEED: &str = "rustc_then_this_would_need";
+pub const ATTR_PARTITION_REUSED: &str = "rustc_partition_reused";
+pub const ATTR_PARTITION_CODEGENED: &str = "rustc_partition_codegened";
+pub const ATTR_EXPECTED_CGU_REUSE: &str = "rustc_expected_cgu_reuse";
 
-pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
+pub const IGNORED_ATTRIBUTES: &[&str] = &[
     "cfg",
     ATTR_IF_THIS_CHANGED,
     ATTR_THEN_THIS_WOULD_NEED,
index 54a0192d2e8a541376026c670de2d240ff04c01b..b846a1c4930fbf4675537e55f4d7ce6c2db45a48 100644 (file)
@@ -1575,7 +1575,7 @@ fn warn_about_unused_args(&self, body: &hir::Body, entry_ln: LiveNode) {
                 let sp = ident.span;
                 let var = self.variable(hir_id, sp);
                 // Ignore unused self.
-                if ident.name != keywords::SelfValue.name() {
+                if ident.name != keywords::SelfLower.name() {
                     if !self.warn_about_unused(sp, hir_id, entry_ln, var) {
                         if self.live_on_entry(entry_ln, var).is_none() {
                             self.report_dead_assign(hir_id, sp, var, true);
index c9866230cddc8ad215936f75940965fb0ac223fb..f1ddcda823ee799927825dccf0834ed610732af6 100644 (file)
@@ -780,43 +780,42 @@ fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
     }
 
     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)] =
+    pub const $stat: &[(&str, $setter_name, Option<&str>, &str)] =
         &[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ];
 
     #[allow(non_upper_case_globals, dead_code)]
     mod $mod_desc {
-        pub const parse_bool: Option<&'static str> = None;
-        pub const parse_opt_bool: Option<&'static str> =
+        pub const parse_bool: Option<&str> = None;
+        pub const parse_opt_bool: Option<&str> =
             Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
-        pub const parse_string: Option<&'static str> = Some("a string");
-        pub const parse_string_push: Option<&'static str> = Some("a string");
-        pub const parse_pathbuf_push: Option<&'static str> = Some("a path");
-        pub const parse_opt_string: Option<&'static str> = Some("a string");
-        pub const parse_opt_pathbuf: Option<&'static str> = Some("a path");
-        pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
-        pub const parse_opt_list: Option<&'static str> = Some("a space-separated list of strings");
-        pub const parse_uint: Option<&'static str> = Some("a number");
-        pub const parse_passes: Option<&'static str> =
+        pub const parse_string: Option<&str> = Some("a string");
+        pub const parse_string_push: Option<&str> = Some("a string");
+        pub const parse_pathbuf_push: Option<&str> = Some("a path");
+        pub const parse_opt_string: Option<&str> = Some("a string");
+        pub const parse_opt_pathbuf: Option<&str> = Some("a path");
+        pub const parse_list: Option<&str> = Some("a space-separated list of strings");
+        pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings");
+        pub const parse_uint: Option<&str> = Some("a number");
+        pub const parse_passes: Option<&str> =
             Some("a space-separated list of passes, or `all`");
-        pub const parse_opt_uint: Option<&'static str> =
+        pub const parse_opt_uint: Option<&str> =
             Some("a number");
-        pub const parse_panic_strategy: Option<&'static str> =
+        pub const parse_panic_strategy: Option<&str> =
             Some("either `unwind` or `abort`");
-        pub const parse_relro_level: Option<&'static str> =
+        pub const parse_relro_level: Option<&str> =
             Some("one of: `full`, `partial`, or `off`");
-        pub const parse_sanitizer: Option<&'static str> =
+        pub const parse_sanitizer: Option<&str> =
             Some("one of: `address`, `leak`, `memory` or `thread`");
-        pub const parse_linker_flavor: Option<&'static str> =
+        pub const parse_linker_flavor: Option<&str> =
             Some(::rustc_target::spec::LinkerFlavor::one_of());
-        pub const parse_optimization_fuel: Option<&'static str> =
+        pub const parse_optimization_fuel: Option<&str> =
             Some("crate=integer");
-        pub const parse_unpretty: Option<&'static str> =
+        pub const parse_unpretty: Option<&str> =
             Some("`string` or `string=string`");
-        pub const parse_lto: Option<&'static str> =
+        pub const parse_lto: Option<&str> =
             Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \
                   `fat`, or omitted");
-        pub const parse_cross_lang_lto: Option<&'static str> =
+        pub const parse_cross_lang_lto: Option<&str> =
             Some("either a boolean (`yes`, `no`, `on`, `off`, etc), \
                   or the path to the linker plugin");
     }
index f410c270bcef91aa681dae20159534c7550108ed..e686a1d1275b61a079508a60fe73826b1b3adaf4 100644 (file)
@@ -179,12 +179,12 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
     // "lib" (i.e. non-default), this value is used (see issue #16552).
 
     #[cfg(target_pointer_width = "64")]
-    const PRIMARY_LIB_DIR: &'static str = "lib64";
+    const PRIMARY_LIB_DIR: &str = "lib64";
 
     #[cfg(target_pointer_width = "32")]
-    const PRIMARY_LIB_DIR: &'static str = "lib32";
+    const PRIMARY_LIB_DIR: &str = "lib32";
 
-    const SECONDARY_LIB_DIR: &'static str = "lib";
+    const SECONDARY_LIB_DIR: &str = "lib";
 
     match option_env!("CFG_LIBDIR_RELATIVE") {
         Some(libdir) if libdir != "lib" => libdir.into(),
@@ -198,4 +198,4 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
 
 // The name of rustc's own place to organize libraries.
 // Used to be "rustc", now the default is "rustlib"
-const RUST_LIB_DIR: &'static str = "rustlib";
+const RUST_LIB_DIR: &str = "rustlib";
index d1c3acc57b723b5260ceff0c672846e8dbafe0c5..293cd0c7c546df6df5eda807595ecc76ce26748d 100644 (file)
@@ -826,7 +826,7 @@ pub fn incr_comp_session_dir_opt(&self) -> Option<cell::Ref<'_, PathBuf>> {
     }
 
     pub fn profiler<F: FnOnce(&mut SelfProfiler) -> ()>(&self, f: F) {
-        if self.opts.debugging_opts.self_profile {
+        if self.opts.debugging_opts.self_profile || self.opts.debugging_opts.profile_json {
             let mut profiler = self.self_profiling.borrow_mut();
             f(&mut profiler);
         }
index 19ef3171b13fc75667d463bfca079606a23bcddb..cb17246b15f11447c13bd41e79c3736dae80b181 100644 (file)
@@ -85,6 +85,8 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
                                         source_substs: &'tcx Substs<'tcx>,
                                         target_node: specialization_graph::Node)
                                         -> &'tcx Substs<'tcx> {
+    debug!("translate_substs({:?}, {:?}, {:?}, {:?})",
+           param_env, source_impl, source_substs, target_node);
     let source_trait_ref = infcx.tcx
                                 .impl_trait_ref(source_impl)
                                 .unwrap()
@@ -119,10 +121,13 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
 /// whichever applies.
 pub fn find_associated_item<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
+    param_env: ty::ParamEnv<'tcx>,
     item: &ty::AssociatedItem,
     substs: &'tcx Substs<'tcx>,
     impl_data: &super::VtableImplData<'tcx, ()>,
 ) -> (DefId, &'tcx Substs<'tcx>) {
+    debug!("find_associated_item({:?}, {:?}, {:?}, {:?})",
+           param_env, item, substs, impl_data);
     assert!(!substs.needs_infer());
 
     let trait_def_id = tcx.trait_id_of_impl(impl_data.impl_def_id).unwrap();
@@ -132,7 +137,7 @@ pub fn find_associated_item<'a, 'tcx>(
     match ancestors.defs(tcx, item.ident, item.kind, trait_def_id).next() {
         Some(node_item) => {
             let substs = tcx.infer_ctxt().enter(|infcx| {
-                let param_env = ty::ParamEnv::reveal_all();
+                let param_env = param_env.with_reveal_all();
                 let substs = substs.rebase_onto(tcx, trait_def_id, impl_data.substs);
                 let substs = translate_substs(&infcx, param_env, impl_data.impl_def_id,
                                               substs, node_item.node);
@@ -219,12 +224,17 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
                                        source_trait_ref: ty::TraitRef<'tcx>,
                                        target_impl: DefId)
                                        -> Result<&'tcx Substs<'tcx>, ()> {
+    debug!("fulfill_implication({:?}, trait_ref={:?} |- {:?} applies)",
+           param_env, source_trait_ref, target_impl);
+
     let selcx = &mut SelectionContext::new(&infcx);
     let target_substs = infcx.fresh_substs_for_item(DUMMY_SP, target_impl);
     let (target_trait_ref, mut obligations) = impl_trait_ref_and_oblig(selcx,
                                                                        param_env,
                                                                        target_impl,
                                                                        target_substs);
+    debug!("fulfill_implication: target_trait_ref={:?}, obligations={:?}",
+           target_trait_ref, obligations);
 
     // do the impls unify? If not, no specialization.
     match infcx.at(&ObligationCause::dummy(), param_env)
index 36538ac0889dee908f99657931259f9cc3920027..36e93cc7740894fa522cd1a8cde196cff3f7f324 100644 (file)
@@ -33,8 +33,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         if ty::tls::with(|tcx| tcx.sess.verbose()) {
             write!(
                 f,
-                "Obligation(predicate={:?},cause={:?},depth={})",
-                self.predicate, self.cause, self.recursion_depth
+                "Obligation(predicate={:?},cause={:?},param_env={:?},depth={})",
+                self.predicate, self.cause, self.param_env, self.recursion_depth
             )
         } else {
             write!(
index 42a4de1682c391e71b0101a223b2120965aad385..f041192413107b38845b019b857ee4390781529e 100644 (file)
@@ -1493,12 +1493,6 @@ pub fn borrowck_mode(&self) -> BorrowckMode {
             BorrowckMode::Ast => match self.sess.edition() {
                 Edition::Edition2015 => BorrowckMode::Ast,
                 Edition::Edition2018 => BorrowckMode::Migrate,
-
-                // For now, future editions mean Migrate. (But it
-                // would make a lot of sense for it to be changed to
-                // `BorrowckMode::Mir`, depending on how we plan to
-                // time the forcing of full migration to NLL.)
-                _ => BorrowckMode::Migrate,
             },
         }
     }
@@ -2710,7 +2704,7 @@ pub fn mk_ty_param(self,
 
     #[inline]
     pub fn mk_self_type(self) -> Ty<'tcx> {
-        self.mk_ty_param(0, keywords::SelfType.name().as_interned_str())
+        self.mk_ty_param(0, keywords::SelfUpper.name().as_interned_str())
     }
 
     pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> Kind<'tcx> {
index 411a6e7e6238ef470973ce9ede3a8ec9556a52b4..a24920da158e2772f9b51c40785a2ce660c7fa34 100644 (file)
@@ -347,9 +347,10 @@ fn resolve_associated_item<'a, 'tcx>(
 ) -> Option<Instance<'tcx>> {
     let def_id = trait_item.def_id;
     debug!("resolve_associated_item(trait_item={:?}, \
+            param_env={:?}, \
             trait_id={:?}, \
             rcvr_substs={:?})",
-           def_id, trait_id, rcvr_substs);
+            def_id, param_env, trait_id, rcvr_substs);
 
     let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
     let vtbl = tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref)));
@@ -359,7 +360,7 @@ fn resolve_associated_item<'a, 'tcx>(
     match vtbl {
         traits::VtableImpl(impl_data) => {
             let (def_id, substs) = traits::find_associated_item(
-                tcx, trait_item, rcvr_substs, &impl_data);
+                tcx, param_env, trait_item, rcvr_substs, &impl_data);
             let substs = tcx.erase_regions(&substs);
             Some(ty::Instance::new(def_id, substs))
         }
index 1416cb17feaedf9832f70e4783a9d5ecd0f5f9a1..d861fb367813ae51677d9f38b8d1f13d8510bcbc 100644 (file)
@@ -1020,7 +1020,7 @@ pub fn new(index: u32, name: InternedString) -> ParamTy {
     }
 
     pub fn for_self() -> ParamTy {
-        ParamTy::new(0, keywords::SelfType.name().as_interned_str())
+        ParamTy::new(0, keywords::SelfUpper.name().as_interned_str())
     }
 
     pub fn for_def(def: &ty::GenericParamDef) -> ParamTy {
@@ -1035,7 +1035,7 @@ pub fn is_self(&self) -> bool {
         // FIXME(#50125): Ignoring `Self` with `idx != 0` might lead to weird behavior elsewhere,
         // but this should only be possible when using `-Z continue-parse-after-error` like
         // `compile-fail/issue-36638.rs`.
-        self.name == keywords::SelfType.name().as_str() && self.idx == 0
+        self.name == keywords::SelfUpper.name().as_str() && self.idx == 0
     }
 }
 
@@ -1787,6 +1787,13 @@ pub fn is_signed(&self) -> bool {
         }
     }
 
+    pub fn is_pointer_sized(&self) -> bool {
+        match self.sty {
+            Int(ast::IntTy::Isize) | Uint(ast::UintTy::Usize) => true,
+            _ => false,
+        }
+    }
+
     pub fn is_machine(&self) -> bool {
         match self.sty {
             Int(ast::IntTy::Isize) | Uint(ast::UintTy::Usize) => false,
index 7a246af82e5fe7b14641324fcf9e17568e8629ae..c6ba20de0d3b900377fbd1fb87e1ba77770c5847 100644 (file)
@@ -28,7 +28,7 @@
 use session::Session;
 
 // The name of the associated type for `Fn` return types
-pub const FN_OUTPUT_NAME: &'static str = "Output";
+pub const FN_OUTPUT_NAME: &str = "Output";
 
 // Useful type to use with `Result<>` indicate that an error has already
 // been reported to the user, so no need to continue checking.
index d25917e51bfd69b735ded1c85ad6eb4dfd27069f..ecae6197dc7ca398da545b52342fe75ac03cc55f 100644 (file)
@@ -225,7 +225,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         // These are weak symbols that point to the profile version and the
         // profile name, which need to be treated as exported so LTO doesn't nix
         // them.
-        const PROFILER_WEAK_SYMBOLS: [&'static str; 2] = [
+        const PROFILER_WEAK_SYMBOLS: [&str; 2] = [
             "__llvm_profile_raw_version",
             "__llvm_profile_filename",
         ];
index 344a2525784720416e5f34ff396099184cb1b43a..611d7b137c6f277915f4c7cb107b390f71b2ebc9 100644 (file)
@@ -389,7 +389,7 @@ fn finish(mut self, hash: u64) -> String {
 
 impl ItemPathBuffer for SymbolPathBuffer {
     fn root_mode(&self) -> &RootMode {
-        const ABSOLUTE: &'static RootMode = &RootMode::Absolute;
+        const ABSOLUTE: &RootMode = &RootMode::Absolute;
         ABSOLUTE
     }
 
index 777cc09b8b16c32d9d60661c8d729e49341fd35e..48014a9e1192ce4bf214244116e12c097b323e90 100644 (file)
@@ -356,10 +356,10 @@ macro_rules! controller_entry_point {
 
     if sess.opts.debugging_opts.self_profile {
         sess.print_profiler_results();
+    }
 
-        if sess.opts.debugging_opts.profile_json {
-            sess.save_json_results();
-        }
+    if sess.opts.debugging_opts.profile_json {
+        sess.save_json_results();
     }
 
     controller_entry_point!(
index 4ff2529b26d934cbbe4996eccb1eb11e41445579..17ac9a6b5397346d8fb8ce57d316e4c7f8799205 100644 (file)
@@ -40,9 +40,9 @@
 use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED,
                  ATTR_EXPECTED_CGU_REUSE};
 
-const MODULE: &'static str = "module";
-const CFG: &'static str = "cfg";
-const KIND: &'static str = "kind";
+const MODULE: &str = "module";
+const CFG: &str = "cfg";
+const KIND: &str = "kind";
 
 pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     tcx.dep_graph.with_ignore(|| {
index 98f7873fda0e41da5c569fcb237117881aaed3f0..e5faba61782335f3ba61e084cb58032e91ba8358 100644 (file)
@@ -28,7 +28,7 @@
 use rustc_serialize::opaque::Encoder;
 
 /// The first few bytes of files generated by incremental compilation
-const FILE_MAGIC: &'static [u8] = b"RSIC";
+const FILE_MAGIC: &[u8] = b"RSIC";
 
 /// Change this if the header format changes
 const HEADER_FORMAT_VERSION: u16 = 0;
@@ -36,7 +36,7 @@
 /// A version string that hopefully is always different for compiler versions
 /// with different encodings of incremental compilation artifacts. Contains
 /// the git commit hash.
-const RUSTC_VERSION: Option<&'static str> = option_env!("CFG_VERSION");
+const RUSTC_VERSION: Option<&str> = option_env!("CFG_VERSION");
 
 pub fn write_file_header(stream: &mut Encoder) {
     stream.emit_raw_bytes(FILE_MAGIC);
index 75cdefaf49f0042f523a6d7bfdaa135f1f87169e..bc98798f77253e7ba37aa9a0694860d15d7b66b4 100644 (file)
 
 use rand::{RngCore, thread_rng};
 
-const LOCK_FILE_EXT: &'static str = ".lock";
-const DEP_GRAPH_FILENAME: &'static str = "dep-graph.bin";
-const WORK_PRODUCTS_FILENAME: &'static str = "work-products.bin";
-const QUERY_CACHE_FILENAME: &'static str = "query-cache.bin";
+const LOCK_FILE_EXT: &str = ".lock";
+const DEP_GRAPH_FILENAME: &str = "dep-graph.bin";
+const WORK_PRODUCTS_FILENAME: &str = "work-products.bin";
+const QUERY_CACHE_FILENAME: &str = "query-cache.bin";
 
 // We encode integers using the following base, so they are shorter than decimal
 // or hexadecimal numbers (we want short file and directory names). Since these
index fe197e3e2e28caf72d3a4c69e24d97c5cfd20a3d..7fb7a06ea1ad5fc1d1eee29090469a15c8c90fce 100644 (file)
@@ -12,7 +12,6 @@ test = false
 [dependencies]
 log = "0.4"
 rustc = { path = "../librustc" }
-rustc_mir = { path = "../librustc_mir"}
 rustc_target = { path = "../librustc_target" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
index 71efc5654eff3063499e9fa9a5be126e866193d6..4d709d574c4f1fa2ab9acac14cff87a5bf2970cc 100644 (file)
@@ -36,7 +36,6 @@
 extern crate rustc;
 #[macro_use]
 extern crate log;
-extern crate rustc_mir;
 extern crate rustc_target;
 extern crate syntax_pos;
 extern crate rustc_data_structures;
index fab618d9c8ec843b23763a95188db35dca20fba2..c7eb06cbe00535eebc180e7b58d97743a5d5f8ff 100644 (file)
@@ -473,7 +473,7 @@ fn check_use_tree(&self, cx: &EarlyContext, use_tree: &ast::UseTree, item: &ast:
             match items[0].0.kind {
                 ast::UseTreeKind::Simple(rename, ..) => {
                     let orig_ident = items[0].0.prefix.segments.last().unwrap().ident;
-                    if orig_ident.name == keywords::SelfValue.name() {
+                    if orig_ident.name == keywords::SelfLower.name() {
                         return;
                     }
                     node_ident = rename.unwrap_or(orig_ident);
index e91d15b78c0759364d280d877dc2586c58f9b435..fc3af6cf2e7320a248b9cb15211142bddf5f797f 100644 (file)
@@ -52,7 +52,7 @@ pub fn rustc_version() -> String {
 /// This header is followed by the position of the `CrateRoot`,
 /// which is encoded as a 32-bit big-endian unsigned integer,
 /// and further followed by the rustc version string.
-pub const METADATA_HEADER: &'static [u8; 12] =
+pub const METADATA_HEADER: &[u8; 12] =
     &[0, 0, 0, 0, b'r', b'u', b's', b't', 0, 0, 0, METADATA_VERSION];
 
 /// A value of type T referred to by its absolute position
index 7afe2c67adc9b8e5bbf26dcc892535986ec1d6bc..4bcabfef4fd7f41c59e06e26d0d961ec73ff5132 100644 (file)
@@ -263,7 +263,7 @@ pub(super) fn report_mutability_error(
                             // Deliberately fall into this case for all implicit self types,
                             // so that we don't fall in to the next case with them.
                             *kind == mir::ImplicitSelfKind::MutRef
-                        } else if Some(keywords::SelfValue.name()) == local_decl.name {
+                        } else if Some(keywords::SelfLower.name()) == local_decl.name {
                             // Otherwise, check if the name is the self kewyord - in which case
                             // we have an explicit self. Do the same thing in this case and check
                             // for a `self: &mut Self` to suggest removing the `&mut`.
index 6896c91352fdd04340a7430297750ad405a05a43..f6a9d46b5e2cbe2ace966bc2debde39f5f19a8d2 100644 (file)
@@ -137,8 +137,8 @@ fn node_label_internal<W: io::Write>(&self,
                                          block: BasicBlock,
                                          mir: &Mir) -> io::Result<()> {
         // Header rows
-        const HDRS: [&'static str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"];
-        const HDR_FMT: &'static str = "bgcolor=\"grey\"";
+        const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"];
+        const HDR_FMT: &str = "bgcolor=\"grey\"";
         write!(w, "<table><tr><td rowspan=\"{}\">", HDRS.len())?;
         write!(w, "{:?}", block.index())?;
         write!(w, "</td></tr><tr>")?;
index 56a9daf84f768905faedee6d096ea7f99260f143..ec5617d705248cb8894ff54b1e3db328eddafe93 100644 (file)
@@ -606,7 +606,7 @@ struct Bar {x: u8}
 const C: i32 = 2;
 
 // these three are not allowed:
-const CR: &'static mut i32 = &mut C;
+const CR: &mut i32 = &mut C;
 static STATIC_REF: &'static mut i32 = &mut X;
 static CONST_REF: &'static mut i32 = &mut C;
 ```
@@ -1163,7 +1163,7 @@ fn main() {
 use std::cell::Cell;
 
 const A: Cell<usize> = Cell::new(1);
-const B: &'static Cell<usize> = &A;
+const B: &Cell<usize> = &A;
 // error: cannot borrow a constant which may contain interior mutability,
 //        create a static instead
 
@@ -1171,10 +1171,10 @@ fn main() {
 struct C { a: Cell<usize> }
 
 const D: C = C { a: Cell::new(1) };
-const E: &'static Cell<usize> = &D.a; // error
+const E: &Cell<usize> = &D.a; // error
 
 // or:
-const F: &'static C = &D; // error
+const F: &C = &D; // error
 ```
 
 This is because cell types do operations that are not thread-safe. Due to this,
index 0570cd278f3af59b6ec359c626080096ff4ce837..5db7b6ceb5db56f263f75af4b161fd2131130836 100644 (file)
@@ -584,7 +584,6 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                                   -> Vec<Constructor<'tcx>>
 {
     debug!("all_constructors({:?})", pcx.ty);
-    let exhaustive_integer_patterns = cx.tcx.features().exhaustive_integer_patterns;
     let ctors = match pcx.ty.sty {
         ty::Bool => {
             [true, false].iter().map(|&b| {
@@ -614,7 +613,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                 .map(|v| Variant(v.did))
                 .collect()
         }
-        ty::Char if exhaustive_integer_patterns => {
+        ty::Char => {
             vec![
                 // The valid Unicode Scalar Value ranges.
                 ConstantRange('\u{0000}' as u128,
@@ -629,14 +628,14 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                 ),
             ]
         }
-        ty::Int(ity) if exhaustive_integer_patterns => {
+        ty::Int(ity) => {
             // FIXME(49937): refactor these bit manipulations into interpret.
             let bits = Integer::from_attr(&cx.tcx, SignedInt(ity)).size().bits() as u128;
             let min = 1u128 << (bits - 1);
             let max = (1u128 << (bits - 1)) - 1;
             vec![ConstantRange(min, max, pcx.ty, RangeEnd::Included)]
         }
-        ty::Uint(uty) if exhaustive_integer_patterns => {
+        ty::Uint(uty) => {
             // FIXME(49937): refactor these bit manipulations into interpret.
             let bits = Integer::from_attr(&cx.tcx, UnsignedInt(uty)).size().bits() as u128;
             let max = !0u128 >> (128 - bits);
@@ -775,8 +774,17 @@ impl<'tcx> IntRange<'tcx> {
     fn from_ctor(tcx: TyCtxt<'_, 'tcx, 'tcx>,
                  ctor: &Constructor<'tcx>)
                  -> Option<IntRange<'tcx>> {
+        // Floating-point ranges are permitted and we don't want
+        // to consider them when constructing integer ranges.
+        fn is_integral<'tcx>(ty: Ty<'tcx>) -> bool {
+            match ty.sty {
+                ty::Char | ty::Int(_) | ty::Uint(_) => true,
+                _ => false,
+            }
+        }
+
         match ctor {
-            ConstantRange(lo, hi, ty, end) => {
+            ConstantRange(lo, hi, ty, end) if is_integral(ty) => {
                 // Perform a shift if the underlying types are signed,
                 // which makes the interval arithmetic simpler.
                 let bias = IntRange::signed_bias(tcx, ty);
@@ -789,7 +797,7 @@ fn from_ctor(tcx: TyCtxt<'_, 'tcx, 'tcx>,
                     Some(IntRange { range: lo..=(hi - offset), ty })
                 }
             }
-            ConstantValue(val) => {
+            ConstantValue(val) if is_integral(val.ty) => {
                 let ty = val.ty;
                 if let Some(val) = val.assert_bits(tcx, ty::ParamEnv::empty().and(ty)) {
                     let bias = IntRange::signed_bias(tcx, ty);
@@ -799,9 +807,7 @@ fn from_ctor(tcx: TyCtxt<'_, 'tcx, 'tcx>,
                     None
                 }
             }
-            Single | Variant(_) | Slice(_) => {
-                None
-            }
+            _ => None,
         }
     }
 
@@ -933,12 +939,10 @@ fn compute_missing_ctors<'a, 'tcx: 'a>(
                 // If a constructor appears in a `match` arm, we can
                 // eliminate it straight away.
                 refined_ctors = vec![]
-            } else if tcx.features().exhaustive_integer_patterns {
-                if let Some(interval) = IntRange::from_ctor(tcx, used_ctor) {
-                    // Refine the required constructors for the type by subtracting
-                    // the range defined by the current constructor pattern.
-                    refined_ctors = interval.subtract_from(tcx, refined_ctors);
-                }
+            } else if let Some(interval) = IntRange::from_ctor(tcx, used_ctor) {
+                // Refine the required constructors for the type by subtracting
+                // the range defined by the current constructor pattern.
+                refined_ctors = interval.subtract_from(tcx, refined_ctors);
             }
 
             // If the constructor patterns that have been considered so far
@@ -1094,7 +1098,8 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
 
         // For privately empty and non-exhaustive enums, we work as if there were an "extra"
         // `_` constructor for the type, so we can never match over all constructors.
-        let is_non_exhaustive = is_privately_empty || is_declared_nonexhaustive;
+        let is_non_exhaustive = is_privately_empty || is_declared_nonexhaustive ||
+            (pcx.ty.is_pointer_sized() && !cx.tcx.features().precise_pointer_size_matching);
 
         if cheap_missing_ctors == MissingCtors::Empty && !is_non_exhaustive {
             split_grouped_constructors(cx.tcx, all_ctors, matrix, pcx.ty).into_iter().map(|c| {
@@ -1390,17 +1395,16 @@ fn slice_pat_covered_by_constructor<'tcx>(
 // Whether to evaluate a constructor using exhaustive integer matching. This is true if the
 // constructor is a range or constant with an integer type.
 fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> bool {
-    if tcx.features().exhaustive_integer_patterns {
-        let ty = match ctor {
-            ConstantValue(value) => value.ty,
-            ConstantRange(_, _, ty, _) => ty,
-            _ => return false,
-        };
-        if let ty::Char | ty::Int(_) | ty::Uint(_) = ty.sty {
-            return true;
-        }
+    let ty = match ctor {
+        ConstantValue(value) => value.ty,
+        ConstantRange(_, _, ty, _) => ty,
+        _ => return false,
+    };
+    if let ty::Char | ty::Int(_) | ty::Uint(_) = ty.sty {
+        !ty.is_pointer_sized() || tcx.features().precise_pointer_size_matching
+    } else {
+        false
     }
-    false
 }
 
 /// For exhaustive integer matching, some constructors are grouped within other constructors
index c74492fe649361beaed581f8b695a3c8eb743388..2d7e7d01274f6ca4d034ef488e1fe164df702193 100644 (file)
@@ -24,7 +24,7 @@
 use super::graphviz::write_mir_fn_graphviz;
 use transform::MirSource;
 
-const INDENT: &'static str = "    ";
+const INDENT: &str = "    ";
 /// Alignment for lining up comments following MIR statements
 pub(crate) const ALIGN: usize = 40;
 
index da4cd73923ede1914d3cfeb96ef4903c828eca8f..4e773124c8dab77ce41b455fde140ddc0b548ed4 100644 (file)
@@ -145,7 +145,7 @@ fn build_reduced_graph_for_use_tree(
             }
             _ => None,
         }.map(|ctxt| Segment::from_ident(Ident::new(
-            keywords::CrateRoot.name(), use_tree.prefix.span.shrink_to_lo().with_ctxt(ctxt)
+            keywords::PathRoot.name(), use_tree.prefix.span.shrink_to_lo().with_ctxt(ctxt)
         )));
 
         let prefix = crate_root.into_iter().chain(prefix_iter).collect::<Vec<_>>();
@@ -153,7 +153,7 @@ fn build_reduced_graph_for_use_tree(
 
         let empty_for_self = |prefix: &[Segment]| {
             prefix.is_empty() ||
-            prefix.len() == 1 && prefix[0].ident.name == keywords::CrateRoot.name()
+            prefix.len() == 1 && prefix[0].ident.name == keywords::PathRoot.name()
         };
         match use_tree.kind {
             ast::UseTreeKind::Simple(rename, ..) => {
@@ -164,7 +164,7 @@ fn build_reduced_graph_for_use_tree(
 
                 if nested {
                     // Correctly handle `self`
-                    if source.ident.name == keywords::SelfValue.name() {
+                    if source.ident.name == keywords::SelfLower.name() {
                         type_ns_only = true;
 
                         if empty_for_self(&module_path) {
@@ -185,7 +185,7 @@ fn build_reduced_graph_for_use_tree(
                     }
                 } else {
                     // Disallow `self`
-                    if source.ident.name == keywords::SelfValue.name() {
+                    if source.ident.name == keywords::SelfLower.name() {
                         resolve_error(self,
                                       use_tree.span,
                                       ResolutionError::SelfImportsOnlyAllowedWithin);
@@ -205,7 +205,7 @@ fn build_reduced_graph_for_use_tree(
                             // `crate_name` should not be interpreted as relative.
                             module_path.push(Segment {
                                 ident: Ident {
-                                    name: keywords::CrateRoot.name(),
+                                    name: keywords::PathRoot.name(),
                                     span: source.ident.span,
                                 },
                                 id: Some(self.session.next_node_id()),
@@ -270,7 +270,7 @@ fn build_reduced_graph_for_use_tree(
                 // Ensure there is at most one `self` in the list
                 let self_spans = items.iter().filter_map(|&(ref use_tree, _)| {
                     if let ast::UseTreeKind::Simple(..) = use_tree.kind {
-                        if use_tree.ident().name == keywords::SelfValue.name() {
+                        if use_tree.ident().name == keywords::SelfLower.name() {
                             return Some(use_tree.span);
                         }
                     }
@@ -305,7 +305,7 @@ fn build_reduced_graph_for_use_tree(
                     let new_span = prefix[prefix.len() - 1].ident.span;
                     let tree = ast::UseTree {
                         prefix: ast::Path::from_ident(
-                            Ident::new(keywords::SelfValue.name(), new_span)
+                            Ident::new(keywords::SelfLower.name(), new_span)
                         ),
                         kind: ast::UseTreeKind::Simple(
                             Some(Ident::new(keywords::Underscore.name().gensymed(), new_span)),
@@ -344,13 +344,13 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent_scope: ParentScop
             }
 
             ItemKind::ExternCrate(orig_name) => {
-                let module = if orig_name.is_none() && ident.name == keywords::SelfValue.name() {
+                let module = if orig_name.is_none() && ident.name == keywords::SelfLower.name() {
                     self.session
                         .struct_span_err(item.span, "`extern crate self;` requires renaming")
                         .span_suggestion(item.span, "try", "extern crate self as name;".into())
                         .emit();
                     return;
-                } else if orig_name == Some(keywords::SelfValue.name()) {
+                } else if orig_name == Some(keywords::SelfLower.name()) {
                     if !self.session.features_untracked().extern_crate_self {
                         emit_feature_err(&self.session.parse_sess, "extern_crate_self", item.span,
                                          GateIssue::Language, "`extern crate self` is unstable");
@@ -783,7 +783,7 @@ fn process_legacy_macro_imports(&mut self, item: &Item, module: Module<'a>,
                         "an `extern crate` loading macros must be at the crate root");
                 }
                 if let ItemKind::ExternCrate(Some(orig_name)) = item.node {
-                    if orig_name == keywords::SelfValue.name() {
+                    if orig_name == keywords::SelfLower.name() {
                         self.session.span_err(attr.span,
                             "`macro_use` is not supported on `extern crate self`");
                     }
index e2a6303f579449e8f60e272c29b1119154c6a709..23edaf12438121fd682389ae45f9ff7c741ca0f0 100644 (file)
@@ -30,7 +30,7 @@ pub(crate) fn make_path_suggestion(
         match (path.get(0), path.get(1)) {
             // `{{root}}::ident::...` on both editions.
             // On 2015 `{{root}}` is usually added implicitly.
-            (Some(fst), Some(snd)) if fst.ident.name == keywords::CrateRoot.name() &&
+            (Some(fst), Some(snd)) if fst.ident.name == keywords::PathRoot.name() &&
                                       !snd.ident.is_path_segment_keyword() => {}
             // `ident::...` on 2018
             (Some(fst), _) if fst.ident.span.rust_2018() &&
@@ -61,7 +61,7 @@ fn make_missing_self_suggestion(
         parent_scope: &ParentScope<'b>,
     ) -> Option<(Vec<Segment>, Option<String>)> {
         // Replace first ident with `self` and check if that is valid.
-        path[0].ident.name = keywords::SelfValue.name();
+        path[0].ident.name = keywords::SelfLower.name();
         let result = self.resolve_path(&path, None, parent_scope, false, span, CrateLint::No);
         debug!("make_missing_self_suggestion: path={:?} result={:?}", path, result);
         if let PathResult::Module(..) = result {
index fdac1e3b8165239b744c51b95c7fe4415040f33c..9ea39aea86867ea99455a352c1df7192f9492210 100644 (file)
@@ -769,7 +769,7 @@ fn visit_ty(&mut self, ty: &'tcx Ty) {
                 self.smart_resolve_path(ty.id, qself.as_ref(), path, PathSource::Type);
             }
             TyKind::ImplicitSelf => {
-                let self_ty = keywords::SelfType.ident();
+                let self_ty = keywords::SelfUpper.ident();
                 let def = self.resolve_ident_in_lexical_scope(self_ty, TypeNS, Some(ty.id), ty.span)
                               .map_or(Def::Err, |d| d.def());
                 self.record_def(ty.id, PathResolution::new(def));
@@ -1679,7 +1679,7 @@ fn resolve_str_path(
         components: &[&str],
         is_value: bool
     ) -> hir::Path {
-        let segments = iter::once(keywords::CrateRoot.ident())
+        let segments = iter::once(keywords::PathRoot.ident())
             .chain(
                 crate_root.into_iter()
                     .chain(components.iter().cloned())
@@ -1721,7 +1721,7 @@ pub fn resolve_str_path_error(&mut self, span: Span, path_str: &str, is_value: b
         let path = if path_str.starts_with("::") {
             ast::Path {
                 span,
-                segments: iter::once(keywords::CrateRoot.ident())
+                segments: iter::once(keywords::PathRoot.ident())
                     .chain({
                         path_str.split("::").skip(1).map(Ident::from_str)
                     })
@@ -2036,7 +2036,7 @@ fn resolve_ident_in_lexical_scope(&mut self,
         let record_used = record_used_id.is_some();
         assert!(ns == TypeNS  || ns == ValueNS);
         if ns == TypeNS {
-            ident.span = if ident.name == keywords::SelfType.name() {
+            ident.span = if ident.name == keywords::SelfUpper.name() {
                 // FIXME(jseyfried) improve `Self` hygiene
                 ident.span.with_ctxt(SyntaxContext::empty())
             } else {
@@ -2649,7 +2649,7 @@ fn with_self_rib<F>(&mut self, self_def: Def, f: F)
         let mut self_type_rib = Rib::new(NormalRibKind);
 
         // plain insert (no renaming, types are not currently hygienic....)
-        self_type_rib.bindings.insert(keywords::SelfType.ident(), self_def);
+        self_type_rib.bindings.insert(keywords::SelfUpper.ident(), self_def);
         self.ribs[TypeNS].push(self_type_rib);
         f(self);
         self.ribs[TypeNS].pop();
@@ -2660,7 +2660,7 @@ fn with_self_struct_ctor_rib<F>(&mut self, impl_id: DefId, f: F)
     {
         let self_def = Def::SelfCtor(impl_id);
         let mut self_type_rib = Rib::new(NormalRibKind);
-        self_type_rib.bindings.insert(keywords::SelfType.ident(), self_def);
+        self_type_rib.bindings.insert(keywords::SelfUpper.ident(), self_def);
         self.ribs[ValueNS].push(self_type_rib);
         f(self);
         self.ribs[ValueNS].pop();
@@ -3146,7 +3146,7 @@ fn smart_resolve_path_fragment(&mut self,
                 let item_span = path.last().unwrap().ident.span;
                 let (mod_prefix, mod_str) = if path.len() == 1 {
                     (String::new(), "this scope".to_string())
-                } else if path.len() == 2 && path[0].ident.name == keywords::CrateRoot.name() {
+                } else if path.len() == 2 && path[0].ident.name == keywords::PathRoot.name() {
                     (String::new(), "the crate root".to_string())
                 } else {
                     let mod_path = &path[..path.len() - 1];
@@ -3515,13 +3515,13 @@ fn type_ascription_suggestion(&self,
     }
 
     fn self_type_is_available(&mut self, span: Span) -> bool {
-        let binding = self.resolve_ident_in_lexical_scope(keywords::SelfType.ident(),
+        let binding = self.resolve_ident_in_lexical_scope(keywords::SelfUpper.ident(),
                                                           TypeNS, None, span);
         if let Some(LexicalScopeBinding::Def(def)) = binding { def != Def::Err } else { false }
     }
 
     fn self_value_is_available(&mut self, self_span: Span, path_span: Span) -> bool {
-        let ident = Ident::new(keywords::SelfValue.name(), self_span);
+        let ident = Ident::new(keywords::SelfLower.name(), self_span);
         let binding = self.resolve_ident_in_lexical_scope(ident, ValueNS, None, path_span);
         if let Some(LexicalScopeBinding::Def(def)) = binding { def != Def::Err } else { false }
     }
@@ -3673,7 +3673,7 @@ fn resolve_qpath(&mut self,
         };
 
         if path.len() > 1 && !global_by_default && result.base_def() != Def::Err &&
-           path[0].ident.name != keywords::CrateRoot.name() &&
+           path[0].ident.name != keywords::PathRoot.name() &&
            path[0].ident.name != keywords::DollarCrate.name() {
             let unqualified_result = {
                 match self.resolve_path_without_parent_scope(
@@ -3755,7 +3755,7 @@ fn resolve_path(
             let name = ident.name;
 
             allow_super &= ns == TypeNS &&
-                (name == keywords::SelfValue.name() ||
+                (name == keywords::SelfLower.name() ||
                  name == keywords::Super.name());
 
             if ns == TypeNS {
@@ -3779,24 +3779,24 @@ fn resolve_path(
                     return PathResult::Failed(ident.span, msg, false);
                 }
                 if i == 0 {
-                    if name == keywords::SelfValue.name() {
+                    if name == keywords::SelfLower.name() {
                         let mut ctxt = ident.span.ctxt().modern();
                         module = Some(ModuleOrUniformRoot::Module(
                             self.resolve_self(&mut ctxt, self.current_module)));
                         continue;
                     }
                     if name == keywords::Extern.name() ||
-                       name == keywords::CrateRoot.name() && ident.span.rust_2018() {
+                       name == keywords::PathRoot.name() && ident.span.rust_2018() {
                         module = Some(ModuleOrUniformRoot::ExternPrelude);
                         continue;
                     }
-                    if name == keywords::CrateRoot.name() &&
+                    if name == keywords::PathRoot.name() &&
                        ident.span.rust_2015() && self.session.rust_2018() {
                         // `::a::b` from 2015 macro on 2018 global edition
                         module = Some(ModuleOrUniformRoot::CrateRootAndExternPrelude);
                         continue;
                     }
-                    if name == keywords::CrateRoot.name() ||
+                    if name == keywords::PathRoot.name() ||
                        name == keywords::Crate.name() ||
                        name == keywords::DollarCrate.name() {
                         // `::a::b`, `crate::a::b` or `$crate::a::b`
@@ -3809,12 +3809,12 @@ fn resolve_path(
 
             // Report special messages for path segment keywords in wrong positions.
             if ident.is_path_segment_keyword() && i != 0 {
-                let name_str = if name == keywords::CrateRoot.name() {
+                let name_str = if name == keywords::PathRoot.name() {
                     "crate root".to_string()
                 } else {
                     format!("`{}`", name)
                 };
-                let msg = if i == 1 && path[0].ident.name == keywords::CrateRoot.name() {
+                let msg = if i == 1 && path[0].ident.name == keywords::PathRoot.name() {
                     format!("global paths cannot start with {}", name_str)
                 } else {
                     format!("{} in paths can only be used in start position", name_str)
@@ -3944,7 +3944,7 @@ fn lint_if_path_starts_with_module(
 
         // We're only interested in `use` paths which should start with
         // `{{root}}` or `extern` currently.
-        if first_name != keywords::Extern.name() && first_name != keywords::CrateRoot.name() {
+        if first_name != keywords::Extern.name() && first_name != keywords::PathRoot.name() {
             return
         }
 
@@ -3953,7 +3953,7 @@ fn lint_if_path_starts_with_module(
             Some(Segment { ident, .. }) if ident.name == keywords::Crate.name() => return,
             // Otherwise go below to see if it's an extern crate
             Some(_) => {}
-            // If the path has length one (and it's `CrateRoot` most likely)
+            // If the path has length one (and it's `PathRoot` most likely)
             // then we don't know whether we're gonna be importing a crate or an
             // item in our crate. Defer this lint to elsewhere
             None => return,
@@ -4740,7 +4740,7 @@ fn resolve_visibility(&mut self, vis: &ast::Visibility) -> ty::Visibility {
                 } else {
                     let ctxt = ident.span.ctxt();
                     Some(Segment::from_ident(Ident::new(
-                        keywords::CrateRoot.name(), path.span.shrink_to_lo().with_ctxt(ctxt)
+                        keywords::PathRoot.name(), path.span.shrink_to_lo().with_ctxt(ctxt)
                     )))
                 };
 
@@ -5090,17 +5090,17 @@ fn extern_prelude_get(&mut self, ident: Ident, speculative: bool)
 }
 
 fn is_self_type(path: &[Segment], namespace: Namespace) -> bool {
-    namespace == TypeNS && path.len() == 1 && path[0].ident.name == keywords::SelfType.name()
+    namespace == TypeNS && path.len() == 1 && path[0].ident.name == keywords::SelfUpper.name()
 }
 
 fn is_self_value(path: &[Segment], namespace: Namespace) -> bool {
-    namespace == ValueNS && path.len() == 1 && path[0].ident.name == keywords::SelfValue.name()
+    namespace == ValueNS && path.len() == 1 && path[0].ident.name == keywords::SelfLower.name()
 }
 
 fn names_to_string(idents: &[Ident]) -> String {
     let mut result = String::new();
     for (i, ident) in idents.iter()
-                            .filter(|ident| ident.name != keywords::CrateRoot.name())
+                            .filter(|ident| ident.name != keywords::PathRoot.name())
                             .enumerate() {
         if i > 0 {
             result.push_str("::");
index 5db3efee9f6a15ebc724b313998b73a9eea77f10..65a9652cd237cb0675157f070899b78184b6ba3f 100644 (file)
@@ -167,7 +167,7 @@ fn fold_qpath(&mut self, mut qself: Option<ast::QSelf>, mut path: ast::Path)
 
                 if path.segments[0].ident.name == keywords::DollarCrate.name() {
                     let module = self.0.resolve_crate_root(path.segments[0].ident);
-                    path.segments[0].ident.name = keywords::CrateRoot.name();
+                    path.segments[0].ident.name = keywords::PathRoot.name();
                     if !module.is_local() {
                         let span = path.segments[0].ident.span;
                         path.segments.insert(1, match module.kind {
@@ -674,7 +674,7 @@ struct Flags: u8 {
                     _ => Err(Determinacy::Determined),
                 }
                 WhereToResolve::CrateRoot => {
-                    let root_ident = Ident::new(keywords::CrateRoot.name(), orig_ident.span);
+                    let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span);
                     let root_module = self.resolve_crate_root(root_ident);
                     let binding = self.resolve_ident_in_module_ext(
                         ModuleOrUniformRoot::Module(root_module),
@@ -960,7 +960,7 @@ struct Flags: u8 {
                     break 'ok;
                 }
                 if rust_2015 {
-                    let root_ident = Ident::new(keywords::CrateRoot.name(), orig_ident.span);
+                    let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span);
                     let root_module = self.resolve_crate_root(root_ident);
                     if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module),
                                                         orig_ident, ns, None, false, path_span)
index e7cd32f4e810f44d0aedb7964dd9ce999c321290..865aace8aabb51c66c6321c26e4b4439f466dde0 100644 (file)
@@ -198,7 +198,7 @@ fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
                                         .to_name_binding(self.arenas);
                         return Ok(binding);
                     } else if ident.name == keywords::Super.name() ||
-                                ident.name == keywords::SelfValue.name() {
+                                ident.name == keywords::SelfLower.name() {
                         // FIXME: Implement these with renaming requirements so that e.g.
                         // `use super;` doesn't work, but `use super as name;` does.
                         // Fall through here to get an error from `early_resolve_...`.
@@ -1263,8 +1263,8 @@ fn import_path_to_string(names: &[Ident],
                          subclass: &ImportDirectiveSubclass,
                          span: Span) -> String {
     let pos = names.iter()
-        .position(|p| span == p.span && p.name != keywords::CrateRoot.name());
-    let global = !names.is_empty() && names[0].name == keywords::CrateRoot.name();
+        .position(|p| span == p.span && p.name != keywords::PathRoot.name());
+    let global = !names.is_empty() && names[0].name == keywords::PathRoot.name();
     if let Some(pos) = pos {
         let names = if global { &names[1..pos + 1] } else { &names[..pos + 1] };
         names_to_string(names)
index 5b8070cbf3d8e9fa1c7a0d56a380fce0fb226727..5830fa00be8cb2d8f0cd3b73572d541eca895a2b 100644 (file)
@@ -234,7 +234,7 @@ macro_rules! supported_targets {
         $(mod $module;)*
 
         /// List of supported targets
-        const TARGETS: &'static [&'static str] = &[$($triple),*];
+        const TARGETS: &[&str] = &[$($triple),*];
 
         fn load_specific(target: &str) -> TargetResult {
             match target {
index a1bb0b53f1fce38a0d5f4275c0f067a5dd9631dc..5682a73bed573ffd51f06bf3192a8a6921eac47b 100644 (file)
@@ -938,7 +938,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
 
                     opt_self = Some(ty::GenericParamDef {
                         index: 0,
-                        name: keywords::SelfType.name().as_interned_str(),
+                        name: keywords::SelfUpper.name().as_interned_str(),
                         def_id: tcx.hir.local_def_id(param_id),
                         pure_wrt_drop: false,
                         kind: ty::GenericParamDefKind::Type {
@@ -1007,7 +1007,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
                     synthetic,
                     ..
                 } => {
-                    if param.name.ident().name == keywords::SelfType.name() {
+                    if param.name.ident().name == keywords::SelfUpper.name() {
                         span_bug!(
                             param.span,
                             "`Self` should not be the name of a regular parameter"
index 5276683648d26cc030d1b9099e8409a628cba5ee..310c369a4d092656586c03aae49e2fb3b898b9d9 100644 (file)
@@ -1575,7 +1575,7 @@ fn clean(&self, cx: &DocContext) -> Generics {
         let stripped_typarams = gens.params.iter().filter_map(|param| match param.kind {
             ty::GenericParamDefKind::Lifetime => None,
             ty::GenericParamDefKind::Type { .. } => {
-                if param.name == keywords::SelfType.name().as_str() {
+                if param.name == keywords::SelfUpper.name().as_str() {
                     assert_eq!(param.index, 0);
                     return None;
                 }
@@ -3174,7 +3174,7 @@ fn qpath_to_string(p: &hir::QPath) -> String {
         if i > 0 {
             s.push_str("::");
         }
-        if seg.ident.name != keywords::CrateRoot.name() {
+        if seg.ident.name != keywords::PathRoot.name() {
             s.push_str(&*seg.ident.as_str());
         }
     }
@@ -3726,7 +3726,7 @@ fn resolve_type(cx: &DocContext,
             hir::Float(float_ty) => return Primitive(float_ty.into()),
         },
         Def::SelfTy(..) if path.segments.len() == 1 => {
-            return Generic(keywords::SelfType.name().to_string());
+            return Generic(keywords::SelfUpper.name().to_string());
         }
         Def::TyParam(..) if path.segments.len() == 1 => {
             return Generic(format!("{:#}", path));
index 5263cfe7b0e4f8089e97151f75808486fe28edc9..fa5d015e5b72dc494ea7469d0c36567a64013b1e 100644 (file)
@@ -57,6 +57,9 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
     {css_extension}\
     {favicon}\
     {in_header}\
+    <style type=\"text/css\">\
+    #crate-search{{background-image:url(\"{root_path}down-arrow{suffix}.svg\");}}\
+    </style>\
 </head>\
 <body class=\"rustdoc {css_class}\">\
     <!--[if lte IE 8]>\
@@ -81,11 +84,16 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
     <nav class=\"sub\">\
         <form class=\"search-form js-only\">\
             <div class=\"search-container\">\
-                <input class=\"search-input\" name=\"search\" \
-                       autocomplete=\"off\" \
-                       spellcheck=\"false\" \
-                       placeholder=\"Click or press â€˜S’ to search, â€˜?’ for more options…\" \
-                       type=\"search\">\
+                <div>\
+                    <select id=\"crate-search\">\
+                        <option value=\"All crates\">All crates</option>\
+                    </select>\
+                    <input class=\"search-input\" name=\"search\" \
+                           autocomplete=\"off\" \
+                           spellcheck=\"false\" \
+                           placeholder=\"Click or press â€˜S’ to search, â€˜?’ for more options…\" \
+                           type=\"search\">\
+                </div>\
                 <a id=\"settings-menu\" href=\"{root_path}settings.html\">\
                     <img src=\"{root_path}wheel{suffix}.svg\" width=\"18\" alt=\"Change settings\">\
                 </a>\
index 1194df20ad6f5683147a9c3844be74b2b0c3d74d..6158815fb9a51ec533785f8f1b03f235d2826335 100644 (file)
@@ -793,6 +793,8 @@ fn write_shared(
           static_files::BRUSH_SVG)?;
     write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)),
           static_files::WHEEL_SVG)?;
+    write(cx.dst.join(&format!("down-arrow{}.svg", cx.shared.resource_suffix)),
+          static_files::DOWN_ARROW_SVG)?;
     write_minify(cx.dst.join(&format!("light{}.css", cx.shared.resource_suffix)),
                  static_files::themes::LIGHT,
                  options.enable_minification)?;
@@ -1066,7 +1068,7 @@ fn to_json_string(&self) -> String {
                                        &[(minifier::js::Keyword::Null, "N")]),
                  &dst);
     }
-    try_err!(writeln!(&mut w, "initSearch(searchIndex);"), &dst);
+    try_err!(writeln!(&mut w, "initSearch(searchIndex);addSearchOptions(searchIndex);"), &dst);
 
     if options.enable_index_page {
         if let Some(index_page) = options.index_page.clone() {
diff --git a/src/librustdoc/html/static/down-arrow.svg b/src/librustdoc/html/static/down-arrow.svg
new file mode 100644 (file)
index 0000000..a2d9a37
--- /dev/null
@@ -0,0 +1 @@
+<?xml version="1.0" ?><!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg height="128px" id="Layer_1" style="enable-background:new 0 0 128 128;" version="1.1" viewBox="0 0 128 128" width="128px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><line style="fill:none;stroke:#2F3435;stroke-width:12;stroke-linecap:square;stroke-miterlimit:10;" x1="111" x2="64" y1="40.5" y2="87.499"/><line style="fill:none;stroke:#2F3435;stroke-width:12;stroke-linecap:square;stroke-miterlimit:10;" x1="64" x2="17" y1="87.499" y2="40.5"/></g></svg>
\ No newline at end of file
index 125277fc5d3dac2fd2d0110546f7359b75e5ef84..1869969a5306956171b4026989941a5782b92913 100644 (file)
@@ -218,12 +218,14 @@ if (!String.prototype.endsWith) {
     //
     // So I guess you could say things are getting pretty interoperable.
     function getVirtualKey(ev) {
-        if ("key" in ev && typeof ev.key != "undefined")
+        if ("key" in ev && typeof ev.key != "undefined") {
             return ev.key;
+        }
 
         var c = ev.charCode || ev.keyCode;
-        if (c == 27)
+        if (c == 27) {
             return "Escape";
+        }
         return String.fromCharCode(c);
     }
 
@@ -431,12 +433,13 @@ if (!String.prototype.endsWith) {
 
         /**
          * Executes the query and builds an index of results
-         * @param  {[Object]} query     [The user query]
-         * @param  {[type]} searchWords [The list of search words to query
-         *                               against]
-         * @return {[type]}             [A search index of results]
+         * @param  {[Object]} query      [The user query]
+         * @param  {[type]} searchWords  [The list of search words to query
+         *                                against]
+         * @param  {[type]} filterCrates [Crate to search in if defined]
+         * @return {[type]}              [A search index of results]
          */
-        function execQuery(query, searchWords) {
+        function execQuery(query, searchWords, filterCrates) {
             function itemTypeFromName(typename) {
                 for (var i = 0; i < itemTypes.length; ++i) {
                     if (itemTypes[i] === typename) {
@@ -812,6 +815,9 @@ if (!String.prototype.endsWith) {
             {
                 val = extractGenerics(val.substr(1, val.length - 2));
                 for (var i = 0; i < nSearchWords; ++i) {
+                    if (filterCrates !== undefined && searchIndex[i].crate !== filterCrates) {
+                        continue;
+                    }
                     var in_args = findArg(searchIndex[i], val, true);
                     var returned = checkReturned(searchIndex[i], val, true);
                     var ty = searchIndex[i];
@@ -866,6 +872,9 @@ if (!String.prototype.endsWith) {
                 var output = extractGenerics(parts[1]);
 
                 for (var i = 0; i < nSearchWords; ++i) {
+                    if (filterCrates !== undefined && searchIndex[i].crate !== filterCrates) {
+                        continue;
+                    }
                     var type = searchIndex[i].type;
                     var ty = searchIndex[i];
                     if (!type) {
@@ -937,11 +946,11 @@ if (!String.prototype.endsWith) {
                 var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);
 
                 for (j = 0; j < nSearchWords; ++j) {
-                    var lev_distance;
                     var ty = searchIndex[j];
-                    if (!ty) {
+                    if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {
                         continue;
                     }
+                    var lev_distance;
                     var lev_add = 0;
                     if (paths.length > 1) {
                         var lev = checkPath(contains, paths[paths.length - 1], ty);
@@ -1326,7 +1335,7 @@ if (!String.prototype.endsWith) {
             return '<div>' + text + ' <div class="count">(' + nbElems + ')</div></div>';
         }
 
-        function showResults(results) {
+        function showResults(results, filterCrates) {
             if (results['others'].length === 1 &&
                 getCurrentValue('rustdoc-go-to-only-result') === "true") {
                 var elem = document.createElement('a');
@@ -1344,8 +1353,13 @@ if (!String.prototype.endsWith) {
             var ret_in_args = addTab(results['in_args'], query, false);
             var ret_returned = addTab(results['returned'], query, false);
 
+            var filter = "";
+            if (filterCrates !== undefined) {
+                filter = " (in <b>" + filterCrates + "</b> crate)";
+            }
+
             var output = '<h1>Results for ' + escape(query.query) +
-                (query.type ? ' (type: ' + escape(query.type) + ')' : '') + '</h1>' +
+                (query.type ? ' (type: ' + escape(query.type) + ')' : '') + filter + '</h1>' +
                 '<div id="titles">' +
                 makeTabHeader(0, "In Names", ret_others[1]) +
                 makeTabHeader(1, "In Parameters", ret_in_args[1]) +
@@ -1374,7 +1388,7 @@ if (!String.prototype.endsWith) {
             printTab(currentTab);
         }
 
-        function execSearch(query, searchWords) {
+        function execSearch(query, searchWords, filterCrates) {
             var queries = query.raw.split(",");
             var results = {
                 'in_args': [],
@@ -1385,7 +1399,7 @@ if (!String.prototype.endsWith) {
             for (var i = 0; i < queries.length; ++i) {
                 var query = queries[i].trim();
                 if (query.length !== 0) {
-                    var tmp = execQuery(getQuery(query), searchWords);
+                    var tmp = execQuery(getQuery(query), searchWords, filterCrates);
 
                     results['in_args'].push(tmp['in_args']);
                     results['returned'].push(tmp['returned']);
@@ -1447,7 +1461,16 @@ if (!String.prototype.endsWith) {
             }
         }
 
-        function search(e) {
+        function getFilterCrates() {
+            var elem = document.getElementById("crate-search");
+
+            if (elem && elem.value !== "All crates" && rawSearchIndex.hasOwnProperty(elem.value)) {
+                return elem.value;
+            }
+            return undefined;
+        }
+
+        function search(e, forced) {
             var params = getQueryStringParams();
             var query = getQuery(search_input.value.trim());
 
@@ -1455,7 +1478,10 @@ if (!String.prototype.endsWith) {
                 e.preventDefault();
             }
 
-            if (query.query.length === 0 || query.id === currentResults) {
+            if (query.query.length === 0) {
+                return;
+            }
+            if (forced !== true && query.id === currentResults) {
                 if (query.query.length > 0) {
                     putBackSearch(search_input);
                 }
@@ -1475,7 +1501,8 @@ if (!String.prototype.endsWith) {
                 }
             }
 
-            showResults(execSearch(query, index));
+            var filterCrates = getFilterCrates();
+            showResults(execSearch(query, index, filterCrates), filterCrates);
         }
 
         function buildIndex(rawSearchIndex) {
@@ -1575,6 +1602,13 @@ if (!String.prototype.endsWith) {
             };
             search_input.onpaste = search_input.onchange;
 
+            var selectCrate = document.getElementById('crate-search');
+            if (selectCrate) {
+                selectCrate.onchange = function() {
+                    search(undefined, true);
+                };
+            }
+
             // Push and pop states are used to add search results to the browser
             // history.
             if (browserSupportsHistoryApi()) {
@@ -2323,6 +2357,39 @@ if (!String.prototype.endsWith) {
     if (window.location.hash && window.location.hash.length > 0) {
         expandSection(window.location.hash.replace(/^#/, ''));
     }
+
+    function addSearchOptions(crates) {
+        var elem = document.getElementById('crate-search');
+
+        if (!elem) {
+            return;
+        }
+        var crates_text = [];
+        for (var crate in crates) {
+            if (crates.hasOwnProperty(crate)) {
+                crates_text.push(crate);
+            }
+        }
+        crates_text.sort(function(a, b) {
+            var lower_a = a.toLowerCase();
+            var lower_b = b.toLowerCase();
+
+            if (lower_a < lower_b) {
+                return -1;
+            } else if (lower_a > lower_b) {
+                return 1;
+            }
+            return 0;
+        });
+        for (var i = 0; i < crates_text.length; ++i) {
+            var option = document.createElement("option");
+            option.value = crates_text[i];
+            option.innerText = crates_text[i];
+            elem.appendChild(option);
+        }
+    }
+
+    window.addSearchOptions = addSearchOptions;
 }());
 
 // Sets the focus on the search bar at the top of the page
index 83129d93a681f6af8810d4e4bb70034a1f16f2ed..37d26a4cadc572b8d2b35c8721deb35078424a9c 100644 (file)
@@ -620,13 +620,36 @@ a {
 .search-container {
        position: relative;
 }
+.search-container > div {
+       display: inline-flex;
+       width: calc(100% - 34px);
+}
+#crate-search {
+       margin-top: 5px;
+       padding: 6px;
+       padding-right: 19px;
+       border: 0;
+       border-right: 0;
+       border-radius: 4px 0 0 4px;
+       outline: none;
+       cursor: pointer;
+       border-right: 1px solid;
+       -moz-appearance: none;
+       -webkit-appearance: none;
+       /* Removes default arrow from firefox */
+       text-indent: 0.01px;
+       text-overflow: "";
+       background-repeat: no-repeat;
+       background-color: transparent;
+       background-size: 16%;
+       background-position: calc(100% - 1px) 56%;
+}
 .search-container > .top-button {
        position: absolute;
        right: 0;
        top: 10px;
 }
 .search-input {
-       width: calc(100% - 34px);
        /* Override Normalize.css: we have margins and do
         not want to overflow - the `moz` attribute is necessary
         until Firefox 29, too early to drop at this point */
@@ -634,13 +657,14 @@ a {
        box-sizing: border-box !important;
        outline: none;
        border: none;
-       border-radius: 1px;
+       border-radius: 0 1px 1px 0;
        margin-top: 5px;
        padding: 10px 16px;
        font-size: 17px;
        transition: border-color 300ms ease;
        transition: border-radius 300ms ease-in-out;
        transition: box-shadow 300ms ease-in-out;
+       width: 100%;
 }
 
 .search-input:focus {
index 29388f096ee842f3801c8cea75ed36cb51f31fcd..2cd1a8580890c44320934c700e905799097790a4 100644 (file)
@@ -182,9 +182,15 @@ a.test-arrow {
        color: #999;
 }
 
+#crate-search {
+       color: #111;
+       background-color: #f0f0f0;
+       border-color: #000;
+}
+
 .search-input {
        color: #111;
-       box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
+       box-shadow: 1px 0 0 1px #000, 0 0 0 2px transparent;
        background-color: #f0f0f0;
 }
 
index d37cfa4142f75501bca29ca8cda0d283ae3754c8..4cf35f64d19a4463cb4d1cc071baf19fffd6d79f 100644 (file)
@@ -182,9 +182,16 @@ a.test-arrow {
        color: #999;
 }
 
+#crate-search {
+       color: #555;
+       background-color: white;
+       border-color: #e0e0e0;
+       box-shadow: 0px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
+}
+
 .search-input {
        color: #555;
-       box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
+       box-shadow: 1px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
        background-color: white;
 }
 
index ee29f15d686c1acf57a9c9f749734a73aef73967..a485facfac2dcb1fb30084aabfd4e44fda6d24ba 100644 (file)
@@ -45,6 +45,9 @@
 /// The file contents of `wheel.svg`, the icon used for the settings button.
 pub static WHEEL_SVG: &'static [u8] = include_bytes!("static/wheel.svg");
 
+/// The file contents of `down-arrow.svg`, the icon used for the crate choice combobox.
+pub static DOWN_ARROW_SVG: &'static [u8] = include_bytes!("static/down-arrow.svg");
+
 /// The contents of `COPYRIGHT.txt`, the license listing for files distributed with documentation
 /// output.
 pub static COPYRIGHT: &'static [u8] = include_bytes!("static/COPYRIGHT.txt");
index 5d221d3006f3eb58384516309754b7c57a246b97..31adb2e0369c9f539c72465dd5ec8957649c803f 100644 (file)
@@ -100,7 +100,7 @@ pub fn visit(&mut self, krate: &hir::Crate) {
                                               None);
         // attach the crate's exported macros to the top-level module:
         let macro_exports: Vec<_> =
-            krate.exported_macros.iter().map(|def| self.visit_local_macro(def)).collect();
+            krate.exported_macros.iter().map(|def| self.visit_local_macro(def, None)).collect();
         self.module.macros.extend(macro_exports);
         self.module.is_crate = true;
 
@@ -376,6 +376,10 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
                 });
                 true
             }
+            Node::MacroDef(def) if !glob => {
+                om.macros.push(self.visit_local_macro(def, renamed));
+                true
+            }
             _ => false,
         };
         self.view_item_stack.remove(&def_node_id);
@@ -593,7 +597,11 @@ pub fn visit_item(&mut self, item: &hir::Item,
     }
 
     // convert each exported_macro into a doc item
-    fn visit_local_macro(&self, def: &hir::MacroDef) -> Macro {
+    fn visit_local_macro(
+        &self,
+        def: &hir::MacroDef,
+        renamed: Option<ast::Name>
+    ) -> Macro {
         debug!("visit_local_macro: {}", def.name);
         let tts = def.body.trees().collect::<Vec<_>>();
         // Extract the spans of all matchers. They represent the "interface" of the macro.
@@ -602,7 +610,7 @@ fn visit_local_macro(&self, def: &hir::MacroDef) -> Macro {
         Macro {
             def_id: self.cx.tcx.hir.local_def_id(def.id),
             attrs: def.attrs.clone(),
-            name: def.name,
+            name: renamed.unwrap_or(def.name),
             whence: def.span,
             matchers,
             stab: self.stability(def.id),
index b387a8d59a56d1b10b028cc1f8f423d5e657877c..03e81a720dc640ececa2e08bb32e631a30547b67 100644 (file)
@@ -283,11 +283,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
 
 #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
 pub fn current_exe() -> io::Result<PathBuf> {
-    let selfexe = PathBuf::from("/proc/self/exe");
-    if selfexe.exists() {
-        ::fs::read_link(selfexe)
-    } else {
-        Err(io::Error::new(io::ErrorKind::Other, "no /proc/self/exe available. Is /proc mounted?"))
+    match ::fs::read_link("/proc/self/exe") {
+        Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
+            Err(io::Error::new(
+                io::ErrorKind::Other,
+                "no /proc/self/exe available. Is /proc mounted?"
+            ))
+        },
+        other => other,
     }
 }
 
index 227017a9073fec63be9c5cba4f7d140c866113c6..872257118714e55930bd45ad21bb76319a7cd006 100644 (file)
@@ -73,7 +73,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 pub struct Path {
     pub span: Span,
     /// The segments in the path: the things separated by `::`.
-    /// Global paths begin with `keywords::CrateRoot`.
+    /// Global paths begin with `keywords::PathRoot`.
     pub segments: Vec<PathSegment>,
 }
 
@@ -105,19 +105,8 @@ pub fn from_ident(ident: Ident) -> Path {
         }
     }
 
-    // Make a "crate root" segment for this path unless it already has it
-    // or starts with something like `self`/`super`/`$crate`/etc.
-    pub fn make_root(&self) -> Option<PathSegment> {
-        if let Some(ident) = self.segments.get(0).map(|seg| seg.ident) {
-            if ident.is_path_segment_keyword() {
-                return None;
-            }
-        }
-        Some(PathSegment::crate_root(self.span.shrink_to_lo()))
-    }
-
     pub fn is_global(&self) -> bool {
-        !self.segments.is_empty() && self.segments[0].ident.name == keywords::CrateRoot.name()
+        !self.segments.is_empty() && self.segments[0].ident.name == keywords::PathRoot.name()
     }
 }
 
@@ -144,8 +133,8 @@ impl PathSegment {
     pub fn from_ident(ident: Ident) -> Self {
         PathSegment { ident, id: DUMMY_NODE_ID, args: None }
     }
-    pub fn crate_root(span: Span) -> Self {
-        PathSegment::from_ident(Ident::new(keywords::CrateRoot.name(), span))
+    pub fn path_root(span: Span) -> Self {
+        PathSegment::from_ident(Ident::new(keywords::PathRoot.name(), span))
     }
 }
 
@@ -1688,7 +1677,7 @@ pub enum SelfKind {
 impl Arg {
     pub fn to_self(&self) -> Option<ExplicitSelf> {
         if let PatKind::Ident(BindingMode::ByValue(mutbl), ident, _) = self.pat.node {
-            if ident.name == keywords::SelfValue.name() {
+            if ident.name == keywords::SelfLower.name() {
                 return match self.ty.node {
                     TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
                     TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.node.is_implicit_self() => {
@@ -1706,7 +1695,7 @@ pub fn to_self(&self) -> Option<ExplicitSelf> {
 
     pub fn is_self(&self) -> bool {
         if let PatKind::Ident(_, ident, _) = self.pat.node {
-            ident.name == keywords::SelfValue.name()
+            ident.name == keywords::SelfLower.name()
         } else {
             false
         }
index cacec867cf198053cc6b187d4bf9cba2db551dcb..5770f6bb8a28c442f10fd76f8065f65d1696742c 100644 (file)
@@ -318,9 +318,13 @@ fn path_all(&self,
                 args: Vec<ast::GenericArg>,
                 bindings: Vec<ast::TypeBinding> )
                 -> ast::Path {
+        assert!(!idents.is_empty());
+        let add_root = global && !idents[0].is_path_segment_keyword();
+        let mut segments = Vec::with_capacity(idents.len() + add_root as usize);
+        if add_root {
+            segments.push(ast::PathSegment::path_root(span));
+        }
         let last_ident = idents.pop().unwrap();
-        let mut segments: Vec<ast::PathSegment> = vec![];
-
         segments.extend(idents.into_iter().map(|ident| {
             ast::PathSegment::from_ident(ident.with_span_pos(span))
         }));
@@ -334,13 +338,7 @@ fn path_all(&self,
             id: ast::DUMMY_NODE_ID,
             args,
         });
-        let mut path = ast::Path { span, segments };
-        if global {
-            if let Some(seg) = path.make_root() {
-                path.segments.insert(0, seg);
-            }
-        }
-        path
+        ast::Path { span, segments }
     }
 
     /// Constructs a qualified path.
@@ -625,7 +623,7 @@ fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr> {
         self.expr_path(self.path_ident(span, id))
     }
     fn expr_self(&self, span: Span) -> P<ast::Expr> {
-        self.expr_ident(span, keywords::SelfValue.ident())
+        self.expr_ident(span, keywords::SelfLower.ident())
     }
 
     fn expr_binary(&self, sp: Span, op: ast::BinOpKind,
index 68a96293891a0c0bbce93e0c9ad83d9c8e95f85b..67f3dc1bb527226ed2dd4e3f0227f6b8025d8152 100644 (file)
@@ -204,7 +204,7 @@ fn macro_bang_format(path: &ast::Path) -> ExpnFormat {
             path_str.push_str("::");
         }
 
-        if segment.ident.name != keywords::CrateRoot.name() &&
+        if segment.ident.name != keywords::PathRoot.name() &&
             segment.ident.name != keywords::DollarCrate.name()
         {
             path_str.push_str(&segment.ident.as_str())
index edc431be3694ba020f9365b6aea8480dd3ba3e3b..a7415e845cae398b45aad0311139c9ab678b8b2b 100644 (file)
@@ -444,7 +444,6 @@ fn parse_sep_and_kleene_op<I>(
             macro_node_id,
         ),
         Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs),
-        _ => unimplemented!(),
     }
 }
 
index bfdc75378d5e1dfeb57381801b671af7930f22d8..5e0176df3115b6e4a8b81c717b20c6a1928e5305 100644 (file)
@@ -53,8 +53,7 @@ macro_rules! declare_features {
         /// Represents active features that are currently being implemented or
         /// currently being considered for addition/removal.
         const ACTIVE_FEATURES:
-                &'static [(&'static str, &'static str, Option<u32>,
-                           Option<Edition>, fn(&mut Features, Span))] =
+            &[(&str, &str, Option<u32>, Option<Edition>, fn(&mut Features, Span))] =
             &[$((stringify!($feature), $ver, $issue, $edition, set!($feature))),+];
 
         /// A set of features to be used by later passes.
@@ -439,8 +438,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // 'a: { break 'a; }
     (active, label_break_value, "1.28.0", Some(48594), None),
 
-    // Integer match exhaustiveness checking
-    (active, exhaustive_integer_patterns, "1.30.0", Some(50907), None),
+    // Exhaustive pattern matching on `usize` and `isize`.
+    (active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
 
     // #[doc(keyword = "...")]
     (active, doc_keyword, "1.28.0", Some(51315), None),
@@ -686,6 +685,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
     // Allows use of the :literal macro fragment specifier (RFC 1576)
     (accepted, macro_literal_matcher, "1.31.0", Some(35625), None),
+    // Integer match exhaustiveness checking (RFC 2591)
+    (accepted, exhaustive_integer_patterns, "1.32.0", Some(50907), None),
     // Use `?` as the Kleene "at most one" operator
     (accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None),
     // `Self` struct constructor (RFC 2302)
@@ -772,7 +773,7 @@ pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
 }
 
 // Attributes that have a special meaning to rustc or rustdoc
-pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGate)] = &[
+pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[
     // Normal attributes
 
     ("warn", Normal, Ungated),
@@ -1386,48 +1387,48 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue
 
 }
 
-const EXPLAIN_BOX_SYNTAX: &'static str =
+const EXPLAIN_BOX_SYNTAX: &str =
     "box expression syntax is experimental; you can call `Box::new` instead.";
 
-pub const EXPLAIN_STMT_ATTR_SYNTAX: &'static str =
+pub const EXPLAIN_STMT_ATTR_SYNTAX: &str =
     "attributes on expressions are experimental.";
 
-pub const EXPLAIN_ASM: &'static str =
+pub const EXPLAIN_ASM: &str =
     "inline assembly is not stable enough for use and is subject to change";
 
-pub const EXPLAIN_GLOBAL_ASM: &'static str =
+pub const EXPLAIN_GLOBAL_ASM: &str =
     "`global_asm!` is not stable enough for use and is subject to change";
 
-pub const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &'static str =
+pub const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &str =
     "custom test frameworks are an unstable feature";
 
-pub const EXPLAIN_LOG_SYNTAX: &'static str =
+pub const EXPLAIN_LOG_SYNTAX: &str =
     "`log_syntax!` is not stable enough for use and is subject to change";
 
-pub const EXPLAIN_CONCAT_IDENTS: &'static str =
+pub const EXPLAIN_CONCAT_IDENTS: &str =
     "`concat_idents` is not stable enough for use and is subject to change";
 
-pub const EXPLAIN_FORMAT_ARGS_NL: &'static str =
+pub const EXPLAIN_FORMAT_ARGS_NL: &str =
     "`format_args_nl` is only for internal language use and is subject to change";
 
-pub const EXPLAIN_TRACE_MACROS: &'static str =
+pub const EXPLAIN_TRACE_MACROS: &str =
     "`trace_macros` is not stable enough for use and is subject to change";
-pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =
+pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &str =
     "allow_internal_unstable side-steps feature gating and stability checks";
-pub const EXPLAIN_ALLOW_INTERNAL_UNSAFE: &'static str =
+pub const EXPLAIN_ALLOW_INTERNAL_UNSAFE: &str =
     "allow_internal_unsafe side-steps the unsafe_code lint";
 
-pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
+pub const EXPLAIN_CUSTOM_DERIVE: &str =
     "`#[derive]` for custom traits is deprecated and will be removed in the future.";
 
-pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str =
+pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &str =
     "`#[derive]` for custom traits is deprecated and will be removed in the future. \
     Prefer using procedural macro custom derive.";
 
-pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
+pub const EXPLAIN_DERIVE_UNDERSCORE: &str =
     "attributes of the form `#[derive_*]` are reserved for the compiler";
 
-pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str =
+pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &str =
     "unsized tuple coercion is not stable enough for use and is subject to change";
 
 struct PostExpansionVisitor<'a> {
index a240604bfe0ad1cc855aca1aa3df10c65083f641..4ff6048e821787693269ef053f496fe4ad50ef44 100644 (file)
@@ -22,8 +22,8 @@ enum InnerAttributeParsePolicy<'a> {
     NotPermitted { reason: &'a str },
 }
 
-const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &'static str = "an inner attribute is not \
-                                                             permitted in this context";
+const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &str = "an inner attribute is not \
+                                                     permitted in this context";
 
 impl<'a> Parser<'a> {
     /// Parse attributes that appear before an item
index 03bf1b5a4e1ed53069e3ddc118a04e1bc8ce9007..8a620c8067d3c2900f8bf311e1c2e1fb8071ec8e 100644 (file)
     ('>', "Fullwidth Greater-Than Sign", '>'), ];
 
 
-const ASCII_ARRAY: &'static [(char, &'static str)] = &[
+const ASCII_ARRAY: &[(char, &str)] = &[
     (' ', "Space"),
     ('_', "Underscore"),
     ('-', "Minus/Hyphen"),
index 1cd5006f3304cefc7a7d0ab8374691a4a5a9825d..8165c0e44c413a3469fe8f2de6c8fc706857902c 100644 (file)
@@ -2082,7 +2082,7 @@ pub fn parse_path(&mut self, style: PathStyle) -> PResult<'a, ast::Path> {
         let mut segments = Vec::new();
         let mod_sep_ctxt = self.span.ctxt();
         if self.eat(&token::ModSep) {
-            segments.push(PathSegment::crate_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt)));
+            segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt)));
         }
         self.parse_path_segments(&mut segments, style, enable_warning)?;
 
@@ -5508,7 +5508,7 @@ fn parse_self_arg(&mut self) -> PResult<'a, Option<Arg>> {
             _ => unreachable!()
         };
         let isolated_self = |this: &mut Self, n| {
-            this.look_ahead(n, |t| t.is_keyword(keywords::SelfValue)) &&
+            this.look_ahead(n, |t| t.is_keyword(keywords::SelfLower)) &&
             this.look_ahead(n + 1, |t| t != &token::ModSep)
         };
 
@@ -6330,7 +6330,7 @@ pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibili
                 return Ok(vis)
             } else if self.look_ahead(2, |t| t == &token::CloseDelim(token::Paren)) &&
                       self.look_ahead(1, |t| t.is_keyword(keywords::Super) ||
-                                             t.is_keyword(keywords::SelfValue))
+                                             t.is_keyword(keywords::SelfLower))
             {
                 // `pub(self)` or `pub(super)`
                 self.bump(); // `(`
@@ -6782,7 +6782,7 @@ fn parse_crate_name_with_dashes(&mut self) -> PResult<'a, ast::Ident> {
         let error_msg = "crate name using dashes are not valid in `extern crate` statements";
         let suggestion_msg = "if the original crate name uses dashes you need to use underscores \
                               in the code";
-        let mut ident = if self.token.is_keyword(keywords::SelfValue) {
+        let mut ident = if self.token.is_keyword(keywords::SelfLower) {
             self.parse_path_segment_ident()
         } else {
             self.parse_ident()
@@ -7685,7 +7685,7 @@ fn parse_use_tree(&mut self) -> PResult<'a, UseTree> {
             let mod_sep_ctxt = self.span.ctxt();
             if self.eat(&token::ModSep) {
                 prefix.segments.push(
-                    PathSegment::crate_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))
+                    PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))
                 );
             }
 
index a9f08fdd4112691799619b70ddd4cad2bd09a5f8..e50f28897dd1287db983f5918bf184191bf17317 100644 (file)
@@ -724,7 +724,7 @@ fn print_attribute_path(&mut self, path: &ast::Path) -> io::Result<()> {
             if i > 0 {
                 self.writer().word("::")?
             }
-            if segment.ident.name != keywords::CrateRoot.name() &&
+            if segment.ident.name != keywords::PathRoot.name() &&
                segment.ident.name != keywords::DollarCrate.name()
             {
                 self.writer().word(segment.ident.as_str().get())?;
@@ -2463,7 +2463,7 @@ fn print_path_segment(&mut self,
                           colons_before_params: bool)
                           -> io::Result<()>
     {
-        if segment.ident.name != keywords::CrateRoot.name() &&
+        if segment.ident.name != keywords::PathRoot.name() &&
            segment.ident.name != keywords::DollarCrate.name() {
             self.print_ident(segment.ident)?;
             if let Some(ref args) = segment.args {
index 1210f331b285b7c4d7fd820c81076b2800c16e50..5c994558ab06feb3aafc0f72df4634bc04b683f6 100644 (file)
@@ -112,7 +112,7 @@ pub fn maybe_inject_crates_ref(
         vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
         node: ast::ItemKind::Use(P(ast::UseTree {
             prefix: ast::Path {
-                segments: iter::once(keywords::CrateRoot.ident())
+                segments: iter::once(keywords::PathRoot.ident())
                     .chain(
                         [name, "prelude", "v1"].iter().cloned()
                             .map(ast::Ident::from_str)
index 026ddccd7be9793ca40cd0dbd434fecf01cec28b..2ff9fb487c4f225f228157844fc6b629a1909a32 100644 (file)
@@ -47,7 +47,7 @@ fn next(&self) -> State {
     }
 }
 
-const OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"];
+const OPTIONS: &[&str] = &["volatile", "alignstack", "intel"];
 
 pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt,
                        sp: Span,
index ec935b3e72f230955fc8884210c09e8d7c6d200d..b9e0933331cb87814deb4a4177d9d454249eea14 100644 (file)
@@ -140,7 +140,7 @@ fn process_variant(cx: &mut ExtCtxt, stmts: &mut Vec<ast::Stmt>, variant: &Varia
     let mut stmts = Vec::new();
     if is_union {
         // let _: AssertParamIsCopy<Self>;
-        let self_ty = cx.ty_path(cx.path_ident(trait_span, keywords::SelfType.ident()));
+        let self_ty = cx.ty_path(cx.path_ident(trait_span, keywords::SelfUpper.ident()));
         assert_ty_bounds(cx, &mut stmts, self_ty, trait_span, "AssertParamIsCopy");
     } else {
         match *substr.fields {
index a5b12ce4c4d834c83586cd0f3e2321ffd342be54..c0c11f64bc3b88b722e65f96846e96fa15ed63c1 100644 (file)
@@ -938,7 +938,7 @@ fn create_method(&self,
         let args = {
             let self_args = explicit_self.map(|explicit_self| {
                 ast::Arg::from_self(explicit_self,
-                                    keywords::SelfValue.ident().with_span_pos(trait_.span))
+                                    keywords::SelfLower.ident().with_span_pos(trait_.span))
             });
             let nonself_args = arg_types.into_iter()
                 .map(|(name, ty)| cx.arg(trait_.span, name, ty));
index 1130a50537d017150d48e7e8e761d51522ee91da..000bede7348a51d31a97a6a45fd000983dac45a7 100644 (file)
@@ -28,7 +28,7 @@
 use syntax_pos::Span;
 use syntax::tokenstream;
 
-pub const MACRO: &'static str = "global_asm";
+pub const MACRO: &str = "global_asm";
 
 pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
                               sp: Span,
index c859275ed020cb727394890071ceab5c76474a99..f4ff0989b5d863b5318f75b36159c450111c32cb 100644 (file)
@@ -30,8 +30,7 @@
 
 use deriving;
 
-const PROC_MACRO_KINDS: [&'static str; 3] =
-    ["proc_macro_derive", "proc_macro_attribute", "proc_macro"];
+const PROC_MACRO_KINDS: [&str; 3] = ["proc_macro_derive", "proc_macro_attribute", "proc_macro"];
 
 struct ProcMacroDerive {
     trait_name: ast::Name,
index 5819cd7f480a039ded2eef959be9cac7845bfada..127dc43fdabe7ee372608f4d703174cebaa7da01 100644 (file)
@@ -13,7 +13,6 @@
 
 /// The edition of the compiler (RFC 2052)
 #[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)]
-#[non_exhaustive]
 pub enum Edition {
     // editions must be kept in order, oldest to newest
 
@@ -33,7 +32,7 @@ pub enum Edition {
 // must be in order from oldest to newest
 pub const ALL_EDITIONS: &[Edition] = &[Edition::Edition2015, Edition::Edition2018];
 
-pub const EDITION_NAME_LIST: &'static str = "2015|2018";
+pub const EDITION_NAME_LIST: &str = "2015|2018";
 
 pub const DEFAULT_EDITION: Edition = Edition::Edition2015;
 
index bc52a3e1c7c297ee35cd090f4e94e148b1b1b50f..074687fc726e8fd209d4e5c69df09d15a8d128e0 100644 (file)
@@ -17,7 +17,7 @@
 
 use GLOBALS;
 use Span;
-use edition::Edition;
+use edition::{Edition, DEFAULT_EDITION};
 use symbol::Symbol;
 
 use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -217,7 +217,7 @@ impl HygieneData {
                 opaque_and_semitransparent: SyntaxContext(0),
             }],
             markings: FxHashMap::default(),
-            default_edition: Edition::Edition2015,
+            default_edition: DEFAULT_EDITION,
         }
     }
 
index 741877bb4c88fdc94e99d6678edcb7208c9e659a..4f2eb74c0722766a3181ff9559fd8e205636e9b0 100644 (file)
@@ -349,11 +349,11 @@ pub fn fresh() -> Self {
     // Special reserved identifiers used internally for elided lifetimes,
     // unnamed method parameters, crate root module, error recovery etc.
     (0,  Invalid,            "")
-    (1,  CrateRoot,          "{{root}}")
+    (1,  PathRoot,           "{{root}}")
     (2,  DollarCrate,        "$crate")
     (3,  Underscore,         "_")
 
-    // Keywords used in the language.
+    // Keywords that are used in stable Rust.
     (4,  As,                 "as")
     (5,  Box,                "box")
     (6,  Break,              "break")
@@ -378,8 +378,8 @@ pub fn fresh() -> Self {
     (25, Pub,                "pub")
     (26, Ref,                "ref")
     (27, Return,             "return")
-    (28, SelfValue,          "self")
-    (29, SelfType,           "Self")
+    (28, SelfLower,          "self")
+    (29, SelfUpper,          "Self")
     (30, Static,             "static")
     (31, Struct,             "struct")
     (32, Super,              "super")
@@ -391,7 +391,7 @@ pub fn fresh() -> Self {
     (38, Where,              "where")
     (39, While,              "while")
 
-    // Keywords reserved for future use.
+    // Keywords that are used in unstable Rust or reserved for future use.
     (40, Abstract,           "abstract")
     (41, Become,             "become")
     (42, Do,                 "do")
@@ -404,9 +404,11 @@ pub fn fresh() -> Self {
     (49, Virtual,            "virtual")
     (50, Yield,              "yield")
 
-    // Edition-specific keywords reserved for future use.
-    (51, Async,              "async") // >= 2018 Edition only
-    (52, Dyn,                "dyn") // >= 2018 Edition only
+    // Edition-specific keywords that are used in stable Rust.
+    (51, Dyn,                "dyn") // >= 2018 Edition only
+
+    // Edition-specific keywords that are used in unstable Rust or reserved for future use.
+    (52, Async,              "async") // >= 2018 Edition only
     (53, Try,                "try") // >= 2018 Edition only
 
     // Special lifetime names
@@ -417,11 +419,15 @@ pub fn fresh() -> Self {
     (56, Auto,               "auto")
     (57, Catch,              "catch")
     (58, Default,            "default")
-    (59, Union,              "union")
-    (60, Existential,        "existential")
+    (59, Existential,        "existential")
+    (60, Union,              "union")
 }
 
 impl Symbol {
+    fn is_used_keyword_2018(self) -> bool {
+        self == keywords::Dyn.name()
+    }
+
     fn is_unused_keyword_2018(self) -> bool {
         self >= keywords::Async.name() && self <= keywords::Try.name()
     }
@@ -436,7 +442,9 @@ pub fn is_special(self) -> bool {
 
     /// Returns `true` if the token is a keyword used in the language.
     pub fn is_used_keyword(self) -> bool {
-        self.name >= keywords::As.name() && self.name <= keywords::While.name()
+        // Note: `span.edition()` is relatively expensive, don't call it unless necessary.
+        self.name >= keywords::As.name() && self.name <= keywords::While.name() ||
+        self.name.is_used_keyword_2018() && self.span.rust_2018()
     }
 
     /// Returns `true` if the token is a keyword reserved for possible future use.
@@ -454,11 +462,11 @@ pub fn is_reserved(self) -> bool {
     /// A keyword or reserved identifier that can be used as a path segment.
     pub fn is_path_segment_keyword(self) -> bool {
         self.name == keywords::Super.name() ||
-        self.name == keywords::SelfValue.name() ||
-        self.name == keywords::SelfType.name() ||
+        self.name == keywords::SelfLower.name() ||
+        self.name == keywords::SelfUpper.name() ||
         self.name == keywords::Extern.name() ||
         self.name == keywords::Crate.name() ||
-        self.name == keywords::CrateRoot.name() ||
+        self.name == keywords::PathRoot.name() ||
         self.name == keywords::DollarCrate.name()
     }
 
diff --git a/src/test/run-pass/issue-55380.rs b/src/test/run-pass/issue-55380.rs
new file mode 100644 (file)
index 0000000..29392fb
--- /dev/null
@@ -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.
+
+// run-pass
+
+#![feature(specialization)]
+
+pub trait Foo {
+    fn abc() -> u32;
+    fn def() -> u32;
+}
+
+pub trait Marker {}
+
+impl Marker for () {}
+
+impl<T> Foo for T {
+    default fn abc() -> u32 { 16 }
+    default fn def() -> u32 { 42 }
+}
+
+impl<T: Marker> Foo for T {
+    fn def() -> u32 {
+        Self::abc()
+    }
+}
+
+fn main() {
+   assert_eq!(<()>::def(), 16);
+   assert_eq!(<i32>::def(), 42);
+}
diff --git a/src/test/rustdoc-js/filter-crate.js b/src/test/rustdoc-js/filter-crate.js
new file mode 100644 (file)
index 0000000..97ecc60
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+// exact-check
+
+const QUERY = 'hashmap';
+const FILTER_CRATE = 'core';
+
+const EXPECTED = {
+    'others': [
+    ],
+};
diff --git a/src/test/rustdoc/inline_local/macro_by_example.rs b/src/test/rustdoc/inline_local/macro_by_example.rs
new file mode 100644 (file)
index 0000000..93d55ec
--- /dev/null
@@ -0,0 +1,28 @@
+// 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.
+
+
+/// docs for foo
+#[deprecated(since = "1.2.3", note = "text")]
+#[macro_export]
+macro_rules! foo {
+    ($($tt:tt)*) => {}
+}
+
+// @has macro_by_example/macros/index.html
+pub mod macros {
+    // @!has - 'pub use foo as bar;'
+    // @has macro_by_example/macros/macro.bar.html
+    // @has - '//*[@class="docblock"]' 'docs for foo'
+    // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text'
+    // @has - '//a/@href' 'macro_by_example.rs.html#15-17'
+    #[doc(inline)]
+    pub use foo as bar;
+}
index 3caf1491aba687f874d086e8a63d073428a6e10c..703453e6bdd93a865b1494edcfa119749ff42a57 100644 (file)
@@ -1,8 +1,8 @@
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
   --> $DIR/const-match-check.rs:35:15
    |
 LL |     A = { let 0 = 0; 0 },
-   |               ^ pattern `_` not covered
+   |               ^ pattern `-2147483648i32..=-1i32` not covered
 
 error: aborting due to previous error
 
index de85d4d73db0c01168927e58dcf97c61512364c8..6caff93e642963aa160008aaf751c2b6cd710d0e 100644 (file)
@@ -1,8 +1,8 @@
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
   --> $DIR/const-match-check.rs:41:24
    |
 LL |     let x: [i32; { let 0 = 0; 0 }] = [];
-   |                        ^ pattern `_` not covered
+   |                        ^ pattern `-2147483648i32..=-1i32` not covered
 
 error: aborting due to previous error
 
index bbf1169c577cfed46b1060ec6eea2469fbb068ba..9e45045d27e8d6424646b8137bdbbd70be51f477 100644 (file)
@@ -1,26 +1,26 @@
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
   --> $DIR/const-match-check.rs:14:22
    |
 LL | const X: i32 = { let 0 = 0; 0 };
-   |                      ^ pattern `_` not covered
+   |                      ^ pattern `-2147483648i32..=-1i32` not covered
 
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
   --> $DIR/const-match-check.rs:18:23
    |
 LL | static Y: i32 = { let 0 = 0; 0 };
-   |                       ^ pattern `_` not covered
+   |                       ^ pattern `-2147483648i32..=-1i32` not covered
 
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
   --> $DIR/const-match-check.rs:23:26
    |
 LL |     const X: i32 = { let 0 = 0; 0 };
-   |                          ^ pattern `_` not covered
+   |                          ^ pattern `-2147483648i32..=-1i32` not covered
 
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
   --> $DIR/const-match-check.rs:29:26
    |
 LL |     const X: i32 = { let 0 = 0; 0 };
-   |                          ^ pattern `_` not covered
+   |                          ^ pattern `-2147483648i32..=-1i32` not covered
 
 error: aborting due to 4 previous errors
 
index af0b95e002d84cdb98a76102334ddb0d2aebf464..278864d6de9ec292fe336a7f5a1c619c70f91578 100644 (file)
@@ -19,8 +19,8 @@ mod foo {
 const a: u8 = 2;
 
 fn main() {
-    let a = 4; //~ ERROR refutable pattern in local binding: `_` not covered
-    let c = 4; //~ ERROR refutable pattern in local binding: `_` not covered
-    let d = 4; //~ ERROR refutable pattern in local binding: `_` not covered
+    let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
+    let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
+    let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
     fn f() {} // Check that the `NOTE`s still work with an item here (c.f. issue #35115).
 }
index 6d5738f332877fbefb983066883d78ad1be61ca1..d9ad16cd0e8da91d96f1afe0220bec7841f9cbf6 100644 (file)
@@ -1,19 +1,19 @@
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered
   --> $DIR/const-pattern-irrefutable.rs:22:9
    |
-LL |     let a = 4; //~ ERROR refutable pattern in local binding: `_` not covered
+LL |     let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
    |         ^ interpreted as a constant pattern, not new variable
 
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered
   --> $DIR/const-pattern-irrefutable.rs:23:9
    |
-LL |     let c = 4; //~ ERROR refutable pattern in local binding: `_` not covered
+LL |     let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
    |         ^ interpreted as a constant pattern, not new variable
 
-error[E0005]: refutable pattern in local binding: `_` not covered
+error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered
   --> $DIR/const-pattern-irrefutable.rs:24:9
    |
-LL |     let d = 4; //~ ERROR refutable pattern in local binding: `_` not covered
+LL |     let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
    |         ^ interpreted as a constant pattern, not new variable
 
 error: aborting due to 3 previous errors
index 7825aaa291286c08ea26b202ac43af8e83308a63..020382d9fe17deb6f18c679662be91e6877bfc2f 100644 (file)
@@ -8,11 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(exhaustive_integer_patterns)]
+#![feature(precise_pointer_size_matching)]
 #![feature(exclusive_range_pattern)]
+
 #![deny(unreachable_patterns)]
 
-use std::{char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128};
+use std::{char, u8, u16, u32, u64, u128, i8, i16, i32, i64, i128};
 
 fn main() {
     let x: u8 = 0;
@@ -68,10 +69,6 @@ fn main() {
         '\u{E000}' ..= '\u{10_FFFF}' => {}
     }
 
-    match 0usize {
-        0 ..= usize::MAX => {} // ok
-    }
-
     match 0u16 {
         0 ..= u16::MAX => {} // ok
     }
@@ -88,10 +85,6 @@ fn main() {
         0 ..= u128::MAX => {} // ok
     }
 
-    match 0isize {
-        isize::MIN ..= isize::MAX => {} // ok
-    }
-
     match 0i8 {
         -128 ..= 127 => {} // ok
     }
index 44b05a12aebd2d4b4f0aa66f3d90eb88dea51e52..011e93683fb6e4bb7ebf0f12920d86442b6c34f5 100644 (file)
@@ -1,83 +1,83 @@
 error: unreachable pattern
-  --> $DIR/exhaustive_integer_patterns.rs:32:9
+  --> $DIR/exhaustive_integer_patterns.rs:33:9
    |
 LL |         200 => {} //~ ERROR unreachable pattern
    |         ^^^
    |
 note: lint level defined here
-  --> $DIR/exhaustive_integer_patterns.rs:13:9
+  --> $DIR/exhaustive_integer_patterns.rs:14:9
    |
 LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
 error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:37:11
+  --> $DIR/exhaustive_integer_patterns.rs:38:11
    |
 LL |     match x { //~ ERROR non-exhaustive patterns
    |           ^ pattern `128u8..=255u8` not covered
 
 error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered
-  --> $DIR/exhaustive_integer_patterns.rs:42:11
+  --> $DIR/exhaustive_integer_patterns.rs:43:11
    |
 LL |     match x { //~ ERROR non-exhaustive patterns
    |           ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered
 
 error: unreachable pattern
-  --> $DIR/exhaustive_integer_patterns.rs:53:9
+  --> $DIR/exhaustive_integer_patterns.rs:54:9
    |
 LL |         -2..=20 => {} //~ ERROR unreachable pattern
    |         ^^^^^^^
 
 error[E0004]: non-exhaustive patterns: `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
-  --> $DIR/exhaustive_integer_patterns.rs:50:11
+  --> $DIR/exhaustive_integer_patterns.rs:51:11
    |
 LL |     match x { //~ ERROR non-exhaustive patterns
    |           ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
 
 error[E0004]: non-exhaustive patterns: `-128i8` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:99:11
+  --> $DIR/exhaustive_integer_patterns.rs:92:11
    |
 LL |     match 0i8 { //~ ERROR non-exhaustive patterns
    |           ^^^ pattern `-128i8` not covered
 
 error[E0004]: non-exhaustive patterns: `0i16` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:107:11
+  --> $DIR/exhaustive_integer_patterns.rs:100:11
    |
 LL |     match 0i16 { //~ ERROR non-exhaustive patterns
    |           ^^^^ pattern `0i16` not covered
 
 error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:125:11
+  --> $DIR/exhaustive_integer_patterns.rs:118:11
    |
 LL |     match 0u8 { //~ ERROR non-exhaustive patterns
    |           ^^^ pattern `128u8..=255u8` not covered
 
 error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:137:11
+  --> $DIR/exhaustive_integer_patterns.rs:130:11
    |
 LL |     match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
    |           ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
 
 error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:142:11
+  --> $DIR/exhaustive_integer_patterns.rs:135:11
    |
 LL |     match (0u8, true) { //~ ERROR non-exhaustive patterns
    |           ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered
 
 error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:162:11
+  --> $DIR/exhaustive_integer_patterns.rs:155:11
    |
 LL |     match 0u128 { //~ ERROR non-exhaustive patterns
    |           ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered
 
 error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:166:11
+  --> $DIR/exhaustive_integer_patterns.rs:159:11
    |
 LL |     match 0u128 { //~ ERROR non-exhaustive patterns
    |           ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered
 
 error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered
-  --> $DIR/exhaustive_integer_patterns.rs:170:11
+  --> $DIR/exhaustive_integer_patterns.rs:163:11
    |
 LL |     match 0u128 { //~ ERROR non-exhaustive patterns
    |           ^^^^^ pattern `0u128..=3u128` not covered
diff --git a/src/test/ui/feature-gate-exhaustive_integer_patterns.rs b/src/test/ui/feature-gate-exhaustive_integer_patterns.rs
deleted file mode 100644 (file)
index 3aa1522..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-fn main() {
-    let x: u8 = 0;
-    match x { //~ ERROR non-exhaustive patterns: `_` not covered
-        0 ..= 255 => {}
-    }
-}
diff --git a/src/test/ui/feature-gate-exhaustive_integer_patterns.stderr b/src/test/ui/feature-gate-exhaustive_integer_patterns.stderr
deleted file mode 100644 (file)
index 63d98f6..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
-  --> $DIR/feature-gate-exhaustive_integer_patterns.rs:13:11
-   |
-LL |     match x { //~ ERROR non-exhaustive patterns: `_` not covered
-   |           ^ pattern `_` not covered
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
new file mode 100644 (file)
index 0000000..1208552
--- /dev/null
@@ -0,0 +1,14 @@
+#![feature(exclusive_range_pattern)]
+
+use std::usize::MAX;
+
+fn main() {
+    match 0usize { //~ERROR non-exhaustive patterns: `_` not covered
+        0..=MAX => {}
+    }
+
+    match 0isize { //~ERROR non-exhaustive patterns: `_` not covered
+        1..=20 => {}
+        -5..3 => {}
+    }
+}
diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
new file mode 100644 (file)
index 0000000..5806f6f
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0004]: non-exhaustive patterns: `_` not covered
+  --> $DIR/feature-gate-precise_pointer_size_matching.rs:6:11
+   |
+LL |     match 0usize { //~ERROR non-exhaustive patterns: `_` not covered
+   |           ^^^^^^ pattern `_` not covered
+
+error[E0004]: non-exhaustive patterns: `_` not covered
+  --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
+   |
+LL |     match 0isize { //~ERROR non-exhaustive patterns: `_` not covered
+   |           ^^^^^^ pattern `_` not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
index b76c2ffc240e16fb5c53ebdfb9070674fba6949c..9b19fc80e2bd67ce7db2f633a9c5a9c0b1bcf805 100644 (file)
@@ -1,8 +1,8 @@
-error[E0005]: refutable pattern in `for` loop binding: `&_` not covered
+error[E0005]: refutable pattern in `for` loop binding: `&-2147483648i32..=0i32` not covered
   --> $DIR/for-loop-refutable-pattern-error-message.rs:12:9
    |
 LL |     for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding
-   |         ^^ pattern `&_` not covered
+   |         ^^ pattern `&-2147483648i32..=0i32` not covered
 
 error: aborting due to previous error
 
index 04f09caceed3d1c612c75ae23f98155b28c2a47f..ad895b448dd2015ff720aea2e1051cbc5813f79a 100644 (file)
@@ -1,8 +1,8 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered
   --> $DIR/match-non-exhaustive.rs:12:11
    |
 LL |     match 0 { 1 => () } //~ ERROR non-exhaustive patterns
-   |           ^ pattern `_` not covered
+   |           ^ patterns `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered
 
 error[E0004]: non-exhaustive patterns: `_` not covered
   --> $DIR/match-non-exhaustive.rs:13:11
diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs
new file mode 100644 (file)
index 0000000..588fecb
--- /dev/null
@@ -0,0 +1,13 @@
+#![allow(illegal_floating_point_literal_pattern)]
+#![deny(unreachable_patterns)]
+
+fn main() {
+    match 0.0 {
+      0.0..=1.0 => {}
+      _ => {} // ok
+    }
+
+    match 0.0 { //~ ERROR non-exhaustive patterns
+      0.0..=1.0 => {}
+    }
+}
diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr
new file mode 100644 (file)
index 0000000..2e285af
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `_` not covered
+  --> $DIR/non-exhaustive-float-range-match.rs:10:11
+   |
+LL |     match 0.0 { //~ ERROR non-exhaustive patterns
+   |           ^^^ pattern `_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
index 13b62429f46930d3c67a17cc9d1bf63022ee9dd0..99a0c5d66266030aa5189b859a6bbc545e4df5ed 100644 (file)
@@ -22,7 +22,8 @@ fn main() {
     match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
       None => {}
     }
-    match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
+    match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)`
+                      //  and `(_, _, 5i32..=2147483647i32)` not covered
       (_, _, 4) => {}
     }
     match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered
index f48a0bc15eb6f69815be9ffd33e1f6078461a0ed..d3703a4445499358bb566d55ade6adb38d6566ce 100644 (file)
@@ -16,32 +16,32 @@ error[E0004]: non-exhaustive patterns: `Some(_)` not covered
 LL |     match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
    |           ^^^^^^^^ pattern `Some(_)` not covered
 
-error[E0004]: non-exhaustive patterns: `(_, _, _)` not covered
+error[E0004]: non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered
   --> $DIR/non-exhaustive-match.rs:25:11
    |
-LL |     match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
-   |           ^^^^^^^^^ pattern `(_, _, _)` not covered
+LL |     match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)`
+   |           ^^^^^^^^^ patterns `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered
 
 error[E0004]: non-exhaustive patterns: `(a, a)` not covered
-  --> $DIR/non-exhaustive-match.rs:28:11
+  --> $DIR/non-exhaustive-match.rs:29:11
    |
 LL |     match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered
    |           ^^^^^^^^^^^^ pattern `(a, a)` not covered
 
 error[E0004]: non-exhaustive patterns: `b` not covered
-  --> $DIR/non-exhaustive-match.rs:32:11
+  --> $DIR/non-exhaustive-match.rs:33:11
    |
 LL |     match t::a { //~ ERROR non-exhaustive patterns: `b` not covered
    |           ^^^^ pattern `b` not covered
 
 error[E0004]: non-exhaustive patterns: `[]` not covered
-  --> $DIR/non-exhaustive-match.rs:43:11
+  --> $DIR/non-exhaustive-match.rs:44:11
    |
 LL |     match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered
    |           ^^^^ pattern `[]` not covered
 
 error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered
-  --> $DIR/non-exhaustive-match.rs:56:11
+  --> $DIR/non-exhaustive-match.rs:57:11
    |
 LL |     match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
    |           ^^^^ pattern `[_, _, _, _]` not covered
diff --git a/src/test/ui/precise_pointer_size_matching.rs b/src/test/ui/precise_pointer_size_matching.rs
new file mode 100644 (file)
index 0000000..759b63b
--- /dev/null
@@ -0,0 +1,33 @@
+// normalize-stderr-32bit: "-2147483648isize" -> "$$ISIZE_MIN"
+// normalize-stderr-64bit: "-9223372036854775808isize" -> "$$ISIZE_MIN"
+// normalize-stderr-32bit: "2147483647isize" -> "$$ISIZE_MAX"
+// normalize-stderr-64bit: "9223372036854775807isize" -> "$$ISIZE_MAX"
+// normalize-stderr-32bit: "4294967295usize" -> "$$USIZE_MAX"
+// normalize-stderr-64bit: "18446744073709551615usize" -> "$$USIZE_MAX"
+
+#![feature(precise_pointer_size_matching)]
+#![feature(exclusive_range_pattern)]
+
+#![deny(unreachable_patterns)]
+
+use std::{usize, isize};
+
+fn main() {
+    match 0isize {
+        isize::MIN ..= isize::MAX => {} // ok
+    }
+
+    match 0usize {
+        0 ..= usize::MAX => {} // ok
+    }
+
+    match 0isize { //~ ERROR non-exhaustive patterns
+        1 ..= 8 => {}
+        -5 ..= 20 => {}
+    }
+
+    match 0usize { //~ ERROR non-exhaustive patterns
+        1 ..= 8 => {}
+        5 ..= 20 => {}
+    }
+}
diff --git a/src/test/ui/precise_pointer_size_matching.stderr b/src/test/ui/precise_pointer_size_matching.stderr
new file mode 100644 (file)
index 0000000..4acbec6
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0004]: non-exhaustive patterns: `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered
+  --> $DIR/precise_pointer_size_matching.rs:24:11
+   |
+LL |     match 0isize { //~ ERROR non-exhaustive patterns
+   |           ^^^^^^ patterns `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered
+
+error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=$USIZE_MAX` not covered
+  --> $DIR/precise_pointer_size_matching.rs:29:11
+   |
+LL |     match 0usize { //~ ERROR non-exhaustive patterns
+   |           ^^^^^^ patterns `0usize` and `21usize..=$USIZE_MAX` not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
index 7b4009481abd473eb44847f7db62f7a2ccd2df48..a140e421a5706e811d8760724db4afae47bef5dd 100644 (file)
@@ -14,5 +14,5 @@ fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
 
 fn main() {
     let (1, (Some(1), 2..=3)) = (1, (None, 2));
-    //~^ ERROR refutable pattern in local binding: `(_, _)` not covered
+    //~^ ERROR refutable pattern in local binding: `(-2147483648i32..=0i32, _)` not covered
 }
index c2d5fe001fc102f59d48568cebb6ec0ad9e79a9d..42aa572789522c86b631f6556c620684e7b331de 100644 (file)
@@ -4,11 +4,11 @@ error[E0005]: refutable pattern in function argument: `(_, _)` not covered
 LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
    |         ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
 
-error[E0005]: refutable pattern in local binding: `(_, _)` not covered
+error[E0005]: refutable pattern in local binding: `(-2147483648i32..=0i32, _)` not covered
   --> $DIR/refutable-pattern-errors.rs:16:9
    |
 LL |     let (1, (Some(1), 2..=3)) = (1, (None, 2));
-   |         ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+   |         ^^^^^^^^^^^^^^^^^^^^^ pattern `(-2147483648i32..=0i32, _)` not covered
 
 error: aborting due to 2 previous errors
 
index 9548df5959bd4d23b8c430fde12b58bc2de0cf9f..377c85fef490a7d34a8b0077e87dee85d54208c8 100644 (file)
@@ -1,7 +1,7 @@
 // edition:2018
 
 type A0 = dyn;
-type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword
+type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn`
 type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<`
 type A3 = dyn<<dyn as dyn>::dyn>;
 
index ea0483394b5ea1e76589e3c69a32df7367659db2..bd72f9c6786b2a8ca2d80dc1e7f94360a8bc825b 100644 (file)
@@ -1,8 +1,8 @@
-error: expected identifier, found reserved keyword `dyn`
+error: expected identifier, found keyword `dyn`
   --> $DIR/dyn-trait-compatibility.rs:4:16
    |
-LL | type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword
-   |                ^^^ expected identifier, found reserved keyword
+LL | type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn`
+   |                ^^^ expected identifier, found keyword
 
 error: expected identifier, found `<`
   --> $DIR/dyn-trait-compatibility.rs:5:14
index c8ce4cf8bb5be935c999bab25991951f0caaaee9..f7c30df9f3ebb86d85c329188421abaed6422b5d 100644 (file)
@@ -259,6 +259,7 @@ function main(argv) {
                                'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;');
         const expected = loadedFile.EXPECTED;
         const query = loadedFile.QUERY;
+        const filter_crate = loadedFile.FILTER_CRATE;
         const ignore_order = loadedFile.ignore_order;
         const exact_check = loadedFile.exact_check;
         const should_fail = loadedFile.should_fail;