]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #57177 - varkor:fix-duration_as_u128-warning, r=estebank
authorkennytm <kennytm@gmail.com>
Sat, 29 Dec 2018 10:50:32 +0000 (18:50 +0800)
committerGitHub <noreply@github.com>
Sat, 29 Dec 2018 10:50:32 +0000 (18:50 +0800)
Fix warning when compiling rustc

32 files changed:
src/doc/unstable-book/src/language-features/non-ascii-idents.md
src/libcore/pin.rs
src/libcore/ptr.rs
src/libfmt_macros/lib.rs
src/librustc/session/config.rs
src/librustc/ty/context.rs
src/librustc/ty/query/mod.rs
src/librustc/ty/query/plumbing.rs
src/librustc_borrowck/borrowck/README.md
src/librustc_driver/driver.rs
src/librustdoc/config.rs
src/librustdoc/html/layout.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/down-arrow.svg
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/lib.rs
src/libstd/primitive_docs.rs
src/libsyntax/feature_gate.rs
src/libsyntax_ext/format.rs
src/test/rustdoc/no-crate-filter.rs [new file with mode: 0644]
src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr
src/test/ui/fmt/format-string-error-2.rs
src/test/ui/fmt/format-string-error-2.stderr
src/test/ui/if/ifmt-bad-arg.stderr
src/test/ui/imports/local-modularized-tricky-fail-2.stderr
src/test/ui/macros/format-foreign.stderr
src/test/ui/macros/format-unused-lables.stderr
src/test/ui/utf8_idents.stderr
src/tools/clippy

index efb5495fe26acf32334ddd188aaa9db53c644a0b..46957c00bf95c749961c44af34d0e455871c5967 100644 (file)
@@ -1,8 +1,8 @@
 # `non_ascii_idents`
 
-The tracking issue for this feature is: [#28979]
+The tracking issue for this feature is: [#55467]
 
-[#28979]: https://github.com/rust-lang/rust/issues/28979
+[#55467]: https://github.com/rust-lang/rust/issues/55467
 
 ------------------------
 
index d8508631bf9c36a487f004014f4387aa033e138b..e31ac691e3a3c0ba8c91e5d6bd9f8067a3c2c36a 100644 (file)
@@ -25,7 +25,7 @@
 //! values.
 //!
 //! However, these restrictions are usually not necessary. Many types are always freely
-//! movable. These types implement the [`Unpin`] auto-trait, which nullifies the affect
+//! movable. These types implement the [`Unpin`] auto-trait, which nullifies the effect
 //! of [`Pin`]. For `T: Unpin`, `Pin<Box<T>>` and `Box<T>` function identically, as do
 //! `Pin<&mut T>` and `&mut T`.
 //!
index b9420f32a949270783a3ef028880d22dc2287204..55a72d7a9a94daffebd36f40971ec297f210ec12 100644 (file)
@@ -591,7 +591,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
 /// whether `T` is [`Copy`].  If `T` is not [`Copy`], using both the returned
 /// value and the value at `*src` can [violate memory safety][read-ownership].
 ///
-/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned.
+/// Note that even if `T` has size `0`, the pointer must be non-NULL.
 ///
 /// [`Copy`]: ../marker/trait.Copy.html
 /// [`read`]: ./fn.read.html
@@ -759,7 +759,7 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
 ///
 /// * `dst` must be [valid] for writes.
 ///
-/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned.
+/// Note that even if `T` has size `0`, the pointer must be non-NULL.
 ///
 /// [valid]: ../ptr/index.html#safety
 ///
index fc8325e5915c4a8275719da50e7e7da82c7401fc..32ae878909f30676a76a4738b20400611f19148d 100644 (file)
@@ -144,7 +144,7 @@ pub struct Parser<'a> {
     /// `Some(raw count)` when the string is "raw", used to position spans correctly
     style: Option<usize>,
     /// Start and end byte offset of every successfully parsed argument
-    pub arg_places: Vec<(usize, usize)>,
+    pub arg_places: Vec<(SpanIndex, SpanIndex)>,
     /// Characters that need to be shifted
     skips: Vec<usize>,
     /// Span offset of the last opening brace seen, used for error reporting
@@ -154,7 +154,7 @@ pub struct Parser<'a> {
 }
 
 #[derive(Clone, Copy, Debug)]
-pub struct SpanIndex(usize);
+pub struct SpanIndex(pub usize);
 
 impl SpanIndex {
     pub fn unwrap(self) -> usize {
@@ -166,7 +166,6 @@ impl<'a> Iterator for Parser<'a> {
     type Item = Piece<'a>;
 
     fn next(&mut self) -> Option<Piece<'a>> {
-        let raw = self.raw();
         if let Some(&(pos, c)) = self.cur.peek() {
             match c {
                 '{' => {
@@ -180,7 +179,7 @@ fn next(&mut self) -> Option<Piece<'a>> {
                     } else {
                         let arg = self.argument();
                         if let Some(arg_pos) = self.must_consume('}').map(|end| {
-                            (pos + raw + 1, end + raw + 2)
+                            (self.to_span_index(pos), self.to_span_index(end + 1))
                         }) {
                             self.arg_places.push(arg_pos);
                         }
index 8dcf140cd2ad674d628b1436e6a772734fff4c62..e58c9d75a9db2d79c5726dac9ac4242794c03b15 100644 (file)
@@ -1279,6 +1279,8 @@ fn parse_cross_lang_lto(slot: &mut CrossLangLto, v: Option<&str>) -> bool {
         "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0"),
     perf_stats: bool = (false, parse_bool, [UNTRACKED],
         "print some performance-related statistics"),
+    query_stats: bool = (false, parse_bool, [UNTRACKED],
+        "print some statistics about the query system"),
     hir_stats: bool = (false, parse_bool, [UNTRACKED],
         "print some statistics about AST and HIR"),
     always_encode_mir: bool = (false, parse_bool, [TRACKED],
index 289ef4da9922766cceeb3e92bd3ec7b392ea0468..ea69d466ba6c5dbf9720b244d40feb4fa261c858 100644 (file)
@@ -903,7 +903,7 @@ pub struct GlobalCtxt<'tcx> {
     /// as well as all upstream crates. Only populated in incremental mode.
     pub def_path_hash_to_def_id: Option<FxHashMap<DefPathHash, DefId>>,
 
-    pub(crate) queries: query::Queries<'tcx>,
+    pub queries: query::Queries<'tcx>,
 
     // Records the free variables referenced by every closure
     // expression. Do not track deps for this, just recompute it from
index cbdec2ef2ba81cf8e0be9cacc0ab3e24b331e4a3..22bd1cd90a754de1844fa041b7f253c6536bfec9 100644 (file)
@@ -53,6 +53,7 @@
 use std::borrow::Cow;
 use std::ops::Deref;
 use std::sync::Arc;
+use std::intrinsics::type_name;
 use syntax_pos::{Span, DUMMY_SP};
 use syntax_pos::symbol::InternedString;
 use syntax::attr;
index 99da77491ca54866aa8c4f8875beb81fd72e5224..5d23ee0994a06ac8c1430c883c71c975dad68ad6 100644 (file)
@@ -27,6 +27,8 @@
 pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> {
     pub(super) results: FxHashMap<D::Key, QueryValue<D::Value>>,
     pub(super) active: FxHashMap<D::Key, QueryResult<'tcx>>,
+    #[cfg(debug_assertions)]
+    pub(super) cache_hits: usize,
 }
 
 pub(super) struct QueryValue<T> {
@@ -50,6 +52,8 @@ fn default() -> QueryCache<'tcx, M> {
         QueryCache {
             results: FxHashMap::default(),
             active: FxHashMap::default(),
+            #[cfg(debug_assertions)]
+            cache_hits: 0,
         }
     }
 }
@@ -114,6 +118,10 @@ pub(super) fn try_get(
                 });
 
                 let result = Ok((value.value.clone(), value.index));
+                #[cfg(debug_assertions)]
+                {
+                    lock.cache_hits += 1;
+                }
                 return TryGetJob::JobCompleted(result);
             }
             let job = match lock.active.entry((*key).clone()) {
@@ -752,6 +760,101 @@ pub fn collect_active_jobs(&self) -> Vec<Lrc<QueryJob<$tcx>>> {
 
                 jobs
             }
+
+            pub fn print_stats(&self) {
+                let mut queries = Vec::new();
+
+                #[derive(Clone)]
+                struct QueryStats {
+                    name: &'static str,
+                    cache_hits: usize,
+                    key_size: usize,
+                    key_type: &'static str,
+                    value_size: usize,
+                    value_type: &'static str,
+                    entry_count: usize,
+                }
+
+                fn stats<'tcx, Q: QueryConfig<'tcx>>(
+                    name: &'static str,
+                    map: &QueryCache<'tcx, Q>
+                ) -> QueryStats {
+                    QueryStats {
+                        name,
+                        #[cfg(debug_assertions)]
+                        cache_hits: map.cache_hits,
+                        #[cfg(not(debug_assertions))]
+                        cache_hits: 0,
+                        key_size: mem::size_of::<Q::Key>(),
+                        key_type: unsafe { type_name::<Q::Key>() },
+                        value_size: mem::size_of::<Q::Value>(),
+                        value_type: unsafe { type_name::<Q::Value>() },
+                        entry_count: map.results.len(),
+                    }
+                }
+
+                $(
+                    queries.push(stats::<queries::$name<'_>>(
+                        stringify!($name),
+                        &*self.$name.lock()
+                    ));
+                )*
+
+                if cfg!(debug_assertions) {
+                    let hits: usize = queries.iter().map(|s| s.cache_hits).sum();
+                    let results: usize = queries.iter().map(|s| s.entry_count).sum();
+                    println!("\nQuery cache hit rate: {}", hits as f64 / (hits + results) as f64);
+                }
+
+                let mut query_key_sizes = queries.clone();
+                query_key_sizes.sort_by_key(|q| q.key_size);
+                println!("\nLarge query keys:");
+                for q in query_key_sizes.iter().rev()
+                                        .filter(|q| q.key_size > 8) {
+                    println!(
+                        "   {} - {} x {} - {}",
+                        q.name,
+                        q.key_size,
+                        q.entry_count,
+                        q.key_type
+                    );
+                }
+
+                let mut query_value_sizes = queries.clone();
+                query_value_sizes.sort_by_key(|q| q.value_size);
+                println!("\nLarge query values:");
+                for q in query_value_sizes.iter().rev()
+                                          .filter(|q| q.value_size > 8) {
+                    println!(
+                        "   {} - {} x {} - {}",
+                        q.name,
+                        q.value_size,
+                        q.entry_count,
+                        q.value_type
+                    );
+                }
+
+                if cfg!(debug_assertions) {
+                    let mut query_cache_hits = queries.clone();
+                    query_cache_hits.sort_by_key(|q| q.cache_hits);
+                    println!("\nQuery cache hits:");
+                    for q in query_cache_hits.iter().rev() {
+                        println!(
+                            "   {} - {} ({}%)",
+                            q.name,
+                            q.cache_hits,
+                            q.cache_hits as f64 / (q.cache_hits + q.entry_count) as f64
+                        );
+                    }
+                }
+
+                let mut query_value_count = queries.clone();
+                query_value_count.sort_by_key(|q| q.entry_count);
+                println!("\nQuery value count:");
+                for q in query_value_count.iter().rev() {
+                    println!("   {} - {}", q.name, q.entry_count);
+                }
+            }
         }
 
         #[allow(nonstandard_style)]
@@ -940,7 +1043,7 @@ fn clone(&self) -> Self { *self }
 macro_rules! define_queries_struct {
     (tcx: $tcx:tt,
      input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
-        pub(crate) struct Queries<$tcx> {
+        pub struct Queries<$tcx> {
             /// This provides access to the incr. comp. on-disk cache for query results.
             /// Do not access this directly. It is only meant to be used by
             /// `DepGraph::try_mark_green()` and the query infrastructure.
index a05c56e3629a3a3ed7746268532de8bd32ab3301..6c47e8784e025c755adef37cce0c6d3ce25b1911 100644 (file)
@@ -3,7 +3,7 @@
 > WARNING: This README is more or less obsolete, and will be removed
 > soon! The new system is described in the [rustc guide].
 
-[rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html
+[rustc guide]: https://rust-lang.github.io/rustc-guide/borrow_check.html
 
 This pass has the job of enforcing memory safety. This is a subtle
 topic. This docs aim to explain both the practice and the theory
index 62dc8691e65df8ef8112e5e02383ab29c28314b6..9b232edc11d4ab5b2967bd40387fe28d2c33b548 100644 (file)
@@ -328,6 +328,10 @@ macro_rules! controller_entry_point {
                     }
                 }
 
+                if tcx.sess.opts.debugging_opts.query_stats {
+                    tcx.queries.print_stats();
+                }
+
                 Ok((outputs.clone(), ongoing_codegen, tcx.dep_graph.clone()))
             },
         )??
index cdca00c18b885d0c20b36d55d03f4458dbd105cc..d99136802514d5c7f6cd56c4cc7d5e32bcdaef34 100644 (file)
@@ -185,6 +185,9 @@ pub struct RenderOptions {
     /// If present, playground URL to use in the "Run" button added to code samples generated from
     /// standalone Markdown files. If not present, `playground_url` is used.
     pub markdown_playground_url: Option<String>,
+    /// If false, the `select` element to have search filtering by crates on rendered docs
+    /// won't be generated.
+    pub generate_search_filter: bool,
 }
 
 impl Options {
@@ -427,6 +430,7 @@ pub fn from_matches(matches: &getopts::Matches) -> Result<Options, isize> {
         let crate_version = matches.opt_str("crate-version");
         let enable_index_page = matches.opt_present("enable-index-page") || index_page.is_some();
         let static_root_path = matches.opt_str("static-root-path");
+        let generate_search_filter = !matches.opt_present("disable-per-crate-search");
 
         let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
 
@@ -469,6 +473,7 @@ pub fn from_matches(matches: &getopts::Matches) -> Result<Options, isize> {
                 markdown_no_toc,
                 markdown_css,
                 markdown_playground_url,
+                generate_search_filter,
             }
         })
     }
index cf0267c1a8ea95b73ce93e07b0ddd1e81cae344b..987cec6fbfa962f9a106e543941154a8cd49b20e 100644 (file)
@@ -25,10 +25,15 @@ pub struct Page<'a> {
 }
 
 pub fn render<T: fmt::Display, S: fmt::Display>(
-    dst: &mut dyn io::Write, layout: &Layout, page: &Page, sidebar: &S, t: &T,
-    css_file_extension: bool, themes: &[PathBuf])
-    -> io::Result<()>
-{
+    dst: &mut dyn io::Write,
+    layout: &Layout,
+    page: &Page,
+    sidebar: &S,
+    t: &T,
+    css_file_extension: bool,
+    themes: &[PathBuf],
+    generate_search_filter: bool,
+) -> io::Result<()> {
     let static_root_path = page.static_root_path.unwrap_or(page.root_path);
     write!(dst,
 "<!DOCTYPE html>\
@@ -81,10 +86,7 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
     <nav class=\"sub\">\
         <form class=\"search-form js-only\">\
             <div class=\"search-container\">\
-                <div>\
-                    <select id=\"crate-search\">\
-                        <option value=\"All crates\">All crates</option>\
-                    </select>\
+                <div>{filter_crates}\
                     <input class=\"search-input\" name=\"search\" \
                            autocomplete=\"off\" \
                            spellcheck=\"false\" \
@@ -214,6 +216,13 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
                 root_path=page.root_path,
                 extra_script=e)
     }).collect::<String>(),
+    filter_crates=if generate_search_filter {
+        "<select id=\"crate-search\">\
+            <option value=\"All crates\">All crates</option>\
+        </select>"
+    } else {
+        ""
+    },
     )
 }
 
index c5847d361460225557841810954a4a34c6dc2f71..184d5b24d6e12cadd2c933d342cf0a33cf5b9957 100644 (file)
@@ -133,6 +133,9 @@ struct SharedContext {
     /// Optional path string to be used to load static files on output pages. If not set, uses
     /// combinations of `../` to reach the documentation root.
     pub static_root_path: Option<String>,
+    /// If false, the `select` element to have search filtering by crates on rendered docs
+    /// won't be generated.
+    pub generate_search_filter: bool,
 }
 
 impl SharedContext {
@@ -500,6 +503,7 @@ pub fn run(mut krate: clean::Crate,
         extern_html_root_urls,
         resource_suffix,
         static_root_path,
+        generate_search_filter,
         ..
     } = options;
 
@@ -528,6 +532,7 @@ pub fn run(mut krate: clean::Crate,
         themes,
         resource_suffix,
         static_root_path,
+        generate_search_filter,
     };
 
     // If user passed in `--playground-url` arg, we fill in crate name here
@@ -1099,7 +1104,8 @@ fn to_json_string(&self) -> String {
             try_err!(layout::render(&mut w, &cx.shared.layout,
                                     &page, &(""), &content,
                                     cx.shared.css_file_extension.is_some(),
-                                    &cx.shared.themes), &dst);
+                                    &cx.shared.themes,
+                                    cx.shared.generate_search_filter), &dst);
             try_err!(w.flush(), &dst);
         }
     }
@@ -1372,7 +1378,8 @@ fn emit_source(&mut self, filename: &FileName) -> io::Result<()> {
         layout::render(&mut w, &self.scx.layout,
                        &page, &(""), &Source(contents),
                        self.scx.css_file_extension.is_some(),
-                       &self.scx.themes)?;
+                       &self.scx.themes,
+                       self.scx.generate_search_filter)?;
         w.flush()?;
         self.scx.local_sources.insert(p.clone(), href);
         Ok(())
@@ -1974,7 +1981,8 @@ fn krate(self, mut krate: clean::Crate) -> Result<(), Error> {
         try_err!(layout::render(&mut w, &self.shared.layout,
                                 &page, &sidebar, &all,
                                 self.shared.css_file_extension.is_some(),
-                                &self.shared.themes),
+                                &self.shared.themes,
+                                self.shared.generate_search_filter),
                  &final_file);
 
         // Generating settings page.
@@ -1994,7 +2002,8 @@ fn krate(self, mut krate: clean::Crate) -> Result<(), Error> {
         try_err!(layout::render(&mut w, &layout,
                                 &page, &sidebar, &settings,
                                 self.shared.css_file_extension.is_some(),
-                                &themes),
+                                &themes,
+                                self.shared.generate_search_filter),
                  &settings_file);
 
         Ok(())
@@ -2055,7 +2064,8 @@ fn render_item(&self,
                            &Sidebar{ cx: self, item: it },
                            &Item{ cx: self, item: it },
                            self.shared.css_file_extension.is_some(),
-                           &self.shared.themes)?;
+                           &self.shared.themes,
+                           self.shared.generate_search_filter)?;
         } else {
             let mut url = self.root_path();
             if let Some(&(ref names, ty)) = cache().paths.get(&it.def_id) {
index a2d9a37dde09129757b25280f9ca887ecfbe47cb..c0f59f0c36fce587574861b4dc50657155db5220 100644 (file)
@@ -1 +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
+<?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="-30 -20 176 176" 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 02ffcf478f9ad14092c9efafead146c07858c970..75b0f5df0d8b3667b04791dd0791afc5a2f8f70f 100644 (file)
@@ -2422,9 +2422,11 @@ if (!DOMTokenList.prototype.remove) {
             return;
         }
         var crates_text = [];
-        for (var crate in crates) {
-            if (crates.hasOwnProperty(crate)) {
-                crates_text.push(crate);
+        if (crates.length > 1) {
+            for (var crate in crates) {
+                if (crates.hasOwnProperty(crate)) {
+                    crates_text.push(crate);
+                }
             }
         }
         crates_text.sort(function(a, b) {
index 0b0acafb755c93054016f347eba14922b8463054..2cc0b5e30b89321b14868df96891a61ef73daf10 100644 (file)
@@ -649,7 +649,7 @@ a {
        box-sizing: border-box !important;
        outline: none;
        border: none;
-       border-radius: 0 1px 1px 0;
+       border-radius: 1px;
        margin-top: 5px;
        padding: 10px 16px;
        font-size: 17px;
@@ -659,6 +659,10 @@ a {
        width: 100%;
 }
 
+#crate-search + .search-input {
+       border-radius: 0 1px 1px 0;
+}
+
 .search-input:focus {
        border-radius: 2px;
        border: 0;
index 215c833ee0d256f2e77b03f920572fc36988a4ed..1390be700634dc322a08d717c52ca360d5993703 100644 (file)
@@ -182,7 +182,7 @@ a.test-arrow {
 
 .search-input {
        color: #111;
-       box-shadow: 1px 0 0 1px #000, 0 0 0 2px transparent;
+       box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
        background-color: #f0f0f0;
 }
 
@@ -190,6 +190,10 @@ a.test-arrow {
        border-color: #008dfd;
 }
 
+#crate-search + .search-input {
+       box-shadow: 1px 0 0 1px #000, 0 0 0 2px transparent;
+}
+
 .stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #404040; }
 .stab.internal { background: #FFB9B3; border-color: #B71C1C; color: #404040; }
 .stab.deprecated { background: #F3DFFF; border-color: #7F0087;  color: #404040; }
index d955cd162b031c80bb089640bb062caac8bb5810..2b04dd2388d456ff07e5a4691ea294bd013f9c35 100644 (file)
@@ -183,7 +183,7 @@ a.test-arrow {
 
 .search-input {
        color: #555;
-       box-shadow: 1px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
+       box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
        background-color: white;
 }
 
@@ -191,6 +191,10 @@ a.test-arrow {
        border-color: #66afe9;
 }
 
+#crate-search + .search-input {
+       box-shadow: 1px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
+}
+
 .stab.unstable { background: #FFF5D6; border-color: #FFC600; }
 .stab.internal { background: #FFB9B3; border-color: #B71C1C; }
 .stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
index 0064100c16406d28b03d06523ebb7c50b5218665..67d512ed71d3711f890f9f1f01d53dc59c8e6129 100644 (file)
@@ -336,6 +336,11 @@ fn opts() -> Vec<RustcOptGroup> {
                       If not set, uses combinations of '../' to reach the documentation root.",
                      "PATH")
         }),
+        unstable("disable-per-crate-search", |o| {
+            o.optflag("",
+                      "disable-per-crate-search",
+                      "disables generating the crate selector on the search box")
+        }),
     ]
 }
 
index 27e720533b2c91d0ceab88e4849a359b8ae66eec..7755d9339e6f5c18904158a005c8c75927d7c773 100644 (file)
@@ -302,7 +302,7 @@ mod prim_never { }
 /// ```text
 /// error: character literal may only contain one codepoint: 'é'
 /// let c = 'é';
-///         ^^^^
+///         ^^^
 /// ```
 ///
 /// Another implication of the 4-byte fixed size of a `char` is that
index 70df403d0c2ea8e019c4682b4998c70f87668bfe..be49c55a54c420aa22fd7f49ff340c7b11e009a0 100644 (file)
@@ -111,7 +111,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, concat_idents, "1.0.0", Some(29599), None),
     (active, link_args, "1.0.0", Some(29596), None),
     (active, log_syntax, "1.0.0", Some(29598), None),
-    (active, non_ascii_idents, "1.0.0", Some(28979), None),
+    (active, non_ascii_idents, "1.0.0", Some(55467), None),
     (active, plugin_registrar, "1.0.0", Some(29597), None),
     (active, thread_local, "1.0.0", Some(29594), None),
     (active, trace_macros, "1.0.0", Some(29598), None),
index 9d29e2b0fb69ac559762cba877944e15d4dc0652..95bb8c886abf2c7f912eba76e195988c2ad24187 100644 (file)
@@ -860,7 +860,9 @@ fn find_skips(snippet: &str, is_raw: bool) -> Vec<usize> {
     }
 
     let arg_spans = parser.arg_places.iter()
-        .map(|&(start, end)| fmt.span.from_inner_byte_pos(start, end))
+        .map(|&(parse::SpanIndex(start), parse::SpanIndex(end))| {
+            fmt.span.from_inner_byte_pos(start, end)
+        })
         .collect();
 
     let mut cx = Context {
@@ -954,13 +956,18 @@ fn find_skips(snippet: &str, is_raw: bool) -> Vec<usize> {
         let mut diag = {
             if errs_len == 1 {
                 let (sp, msg) = errs.into_iter().next().unwrap();
-                cx.ecx.struct_span_err(sp, msg)
+                let mut diag = cx.ecx.struct_span_err(sp, msg);
+                diag.span_label(sp, msg);
+                diag
             } else {
                 let mut diag = cx.ecx.struct_span_err(
                     errs.iter().map(|&(sp, _)| sp).collect::<Vec<Span>>(),
                     "multiple unused formatting arguments",
                 );
                 diag.span_label(cx.fmtsp, "multiple missing formatting specifiers");
+                for (sp, msg) in errs {
+                    diag.span_label(sp, msg);
+                }
                 diag
             }
         };
diff --git a/src/test/rustdoc/no-crate-filter.rs b/src/test/rustdoc/no-crate-filter.rs
new file mode 100644 (file)
index 0000000..e49ce9e
--- /dev/null
@@ -0,0 +1,16 @@
+// 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.
+
+#![crate_name = "foo"]
+
+// compile-flags: -Z unstable-options --disable-per-crate-search
+
+// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]'
+pub struct Foo;
index 452a3ecfacd845dd5d58d0ea533c2e358b9d555c..5c441189ea7cbbd16ab212e6102e5c2ce7999bc3 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:1:22
    |
 LL | extern crate core as bäz; //~ ERROR non-ascii idents
@@ -6,7 +6,7 @@ LL | extern crate core as bäz; //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:3:5
    |
 LL | use föö::bar; //~ ERROR non-ascii idents
@@ -14,7 +14,7 @@ LL | use föö::bar; //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:5:5
    |
 LL | mod föö { //~ ERROR non-ascii idents
@@ -22,7 +22,7 @@ LL | mod föö { //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:9:4
    |
 LL | fn bär( //~ ERROR non-ascii idents
@@ -30,7 +30,7 @@ LL | fn bär( //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:10:5
    |
 LL |     bäz: isize //~ ERROR non-ascii idents
@@ -38,7 +38,7 @@ LL |     bäz: isize //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:12:9
    |
 LL |     let _ö: isize; //~ ERROR non-ascii idents
@@ -46,7 +46,7 @@ LL |     let _ö: isize; //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:15:10
    |
 LL |         (_ä, _) => {} //~ ERROR non-ascii idents
@@ -54,7 +54,7 @@ LL |         (_ä, _) => {} //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:19:8
    |
 LL | struct Föö { //~ ERROR non-ascii idents
@@ -62,7 +62,7 @@ LL | struct Föö { //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:20:5
    |
 LL |     föö: isize //~ ERROR non-ascii idents
@@ -70,7 +70,7 @@ LL |     föö: isize //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:23:6
    |
 LL | enum Bär { //~ ERROR non-ascii idents
@@ -78,7 +78,7 @@ LL | enum Bär { //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:24:5
    |
 LL |     Bäz { //~ ERROR non-ascii idents
@@ -86,7 +86,7 @@ LL |     Bäz { //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:25:9
    |
 LL |         qüx: isize //~ ERROR non-ascii idents
@@ -94,7 +94,7 @@ LL |         qüx: isize //~ ERROR non-ascii idents
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/feature-gate-non_ascii_idents.rs:30:8
    |
 LL |     fn qüx();  //~ ERROR non-ascii idents
index fd6e41ec6fca7fadc6f857e78d4f3f60e9a2f097..3c6c15c06bb2ae3bc77f82f19c1596291a489819 100644 (file)
@@ -67,4 +67,6 @@ fn main() {
     asdf}
     ", asdf=1);
     //~^^ ERROR invalid format string
+    println!("\t{}");
+    //~^ ERROR 1 positional argument in format string
 }
index 0b3f08c1fbe8d45128803b4def396768bb804b1f..face0bc0f5f68efd3d3c4ec3df46f74788314770 100644 (file)
@@ -133,5 +133,11 @@ LL |     asdf}
    |
    = note: if you intended to print `{`, you can escape it using `{{`
 
-error: aborting due to 13 previous errors
+error: 1 positional argument in format string, but no arguments were given
+  --> $DIR/format-string-error-2.rs:70:17
+   |
+LL |     println!("/t{}");
+   |                 ^^
+
+error: aborting due to 14 previous errors
 
index 3ae8669a7f244b4ecc6e52f976ed7937c275791c..d4153ac94acd1e6bcb9a4e0ba2a58196993bebb6 100644 (file)
@@ -16,7 +16,7 @@ error: argument never used
   --> $DIR/ifmt-bad-arg.rs:9:20
    |
 LL |     format!("{1}", 1);
-   |             -----  ^
+   |             -----  ^ argument never used
    |             |
    |             formatting specifier missing
 
@@ -80,15 +80,16 @@ error: multiple unused formatting arguments
   --> $DIR/ifmt-bad-arg.rs:32:17
    |
 LL |     format!("", 1, 2);               //~ ERROR: multiple unused formatting arguments
-   |             --  ^  ^
-   |             |
+   |             --  ^  ^ argument never used
+   |             |   |
+   |             |   argument never used
    |             multiple missing formatting specifiers
 
 error: argument never used
   --> $DIR/ifmt-bad-arg.rs:33:22
    |
 LL |     format!("{}", 1, 2);             //~ ERROR: argument never used
-   |             ----     ^
+   |             ----     ^ argument never used
    |             |
    |             formatting specifier missing
 
@@ -96,7 +97,7 @@ error: argument never used
   --> $DIR/ifmt-bad-arg.rs:34:20
    |
 LL |     format!("{1}", 1, 2);            //~ ERROR: argument never used
-   |             -----  ^
+   |             -----  ^ argument never used
    |             |
    |             formatting specifier missing
 
@@ -104,7 +105,7 @@ error: named argument never used
   --> $DIR/ifmt-bad-arg.rs:35:26
    |
 LL |     format!("{}", 1, foo=2);         //~ ERROR: named argument never used
-   |             ----         ^
+   |             ----         ^ named argument never used
    |             |
    |             formatting specifier missing
 
@@ -112,7 +113,7 @@ error: argument never used
   --> $DIR/ifmt-bad-arg.rs:36:22
    |
 LL |     format!("{foo}", 1, foo=2);      //~ ERROR: argument never used
-   |             -------  ^
+   |             -------  ^ argument never used
    |             |
    |             formatting specifier missing
 
@@ -120,7 +121,7 @@ error: named argument never used
   --> $DIR/ifmt-bad-arg.rs:37:21
    |
 LL |     format!("", foo=2);              //~ ERROR: named argument never used
-   |             --      ^
+   |             --      ^ named argument never used
    |             |
    |             formatting specifier missing
 
@@ -128,8 +129,9 @@ error: multiple unused formatting arguments
   --> $DIR/ifmt-bad-arg.rs:38:32
    |
 LL |     format!("{} {}", 1, 2, foo=1, bar=2);  //~ ERROR: multiple unused formatting arguments
-   |             -------            ^      ^
-   |             |
+   |             -------            ^      ^ named argument never used
+   |             |                  |
+   |             |                  named argument never used
    |             multiple missing formatting specifiers
 
 error: duplicate argument named `foo`
@@ -160,7 +162,7 @@ error: named argument never used
   --> $DIR/ifmt-bad-arg.rs:45:51
    |
 LL |     format!("{valuea} {valueb}", valuea=5, valuec=7);
-   |             -------------------                   ^
+   |             -------------------                   ^ named argument never used
    |             |
    |             formatting specifier missing
 
@@ -194,7 +196,7 @@ error: argument never used
   --> $DIR/ifmt-bad-arg.rs:56:27
    |
 LL |     format!("foo %s baz", "bar"); //~ ERROR: argument never used
-   |                  --       ^^^^^
+   |                  --       ^^^^^ argument never used
    |                  |
    |                  help: format specifiers use curly braces: `{}`
    |
index 42ee68073fbc5c72d670645558b5f28a99ce35bb..40cb10ced16f59d28c4a2cb19b9d86c1edcc1a28 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/local-modularized-tricky-fail-2.rs:20:32
    |
 LL | exported!();
@@ -9,7 +9,7 @@ LL |                 () => ( struct Б; ) //~ ERROR non-ascii idents are not ful
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/local-modularized-tricky-fail-2.rs:36:24
    |
 LL |     panic!();
@@ -20,7 +20,7 @@ LL |         () => ( struct Г; ) //~ ERROR non-ascii idents are not fully suppo
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/local-modularized-tricky-fail-2.rs:46:24
    |
 LL | include!();
index 41c3c9d75c0aa0089c6c2f9319c8ae244daf35b2..0b8bfcbdc17baa74fb748ccaca47520836967e44 100644 (file)
@@ -2,8 +2,10 @@ error: multiple unused formatting arguments
   --> $DIR/format-foreign.rs:2:30
    |
 LL |     println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
-   |              --------------  ^^^^^^^^  ^^^^^^^  ^
-   |              |
+   |              --------------  ^^^^^^^^  ^^^^^^^  ^ argument never used
+   |              |               |         |
+   |              |               |         argument never used
+   |              |               argument never used
    |              multiple missing formatting specifiers
    |
    = note: printf formatting not supported; see the documentation for `std::fmt`
@@ -16,7 +18,7 @@ error: argument never used
   --> $DIR/format-foreign.rs:3:29
    |
 LL |     println!("%1$*2$.*3$f", 123.456); //~ ERROR never used
-   |               -----------   ^^^^^^^
+   |               -----------   ^^^^^^^ argument never used
    |               |
    |               help: format specifiers use curly braces: `{0:1$.2$}`
    |
@@ -29,8 +31,10 @@ LL |       println!(r###"%.*3$s
    |  ______________-
 LL | |         %s!/n
 LL | | "###, "Hello,", "World", 4);
-   | |    -  ^^^^^^^^  ^^^^^^^  ^
-   | |____|
+   | |    -  ^^^^^^^^  ^^^^^^^  ^ argument never used
+   | |    |  |         |
+   | |    |  |         argument never used
+   | |____|  argument never used
    |      multiple missing formatting specifiers
    |
    = note: printf formatting not supported; see the documentation for `std::fmt`
@@ -44,7 +48,7 @@ error: argument never used
   --> $DIR/format-foreign.rs:12:30
    |
 LL |     println!("{} %f", "one", 2.0); //~ ERROR never used
-   |              -------         ^^^
+   |              -------         ^^^ argument never used
    |              |
    |              formatting specifier missing
 
@@ -52,7 +56,7 @@ error: named argument never used
   --> $DIR/format-foreign.rs:14:39
    |
 LL |     println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used
-   |                         -----         ^^^^^
+   |                         -----         ^^^^^ named argument never used
    |                         |
    |                         help: format specifiers use curly braces: `{NAME}`
    |
@@ -62,8 +66,10 @@ error: multiple unused formatting arguments
   --> $DIR/format-foreign.rs:15:32
    |
 LL |     println!("$1 $0 $$ $NAME", 1, 2, NAME=3);
-   |              ----------------  ^  ^       ^
-   |              |
+   |              ----------------  ^  ^       ^ named argument never used
+   |              |                 |  |
+   |              |                 |  argument never used
+   |              |                 argument never used
    |              multiple missing formatting specifiers
    |
    = note: shell formatting not supported; see the documentation for `std::fmt`
index c94ff2a16714d20f61c50c4b078950fc6e2d98d7..0a5e379a4adb4777bbbcc5d847882a1ec25f0ad9 100644 (file)
@@ -2,8 +2,10 @@ error: multiple unused formatting arguments
   --> $DIR/format-unused-lables.rs:2:22
    |
 LL |     println!("Test", 123, 456, 789);
-   |              ------  ^^^  ^^^  ^^^
-   |              |
+   |              ------  ^^^  ^^^  ^^^ argument never used
+   |              |       |    |
+   |              |       |    argument never used
+   |              |       argument never used
    |              multiple missing formatting specifiers
 
 error: multiple unused formatting arguments
@@ -12,17 +14,17 @@ error: multiple unused formatting arguments
 LL |     println!("Test2",
    |              ------- multiple missing formatting specifiers
 LL |         123,  //~ ERROR multiple unused formatting arguments
-   |         ^^^
+   |         ^^^ argument never used
 LL |         456,
-   |         ^^^
+   |         ^^^ argument never used
 LL |         789
-   |         ^^^
+   |         ^^^ argument never used
 
 error: named argument never used
   --> $DIR/format-unused-lables.rs:11:35
    |
 LL |     println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used
-   |              ------------         ^^^^^^
+   |              ------------         ^^^^^^ named argument never used
    |              |
    |              formatting specifier missing
 
@@ -35,12 +37,12 @@ LL |     println!("Some more $STUFF",
    |              |          help: format specifiers use curly braces: `{STUFF}`
    |              multiple missing formatting specifiers
 LL |         "woo!",  //~ ERROR multiple unused formatting arguments
-   |         ^^^^^^
+   |         ^^^^^^ argument never used
 LL |             STUFF=
 LL |        "things"
-   |        ^^^^^^^^
+   |        ^^^^^^^^ named argument never used
 LL |              , UNUSED="args");
-   |                       ^^^^^^
+   |                       ^^^^^^ named argument never used
    |
    = note: shell formatting not supported; see the documentation for `std::fmt`
 
index 4279ed78d39f9d9d95964fb7d80ec2f5d5a0e97c..b1bb4a3001557a618113221ad9bb031c6f4cc32d 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/utf8_idents.rs:4:5
    |
 LL |     'β, //~ ERROR non-ascii idents are not fully supported
@@ -6,7 +6,7 @@ LL |     'β, //~ ERROR non-ascii idents are not fully supported
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/utf8_idents.rs:5:5
    |
 LL |     γ  //~ ERROR non-ascii idents are not fully supported
@@ -14,7 +14,7 @@ LL |     γ  //~ ERROR non-ascii idents are not fully supported
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/utf8_idents.rs:9:5
    |
 LL |     δ: usize //~ ERROR non-ascii idents are not fully supported
@@ -22,7 +22,7 @@ LL |     δ: usize //~ ERROR non-ascii idents are not fully supported
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
   --> $DIR/utf8_idents.rs:13:9
    |
 LL |     let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported
index fc24fce73f878e641094b1802df1e748c5fe233a..f7bdf500d93895b6c02f8ae6a73002207f85e523 160000 (submodule)
@@ -1 +1 @@
-Subproject commit fc24fce73f878e641094b1802df1e748c5fe233a
+Subproject commit f7bdf500d93895b6c02f8ae6a73002207f85e523