From bb74c20a5d2594cab6d9416c2ed2cc8bd45fc956 Mon Sep 17 00:00:00 2001 From: "leonardo.yvens" Date: Mon, 2 Oct 2017 22:04:23 -0300 Subject: [PATCH 01/14] Inline eq_slice into str::eq It's the only use of the function. --- src/libcore/str/mod.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 0af9fcf0a3d3b..670c2afa66f85 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1405,16 +1405,6 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> { #[allow(deprecated)] impl<'a> FusedIterator for LinesAny<'a> {} -/* -Section: Comparing strings -*/ - -/// Bytewise slice equality -#[inline] -fn eq_slice(a: &str, b: &str) -> bool { - a.as_bytes() == b.as_bytes() -} - /* Section: UTF-8 validation */ @@ -1590,7 +1580,6 @@ mod traits { use cmp::Ordering; use ops; use slice::{self, SliceIndex}; - use str::eq_slice; /// Implements ordering of strings. /// @@ -1611,7 +1600,7 @@ mod traits { impl PartialEq for str { #[inline] fn eq(&self, other: &str) -> bool { - eq_slice(self, other) + self.as_bytes() == other.as_bytes() } #[inline] fn ne(&self, other: &str) -> bool { !(*self).eq(other) } From 47fc913e560709820cce22a90d4145925753ae19 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 5 Oct 2017 12:34:52 -0700 Subject: [PATCH 02/14] Update the `jobserver` crate Brings in a bugfix to be compatible with the master branch of `make` where jobserver fds are set in nonblocking mode --- src/Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 26be463f6bb6f..c7bee4d2c1636 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -199,7 +199,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "home 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -759,7 +759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jobserver" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1429,7 +1429,7 @@ dependencies = [ "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "fmt_macros 0.0.0", "graphviz 0.0.0", - "jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_back 0.0.0", @@ -1756,7 +1756,7 @@ dependencies = [ "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2529,7 +2529,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3fcaf2365eb14b28ec7603c98c06cc531f19de9eb283d89a3dff8417c8c99f5" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" -"checksum jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "443ae8bc0af6c106e6e8b77e04684faecc1a5ce94e058f4c2b0a037b0ea1b133" +"checksum jobserver 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "094f87ed101b6832def8632f43db43dc204d27897eb95aca69b26ce2e4011e84" "checksum jsonrpc-core 7.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1acd0f9934da94466d2370f36832b9b19271b4abdfdb5e69f0bcd991ebcd515" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kuchiki 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ef2ea4f2f7883cd7c6772b06c14abca01a2cc1f75c426cebffcf6b3b925ef9fc" From e6728ecdbb52fbf5337a8d962fefcf83a6c65a3f Mon Sep 17 00:00:00 2001 From: Cameron Steffen Date: Sun, 8 Oct 2017 10:40:52 -0500 Subject: [PATCH 03/14] fix documentation typo --- src/librustc/hir/itemlikevisit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/hir/itemlikevisit.rs b/src/librustc/hir/itemlikevisit.rs index ce1a34faf5ee8..2221ecf07b434 100644 --- a/src/librustc/hir/itemlikevisit.rs +++ b/src/librustc/hir/itemlikevisit.rs @@ -41,7 +41,7 @@ use super::intravisit::Visitor; /// - Example: Lifetime resolution, which wants to bring lifetimes declared on the /// impl into scope while visiting the impl-items, and then back out again. /// - How: Implement `intravisit::Visitor` and override the -/// `visit_nested_map()` methods to return +/// `nested_visit_map()` methods to return /// `NestedVisitorMap::All`. Walk your crate with /// `intravisit::walk_crate()` invoked on `tcx.hir.krate()`. /// - Pro: Visitor methods for any kind of HIR node, not just item-like things. From a263a78b28dd1cef60025b0681689d7b6188d693 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Sun, 8 Oct 2017 20:08:11 -0400 Subject: [PATCH 04/14] Fix PEP8 style issues in bootstrap code --- src/bootstrap/bootstrap.py | 1 + src/bootstrap/configure.py | 48 ++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 4a8c3dcebcb49..918314804ccfc 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -302,6 +302,7 @@ def default_build_triple(): return "{}-{}".format(cputype, ostype) + class RustBuild(object): """Provide all the methods required to build Rust""" def __init__(self): diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 67337bf44214e..6b9356dec56b7 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -19,6 +19,7 @@ sys.path.append(os.path.join(rust_dir, "src", "bootstrap")) import bootstrap + class Option: def __init__(self, name, rustbuild, desc, value): self.name = name @@ -26,14 +27,18 @@ def __init__(self, name, rustbuild, desc, value): self.desc = desc self.value = value + options = [] + def o(*args): options.append(Option(*args, value=False)) + def v(*args): options.append(Option(*args, value=True)) + o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given") o("docs", "build.docs", "build standard library documentation") o("compiler-docs", "build.compiler-docs", "build compiler documentation") @@ -136,13 +141,16 @@ def v(*args): v("set", None, "set arbitrary key/value pairs in TOML configuration") + def p(msg): print("configure: " + msg) + def err(msg): print("configure: error: " + msg) sys.exit(1) + if '--help' in sys.argv or '-h' in sys.argv: print('Usage: ./configure [options]') print('') @@ -208,7 +216,7 @@ def err(msg): continue found = True - if not option.name in known_args: + if option.name not in known_args: known_args[option.name] = [] known_args[option.name].append((option, value)) break @@ -227,27 +235,30 @@ def err(msg): # TOML we're going to write out config = {} + def build(): if 'build' in known_args: return known_args['build'][0][1] return bootstrap.default_build_triple() + def set(key, value): - s = "{:20} := {}".format(key, value) - if len(s) < 70: - p(s) - else: - p(s[:70] + " ...") - - arr = config - parts = key.split('.') - for i, part in enumerate(parts): - if i == len(parts) - 1: - arr[part] = value - else: - if not part in arr: - arr[part] = {} - arr = arr[part] + s = "{:20} := {}".format(key, value) + if len(s) < 70: + p(s) + else: + p(s[:70] + " ...") + + arr = config + parts = key.split('.') + for i, part in enumerate(parts): + if i == len(parts) - 1: + arr[part] = value + else: + if part not in arr: + arr[part] = {} + arr = arr[part] + for key in known_args: # The `set` option is special and can be passed a bunch of times @@ -345,6 +356,7 @@ def set(key, value): targets[target] = sections['target'][:] targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target) + # Here we walk through the constructed configuration we have from the parsed # command line arguemnts. We then apply each piece of configuration by # basically just doing a `sed` to change the various configuration line to what @@ -362,6 +374,7 @@ def to_toml(value): else: raise 'no toml' + def configure_section(lines, config): for key in config: value = config[key] @@ -375,9 +388,10 @@ def configure_section(lines, config): if not found: raise RuntimeError("failed to find config line for {}".format(key)) + for section_key in config: section_config = config[section_key] - if not section_key in sections: + if section_key not in sections: raise RuntimeError("config key {} not in sections".format(key)) if section_key == 'target': From fcee9506602829a2ed8505c0ba657d12b972e7ae Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Mon, 2 Oct 2017 18:29:03 -0500 Subject: [PATCH 05/14] let rustdoc print the crate version into docs --- src/librustdoc/clean/mod.rs | 2 ++ src/librustdoc/html/render.rs | 14 ++++++++++++++ src/librustdoc/html/static/rustdoc.css | 9 +++++++++ src/librustdoc/lib.rs | 6 ++++++ src/test/rustdoc/crate-version.rs | 13 +++++++++++++ 5 files changed, 44 insertions(+) create mode 100644 src/test/rustdoc/crate-version.rs diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index c9afa3646b2da..6cf8ea3c57dd0 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -112,6 +112,7 @@ impl, U> Clean> for P<[T]> { #[derive(Clone, Debug)] pub struct Crate { pub name: String, + pub version: Option, pub src: PathBuf, pub module: Option, pub externs: Vec<(CrateNum, ExternalCrate)>, @@ -183,6 +184,7 @@ impl<'a, 'tcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx> { Crate { name, + version: None, src, module: Some(module), externs, diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index a3f446885f96e..9bc94eff14223 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -256,6 +256,9 @@ pub struct Cache { // the access levels from crateanalysis. pub access_levels: Arc>, + /// The version of the crate being documented, if given fron the `--crate-version` flag. + pub crate_version: Option, + // Private fields only used when initially crawling a crate to build a cache stack: Vec, @@ -534,6 +537,7 @@ pub fn run(mut krate: clean::Crate, primitive_locations: FxHashMap(), stripped_mod: false, access_levels: krate.access_levels.clone(), + crate_version: krate.version.take(), orphan_impl_items: Vec::new(), traits: mem::replace(&mut krate.external_traits, FxHashMap()), deref_trait_did, @@ -3422,6 +3426,16 @@ impl<'a> fmt::Display for Sidebar<'a> { write!(fmt, "{}", it.name.as_ref().unwrap())?; write!(fmt, "

")?; + if it.is_crate() { + if let Some(ref version) = cache().crate_version { + write!(fmt, + "
\ +

Version {}

\ +
", + version)?; + } + } + match it.inner { clean::StructItem(ref s) => sidebar_struct(fmt, it, s)?, clean::TraitItem(ref t) => sidebar_trait(fmt, it, t)?, diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 27574e67bc87b..61a3902098ffa 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -203,6 +203,15 @@ nav.sub { word-wrap: break-word; } +.sidebar .version { + font-size: 15px; + text-align: center; + border-bottom: #DDDDDD 1px solid; + overflow-wrap: break-word; + word-wrap: break-word; /* deprecated */ + word-break: break-word; /* Chrome, non-standard */ +} + .location:empty { border: none; } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9563ccfcc65fd..f8bf00ad73fcc 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -243,6 +243,9 @@ pub fn opts() -> Vec { unstable("display-warnings", |o| { o.optflag("", "display-warnings", "to print code warnings when testing doc") }), + unstable("crate-version", |o| { + o.optopt("", "crate-version", "crate version to print into documentation", "VERSION") + }), ] } @@ -460,6 +463,7 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { let triple = matches.opt_str("target"); let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from); let crate_name = matches.opt_str("crate-name"); + let crate_version = matches.opt_str("crate-version"); let plugin_path = matches.opt_str("plugin-path"); let cr = PathBuf::from(cratefile); @@ -484,6 +488,8 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { krate.name = name } + krate.version = crate_version; + // Process all of the crate attributes, extracting plugin metadata along // with the passes which we are supposed to run. for attr in krate.module.as_ref().unwrap().attrs.lists("doc") { diff --git a/src/test/rustdoc/crate-version.rs b/src/test/rustdoc/crate-version.rs new file mode 100644 index 0000000000000..07ab5ceedfa02 --- /dev/null +++ b/src/test/rustdoc/crate-version.rs @@ -0,0 +1,13 @@ +// Copyright 2016 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: --crate-version=1.3.37 -Z unstable-options + +// @has 'crate_version/index.html' '//div[@class="block version"]/p' 'Version 1.3.37' From 7735f59e8084a69361224da2b1bc7337214c2c85 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 10 Oct 2017 04:20:49 -0400 Subject: [PATCH 06/14] unstable book: OIBIT --- .../language-features/optin-builtin-traits.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/optin-builtin-traits.md diff --git a/src/doc/unstable-book/src/language-features/optin-builtin-traits.md b/src/doc/unstable-book/src/language-features/optin-builtin-traits.md new file mode 100644 index 0000000000000..9baa7eb35328d --- /dev/null +++ b/src/doc/unstable-book/src/language-features/optin-builtin-traits.md @@ -0,0 +1,49 @@ +# `optin_builtin_traits` + +The tracking issue for this feature is [#13231] + +[#13231]: https://github.com/rust-lang/rust/issues/13231 + +---- + +The `optin_builtin_traits` feature gate allows you to define _auto traits_. + +Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits +that are automatically implemented for every type, unless the type, or a type it contains, +has explictly opted out via a _negative impl_. + +[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html +[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html + +```rust +impl !Type for Trait +``` + +Example: + +```rust + #![feature(optin_builtin_traits)] + + trait Valid {} + + impl Valid for .. {} + + struct True; + struct False; + + impl !Valid for False {} + + struct MaybeValid(T); + + fn must_be_valid(_t: T) { + + } + + fn main() { + //works + must_be_valid( MaybeValid(True) ); + + // compiler error - trait bound not satisfied + // must_be_valid( MaybeValid(False) ); + } +``` From 364148dbf9d7a3e4a8e0c766ae3395f63fcb5a01 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 10 Oct 2017 04:42:59 -0400 Subject: [PATCH 07/14] unstable book: unboxed_closures --- .../src/language-features/unboxed-closures.md | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/unboxed-closures.md diff --git a/src/doc/unstable-book/src/language-features/unboxed-closures.md b/src/doc/unstable-book/src/language-features/unboxed-closures.md new file mode 100644 index 0000000000000..5146fcd873984 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/unboxed-closures.md @@ -0,0 +1,25 @@ +# `unboxed_closures` + +The tracking issue for this feature is [#29625] + +See Also: [`fn_traits`](library-features/fn-traits.md) + +[#29625]: https://github.com/rust-lang/rust/issues/29625 + +---- + +The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI, +required for implmenting the [`Fn*`] family of traits. `"rust-call"` functions must have +exactly one (non self) argument, a tuple representing the argument list. + +[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html + +```rust +#![feature(unboxed_closures)] + +extern "rust-call" fn add_args(args: (u32, u32)) { + args.0 + args.1 +} + +fn main() {} +``` From d07825258e2d5860442616ede39eb11ca3f8c9b6 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 10 Oct 2017 04:51:39 -0400 Subject: [PATCH 08/14] unstable book: fn_traits --- .../language-features/optin-builtin-traits.md | 2 +- .../src/library-features/fn-traits.md | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/doc/unstable-book/src/library-features/fn-traits.md diff --git a/src/doc/unstable-book/src/language-features/optin-builtin-traits.md b/src/doc/unstable-book/src/language-features/optin-builtin-traits.md index 9baa7eb35328d..4ff46dedba1bb 100644 --- a/src/doc/unstable-book/src/language-features/optin-builtin-traits.md +++ b/src/doc/unstable-book/src/language-features/optin-builtin-traits.md @@ -15,7 +15,7 @@ has explictly opted out via a _negative impl_. [`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html -```rust +```rust, ignore impl !Type for Trait ``` diff --git a/src/doc/unstable-book/src/library-features/fn-traits.md b/src/doc/unstable-book/src/library-features/fn-traits.md new file mode 100644 index 0000000000000..d0f1fe8dc7c15 --- /dev/null +++ b/src/doc/unstable-book/src/library-features/fn-traits.md @@ -0,0 +1,35 @@ +# `fn_traits` + +The tracking issue for this feature is [#29625] + +See Also: [`unboxed_closures`](language-features/unboxed_closures.md) + +[#29625]: https://github.com/rust-lang/rust/issues/29625 + +---- + +The `fn_traits` feature allows for implementation of the [`Fn*`] traits +for creating custom closure-like types. + +[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html + +```rust +#![feature(unboxed_closures)] +#![feature(fn_traits)] + +struct Adder { + a: u32 +} + +impl FnOnce<(u32, )> for Adder { + type Output = u32; + extern "rust-call" fn call_once(self, b: (u32, )) -> Self::Output { + self.a + b.0 + } +} + +fn main() { + let adder = Adder { a: 3 }; + assert_eq!(adder(2), 5); +} +``` From 1cb9f70b22dcae385365d7e87ddbf8c0a28b2843 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 10 Oct 2017 16:12:11 +0200 Subject: [PATCH 09/14] Upgrade some comments to doc comments --- src/librustc/session/mod.rs | 54 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index bd6e5eb67c87c..89dca3e020d38 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -54,24 +54,24 @@ pub mod config; pub mod filesearch; pub mod search_paths; -// Represents the data associated with a compilation -// session for a single crate. +/// Represents the data associated with a compilation +/// session for a single crate. pub struct Session { pub target: config::Config, pub host: Target, pub opts: config::Options, pub parse_sess: ParseSess, - // For a library crate, this is always none + /// For a library crate, this is always none pub entry_fn: RefCell>, pub entry_type: Cell>, pub plugin_registrar_fn: Cell>, pub derive_registrar_fn: Cell>, pub default_sysroot: Option, - // The name of the root source file of the crate, in the local file system. - // `None` means that there is no source file. + /// The name of the root source file of the crate, in the local file system. + /// `None` means that there is no source file. pub local_crate_source_file: Option, - // The directory the compiler has been executed in plus a flag indicating - // if the value stored here has been affected by path remapping. + /// The directory the compiler has been executed in plus a flag indicating + /// if the value stored here has been affected by path remapping. pub working_dir: (String, bool), pub lint_store: RefCell, pub buffered_lints: RefCell>, @@ -83,11 +83,11 @@ pub struct Session { pub plugin_attributes: RefCell>, pub crate_types: RefCell>, pub dependency_formats: RefCell, - // The crate_disambiguator is constructed out of all the `-C metadata` - // arguments passed to the compiler. Its value together with the crate-name - // forms a unique global identifier for the crate. It is used to allow - // multiple crates with the same name to coexist. See the - // trans::back::symbol_names module for more information. + /// The crate_disambiguator is constructed out of all the `-C metadata` + /// arguments passed to the compiler. Its value together with the crate-name + /// forms a unique global identifier for the crate. It is used to allow + /// multiple crates with the same name to coexist. See the + /// trans::back::symbol_names module for more information. pub crate_disambiguator: RefCell>, pub features: RefCell, @@ -143,17 +143,17 @@ pub struct Session { } pub struct PerfStats { - // The accumulated time needed for computing the SVH of the crate + /// The accumulated time needed for computing the SVH of the crate pub svh_time: Cell, - // The accumulated time spent on computing incr. comp. hashes + /// The accumulated time spent on computing incr. comp. hashes pub incr_comp_hashes_time: Cell, - // The number of incr. comp. hash computations performed + /// The number of incr. comp. hash computations performed pub incr_comp_hashes_count: Cell, - // The number of bytes hashed when computing ICH values + /// The number of bytes hashed when computing ICH values pub incr_comp_bytes_hashed: Cell, - // The accumulated time spent on computing symbol hashes + /// The accumulated time spent on computing symbol hashes pub symbol_hash_time: Cell, - // The accumulated time spent decoding def path tables from metadata + /// The accumulated time spent decoding def path tables from metadata pub decode_def_path_tables_time: Cell, } @@ -804,24 +804,24 @@ pub fn build_session_(sopts: config::Options, /// Holds data on the current incremental compilation session, if there is one. #[derive(Debug)] pub enum IncrCompSession { - // This is the state the session will be in until the incr. comp. dir is - // needed. + /// This is the state the session will be in until the incr. comp. dir is + /// needed. NotInitialized, - // This is the state during which the session directory is private and can - // be modified. + /// This is the state during which the session directory is private and can + /// be modified. Active { session_directory: PathBuf, lock_file: flock::Lock, load_dep_graph: bool, }, - // This is the state after the session directory has been finalized. In this - // state, the contents of the directory must not be modified any more. + /// This is the state after the session directory has been finalized. In this + /// state, the contents of the directory must not be modified any more. Finalized { session_directory: PathBuf, }, - // This is an error state that is reached when some compilation error has - // occurred. It indicates that the contents of the session directory must - // not be used, since they might be invalid. + /// This is an error state that is reached when some compilation error has + /// occurred. It indicates that the contents of the session directory must + /// not be used, since they might be invalid. InvalidBecauseOfErrors { session_directory: PathBuf, } From ca61ea2c44b22d082235c77223c3813df4c1174f Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 11 Oct 2017 02:36:40 +0300 Subject: [PATCH 10/14] Shorten some test names Paths to object files generated from them were too long and caused errors --- ...zation-allowed-cross-crate.rs => allowed-cross-crate.rs} | 0 .../{specialization-assoc-fns.rs => assoc-fns.rs} | 0 .../{specialization_cross_crate.rs => cross_crate.rs} | 0 ...tion_cross_crate_defaults.rs => cross_crate_defaults.rs} | 0 .../{specialization-basics-unsafe.rs => basics-unsafe.rs} | 0 .../defaultimpl/{specialization-basics.rs => basics.rs} | 0 ...tion-cross-crate-defaults.rs => cross-crate-defaults.rs} | 6 +++--- ...zation-cross-crate-no-gate.rs => cross-crate-no-gate.rs} | 6 +++--- .../{specialization-cross-crate.rs => cross-crate.rs} | 6 +++--- ...specialization-default-methods.rs => default-methods.rs} | 0 .../{specialization-out-of-order.rs => out-of-order.rs} | 0 ...lization-overlap-projection.rs => overlap-projection.rs} | 0 ...ecialization-projection-alias.rs => projection-alias.rs} | 0 .../{specialization-projection.rs => projection.rs} | 0 14 files changed, 9 insertions(+), 9 deletions(-) rename src/test/run-pass/specialization/defaultimpl/{specialization-allowed-cross-crate.rs => allowed-cross-crate.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-assoc-fns.rs => assoc-fns.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/auxiliary/{specialization_cross_crate.rs => cross_crate.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/auxiliary/{specialization_cross_crate_defaults.rs => cross_crate_defaults.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-basics-unsafe.rs => basics-unsafe.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-basics.rs => basics.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-cross-crate-defaults.rs => cross-crate-defaults.rs} (87%) rename src/test/run-pass/specialization/defaultimpl/{specialization-cross-crate-no-gate.rs => cross-crate-no-gate.rs} (89%) rename src/test/run-pass/specialization/defaultimpl/{specialization-cross-crate.rs => cross-crate.rs} (93%) rename src/test/run-pass/specialization/defaultimpl/{specialization-default-methods.rs => default-methods.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-out-of-order.rs => out-of-order.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-overlap-projection.rs => overlap-projection.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-projection-alias.rs => projection-alias.rs} (100%) rename src/test/run-pass/specialization/defaultimpl/{specialization-projection.rs => projection.rs} (100%) diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-allowed-cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-allowed-cross-crate.rs rename to src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-assoc-fns.rs b/src/test/run-pass/specialization/defaultimpl/assoc-fns.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-assoc-fns.rs rename to src/test/run-pass/specialization/defaultimpl/assoc-fns.rs diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/specialization_cross_crate.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/auxiliary/specialization_cross_crate.rs rename to src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate.rs diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/specialization_cross_crate_defaults.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate_defaults.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/auxiliary/specialization_cross_crate_defaults.rs rename to src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate_defaults.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-basics-unsafe.rs b/src/test/run-pass/specialization/defaultimpl/basics-unsafe.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-basics-unsafe.rs rename to src/test/run-pass/specialization/defaultimpl/basics-unsafe.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-basics.rs b/src/test/run-pass/specialization/defaultimpl/basics.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-basics.rs rename to src/test/run-pass/specialization/defaultimpl/basics.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-cross-crate-defaults.rs b/src/test/run-pass/specialization/defaultimpl/cross-crate-defaults.rs similarity index 87% rename from src/test/run-pass/specialization/defaultimpl/specialization-cross-crate-defaults.rs rename to src/test/run-pass/specialization/defaultimpl/cross-crate-defaults.rs index 62c7e3e2e4431..19e1af15bdd56 100644 --- a/src/test/run-pass/specialization/defaultimpl/specialization-cross-crate-defaults.rs +++ b/src/test/run-pass/specialization/defaultimpl/cross-crate-defaults.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:specialization_cross_crate_defaults.rs +// aux-build:cross_crate_defaults.rs #![feature(specialization)] -extern crate specialization_cross_crate_defaults; +extern crate cross_crate_defaults; -use specialization_cross_crate_defaults::*; +use cross_crate_defaults::*; struct LocalDefault; struct LocalOverride; diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-cross-crate-no-gate.rs b/src/test/run-pass/specialization/defaultimpl/cross-crate-no-gate.rs similarity index 89% rename from src/test/run-pass/specialization/defaultimpl/specialization-cross-crate-no-gate.rs rename to src/test/run-pass/specialization/defaultimpl/cross-crate-no-gate.rs index b9548539e1649..67cc694ae12c7 100644 --- a/src/test/run-pass/specialization/defaultimpl/specialization-cross-crate-no-gate.rs +++ b/src/test/run-pass/specialization/defaultimpl/cross-crate-no-gate.rs @@ -10,11 +10,11 @@ // Test that specialization works even if only the upstream crate enables it -// aux-build:specialization_cross_crate.rs +// aux-build:cross_crate.rs -extern crate specialization_cross_crate; +extern crate cross_crate; -use specialization_cross_crate::*; +use cross_crate::*; fn main() { assert!(0u8.foo() == "generic Clone"); diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/cross-crate.rs similarity index 93% rename from src/test/run-pass/specialization/defaultimpl/specialization-cross-crate.rs rename to src/test/run-pass/specialization/defaultimpl/cross-crate.rs index 7517824b62bba..f1ad105db8f7c 100644 --- a/src/test/run-pass/specialization/defaultimpl/specialization-cross-crate.rs +++ b/src/test/run-pass/specialization/defaultimpl/cross-crate.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:specialization_cross_crate.rs +// aux-build:cross_crate.rs #![feature(specialization)] -extern crate specialization_cross_crate; +extern crate cross_crate; -use specialization_cross_crate::*; +use cross_crate::*; struct NotClone; diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-default-methods.rs b/src/test/run-pass/specialization/defaultimpl/default-methods.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-default-methods.rs rename to src/test/run-pass/specialization/defaultimpl/default-methods.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-out-of-order.rs b/src/test/run-pass/specialization/defaultimpl/out-of-order.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-out-of-order.rs rename to src/test/run-pass/specialization/defaultimpl/out-of-order.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-overlap-projection.rs b/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-overlap-projection.rs rename to src/test/run-pass/specialization/defaultimpl/overlap-projection.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-projection-alias.rs b/src/test/run-pass/specialization/defaultimpl/projection-alias.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-projection-alias.rs rename to src/test/run-pass/specialization/defaultimpl/projection-alias.rs diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-projection.rs b/src/test/run-pass/specialization/defaultimpl/projection.rs similarity index 100% rename from src/test/run-pass/specialization/defaultimpl/specialization-projection.rs rename to src/test/run-pass/specialization/defaultimpl/projection.rs From 7ea286e854d88529af76ca486ed676c9fb06e8ee Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Mon, 9 Oct 2017 15:21:11 -0500 Subject: [PATCH 11/14] render the rust version into std/compiler/test docs --- src/bootstrap/bin/rustdoc.rs | 8 ++++++++ src/bootstrap/builder.rs | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index d7d72d5dd56c9..d18512b257d6a 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -48,6 +48,14 @@ fn main() { cmd.arg("-Z").arg("force-unstable-if-unmarked"); } + // Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick + // it up so we can make rustdoc print this into the docs + if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") { + // This "unstable-options" can be removed when `--crate-version` is stabilized + cmd.arg("-Z").arg("unstable-options") + .arg("--crate-version").arg(version); + } + std::process::exit(match cmd.status() { Ok(s) => s.code().unwrap_or(1), Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e), diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index e7a5196178c3f..1d63e112ca6fb 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -418,7 +418,8 @@ impl<'a> Builder<'a> { .env("RUSTC_SYSROOT", self.sysroot(compiler)) .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build)) .env("CFG_RELEASE_CHANNEL", &self.build.config.channel) - .env("RUSTDOC_REAL", self.rustdoc(host)); + .env("RUSTDOC_REAL", self.rustdoc(host)) + .env("RUSTDOC_CRATE_VERSION", self.build.rust_version()); cmd } @@ -574,6 +575,9 @@ impl<'a> Builder<'a> { cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string()); } + // For `cargo doc` invocations, make rustdoc print the Rust version into the docs + cargo.env("RUSTDOC_CRATE_VERSION", self.build.rust_version()); + // Environment variables *required* throughout the build // // FIXME: should update code to not require this env var From d5ef9f9036743c77cbc30286a3b3b8e8185330d1 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 10 Oct 2017 05:03:47 -0400 Subject: [PATCH 12/14] formatting fixes --- .../language-features/optin-builtin-traits.md | 36 +++++++++---------- .../src/language-features/unboxed-closures.md | 4 +-- .../src/library-features/fn-traits.md | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/doc/unstable-book/src/language-features/optin-builtin-traits.md b/src/doc/unstable-book/src/language-features/optin-builtin-traits.md index 4ff46dedba1bb..ee24dd87d90c3 100644 --- a/src/doc/unstable-book/src/language-features/optin-builtin-traits.md +++ b/src/doc/unstable-book/src/language-features/optin-builtin-traits.md @@ -6,44 +6,42 @@ The tracking issue for this feature is [#13231] ---- -The `optin_builtin_traits` feature gate allows you to define _auto traits_. +The `optin_builtin_traits` feature gate allows you to define auto traits. Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits that are automatically implemented for every type, unless the type, or a type it contains, -has explictly opted out via a _negative impl_. +has explictly opted out via a negative impl. [`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html -```rust, ignore +```rust,ignore impl !Type for Trait ``` Example: ```rust - #![feature(optin_builtin_traits)] +#![feature(optin_builtin_traits)] - trait Valid {} +trait Valid {} - impl Valid for .. {} +impl Valid for .. {} - struct True; - struct False; +struct True; +struct False; - impl !Valid for False {} +impl !Valid for False {} - struct MaybeValid(T); +struct MaybeValid(T); - fn must_be_valid(_t: T) { +fn must_be_valid(_t: T) { } - } - - fn main() { - //works - must_be_valid( MaybeValid(True) ); +fn main() { + // works + must_be_valid( MaybeValid(True) ); - // compiler error - trait bound not satisfied - // must_be_valid( MaybeValid(False) ); - } + // compiler error - trait bound not satisfied + // must_be_valid( MaybeValid(False) ); +} ``` diff --git a/src/doc/unstable-book/src/language-features/unboxed-closures.md b/src/doc/unstable-book/src/language-features/unboxed-closures.md index 5146fcd873984..0eaed7a1989c5 100644 --- a/src/doc/unstable-book/src/language-features/unboxed-closures.md +++ b/src/doc/unstable-book/src/language-features/unboxed-closures.md @@ -2,7 +2,7 @@ The tracking issue for this feature is [#29625] -See Also: [`fn_traits`](library-features/fn-traits.md) +See Also: [`fn_traits`](library-features/fn-traits.html) [#29625]: https://github.com/rust-lang/rust/issues/29625 @@ -17,7 +17,7 @@ exactly one (non self) argument, a tuple representing the argument list. ```rust #![feature(unboxed_closures)] -extern "rust-call" fn add_args(args: (u32, u32)) { +extern "rust-call" fn add_args(args: (u32, u32)) -> u32 { args.0 + args.1 } diff --git a/src/doc/unstable-book/src/library-features/fn-traits.md b/src/doc/unstable-book/src/library-features/fn-traits.md index d0f1fe8dc7c15..72a3f36c10b69 100644 --- a/src/doc/unstable-book/src/library-features/fn-traits.md +++ b/src/doc/unstable-book/src/library-features/fn-traits.md @@ -2,7 +2,7 @@ The tracking issue for this feature is [#29625] -See Also: [`unboxed_closures`](language-features/unboxed_closures.md) +See Also: [`unboxed_closures`](language-features/unboxed-closures.html) [#29625]: https://github.com/rust-lang/rust/issues/29625 From 3cb52949666fee2005402e71b879742f5baecf25 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Wed, 11 Oct 2017 07:36:43 -0400 Subject: [PATCH 13/14] Fix typo during merge from master --- src/bootstrap/configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index a296fa9459d73..725dd6dca7214 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -394,7 +394,7 @@ def configure_section(lines, config): if section_key not in sections: raise RuntimeError("config key {} not in sections".format(section_key)) - if __key == 'target': + if section_key == 'target': for target in section_config: configure_section(targets[target], section_config[target]) else: From 19901df00282d11e39bdee8d81b773a5826330fb Mon Sep 17 00:00:00 2001 From: kennytm Date: Thu, 12 Oct 2017 14:53:26 +0800 Subject: [PATCH 14/14] Fix typo in libsyntax/parse/lexer/unicode_chars.rs ` (U+0060) should be the "grave" accent, not "Greek" accent. --- src/libsyntax/parse/lexer/unicode_chars.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs index 39b5482a066d4..35afe8dd56d93 100644 --- a/src/libsyntax/parse/lexer/unicode_chars.rs +++ b/src/libsyntax/parse/lexer/unicode_chars.rs @@ -144,7 +144,7 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[ ('‵', "Reversed Prime", '\''), ('՚', "Armenian Apostrophe", '\''), ('׳', "Hebrew Punctuation Geresh", '\''), - ('`', "Greek Accent", '\''), + ('`', "Grave Accent", '\''), ('`', "Greek Varia", '\''), ('`', "Fullwidth Grave Accent", '\''), ('´', "Acute Accent", '\''),