]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #34848 - tshepang:patch-1, r=apasel422
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 16 Jul 2016 14:55:59 +0000 (16:55 +0200)
committerGitHub <noreply@github.com>
Sat, 16 Jul 2016 14:55:59 +0000 (16:55 +0200)
doc: remove stray comma

configure
mk/main.mk
mk/stage0.mk
src/bootstrap/lib.rs
src/doc/book/no-stdlib.md
src/doc/nomicon/phantom-data.md
src/doc/reference.md
src/etc/local_stage0.sh
src/libcore/hash/sip.rs
src/libcore/lib.rs
src/libcore/num/mod.rs

index 16496eb89d4ca8ef1ec581fb60fbebc0d43af1f3..fd009a757a4b70dee62e84b4d8d391ec503d6344 100755 (executable)
--- a/configure
+++ b/configure
@@ -600,7 +600,7 @@ opt debug-assertions 0 "build with debugging assertions"
 opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
 opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
 opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
-opt local-rebuild 0 "use an installed rustc matching the current version, for rebuilds"
+opt local-rebuild 0 "assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version"
 opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
 opt rpath 1 "build rpaths into rustc itself"
 opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
index 4c72597f0c5c1d2a2192a24f9d2337a36ae46be9..fd12bf26dfc72fdca793e5efa4ae459c24320819 100644 (file)
@@ -20,29 +20,6 @@ CFG_RELEASE_NUM=1.12.0
 # versions (section 9)
 CFG_PRERELEASE_VERSION=.1
 
-# Append a version-dependent hash to each library, so we can install different
-# versions in the same place
-CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))
-
-# A magic value that allows the compiler to use unstable features during the
-# bootstrap even when doing so would normally be an error because of feature
-# staging or because the build turns on warnings-as-errors and unstable features
-# default to warnings. The build has to match this key in an env var.
-#
-# This value is keyed off the release to ensure that all compilers for one
-# particular release have the same bootstrap key. Note that this is
-# intentionally not "secure" by any definition, this is largely just a deterrent
-# from users enabling unstable features on the stable compiler.
-CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)
-
-# The stage0 compiler needs to use the previous key recorded in src/stage0.txt,
-# except for local-rebuild when it just uses the same current key.
-ifdef CFG_ENABLE_LOCAL_REBUILD
-CFG_BOOTSTRAP_KEY_STAGE0=$(CFG_BOOTSTRAP_KEY)
-else
-CFG_BOOTSTRAP_KEY_STAGE0=$(shell grep 'rustc_key' $(S)src/stage0.txt | sed 's/rustc_key: '//)
-endif
-
 ifeq ($(CFG_RELEASE_CHANNEL),stable)
 # This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
 CFG_RELEASE=$(CFG_RELEASE_NUM)
@@ -72,6 +49,38 @@ CFG_RELEASE=$(CFG_RELEASE_NUM)-dev
 CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev
 endif
 
+# Append a version-dependent hash to each library, so we can install different
+# versions in the same place
+CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))
+
+# A magic value that allows the compiler to use unstable features during the
+# bootstrap even when doing so would normally be an error because of feature
+# staging or because the build turns on warnings-as-errors and unstable features
+# default to warnings. The build has to match this key in an env var.
+#
+# This value is keyed off the release to ensure that all compilers for one
+# particular release have the same bootstrap key. Note that this is
+# intentionally not "secure" by any definition, this is largely just a deterrent
+# from users enabling unstable features on the stable compiler.
+CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)
+
+# If local-rust is the same as the current version, then force a local-rebuild
+ifdef CFG_ENABLE_LOCAL_RUST
+ifeq ($(CFG_RELEASE),\
+      $(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT)))
+    CFG_INFO := $(info cfg: auto-detected local-rebuild $(CFG_RELEASE))
+    CFG_ENABLE_LOCAL_REBUILD = 1
+endif
+endif
+
+# The stage0 compiler needs to use the previous key recorded in src/stage0.txt,
+# except for local-rebuild when it just uses the same current key.
+ifdef CFG_ENABLE_LOCAL_REBUILD
+CFG_BOOTSTRAP_KEY_STAGE0=$(CFG_BOOTSTRAP_KEY)
+else
+CFG_BOOTSTRAP_KEY_STAGE0=$(shell sed -ne 's/^rustc_key: //p' $(S)src/stage0.txt)
+endif
+
 # The name of the package to use for creating tarballs, installers etc.
 CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS)
 
index d0191874cb3d96968c8fcd086c7ffd413ef35bf1..8a2bf2ebbde649817af12b2eb753fa2559939a3a 100644 (file)
@@ -11,6 +11,7 @@ endif
 
 $(SNAPSHOT_RUSTC_POST_CLEANUP): \
                $(S)src/stage0.txt \
+               $(S)src/etc/local_stage0.sh \
                $(S)src/etc/get-stage0.py $(MKFILE_DEPS) \
                | $(HBIN0_H_$(CFG_BUILD))/
        @$(call E, fetch: $@)
index 943271fc8a641665734531b3393b32d4f37d1e5e..caa6ea17ea0544d6f6a5c263239e4548ad469db4 100644 (file)
@@ -118,6 +118,7 @@ pub struct Build {
     ver_date: Option<String>,
     version: String,
     package_vers: String,
+    local_rebuild: bool,
     bootstrap_key: String,
     bootstrap_key_stage0: String,
 
@@ -174,6 +175,7 @@ pub fn new(flags: Flags, config: Config) -> Build {
             Some(ref s) => PathBuf::from(s),
             None => stage0_root.join(exe("cargo", &config.build)),
         };
+        let local_rebuild = config.local_rebuild;
 
         Build {
             flags: flags,
@@ -189,6 +191,7 @@ pub fn new(flags: Flags, config: Config) -> Build {
             short_ver_hash: None,
             ver_date: None,
             version: String::new(),
+            local_rebuild: local_rebuild,
             bootstrap_key: String::new(),
             bootstrap_key_stage0: String::new(),
             package_vers: String::new(),
@@ -219,6 +222,16 @@ pub fn build(&mut self) {
         sanity::check(self);
         self.verbose("collecting channel variables");
         channel::collect(self);
+        // If local-rust is the same as the current version, then force a local-rebuild
+        let local_version_verbose = output(
+            Command::new(&self.rustc).arg("--version").arg("--verbose"));
+        let local_release = local_version_verbose
+            .lines().filter(|x| x.starts_with("release:"))
+            .next().unwrap().trim_left_matches("release:").trim();
+        if local_release == self.release {
+            self.verbose(&format!("auto-detected local-rebuild {}", self.release));
+            self.local_rebuild = true;
+        }
         self.verbose("updating submodules");
         self.update_submodules();
 
@@ -525,7 +538,7 @@ fn cargo(&self,
              .arg("--target").arg(target);
 
         let stage;
-        if compiler.stage == 0 && self.config.local_rebuild {
+        if compiler.stage == 0 && self.local_rebuild {
             // Assume the local-rebuild rustc already has stage1 features.
             stage = 1;
         } else {
@@ -766,7 +779,7 @@ fn add_bootstrap_key(&self, compiler: &Compiler, cmd: &mut Command) {
         // In stage0 we're using a previously released stable compiler, so we
         // use the stage0 bootstrap key. Otherwise we use our own build's
         // bootstrap key.
-        let bootstrap_key = if compiler.is_snapshot(self) && !self.config.local_rebuild {
+        let bootstrap_key = if compiler.is_snapshot(self) && !self.local_rebuild {
             &self.bootstrap_key_stage0
         } else {
             &self.bootstrap_key
index c5c139e6580b015b91d49bd6d90a66d037b04f41..6fd7cf66920d48875e03c0a6581e08b7de72101b 100644 (file)
@@ -21,7 +21,7 @@ this using our `Cargo.toml` file:
 
 ```toml
 [dependencies]
-libc = { version = "0.2.11", default-features = false }
+libc = { version = "0.2.14", default-features = false }
 ```
 
 Note that the default features have been disabled. This is a critical step -
@@ -36,8 +36,7 @@ or overriding the default shim for the C `main` function with your own.
 The function marked `#[start]` is passed the command line parameters
 in the same format as C:
 
-```rust
-# #![feature(libc)]
+```rust,ignore
 #![feature(lang_items)]
 #![feature(start)]
 #![no_std]
@@ -51,15 +50,21 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
     0
 }
 
-// These functions and traits are used by the compiler, but not
+// These functions are used by the compiler, but not
 // for a bare-bones hello world. These are normally
 // provided by libstd.
-#[lang = "eh_personality"] extern fn eh_personality() {}
-#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
-# #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
-# #[no_mangle] pub extern fn rust_eh_register_frames () {}
-# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
-# // fn main() {} tricked you, rustdoc!
+#[lang = "eh_personality"]
+#[no_mangle]
+pub extern fn eh_personality() {
+}
+
+#[lang = "panic_fmt"]
+#[no_mangle]
+pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
+                               _file: &'static str,
+                               _line: u32) -> ! {
+    loop {}
+}
 ```
 
 To override the compiler-inserted `main` shim, one has to disable it
@@ -67,37 +72,55 @@ with `#![no_main]` and then create the appropriate symbol with the
 correct ABI and the correct name, which requires overriding the
 compiler's name mangling too:
 
-```rust
-# #![feature(libc)]
+```rust,ignore
 #![feature(lang_items)]
 #![feature(start)]
 #![no_std]
 #![no_main]
 
+// Pull in the system libc library for what crt0.o likely requires
 extern crate libc;
 
+// Entry point for this program
 #[no_mangle] // ensure that this symbol is called `main` in the output
-pub extern fn main(argc: i32, argv: *const *const u8) -> i32 {
+pub extern fn main(_argc: i32, _argv: *const *const u8) -> i32 {
     0
 }
 
-#[lang = "eh_personality"] extern fn eh_personality() {}
-#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
-# #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
-# #[no_mangle] pub extern fn rust_eh_register_frames () {}
-# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
-# // fn main() {} tricked you, rustdoc!
+// These functions and traits are used by the compiler, but not
+// for a bare-bones hello world. These are normally
+// provided by libstd.
+#[lang = "eh_personality"]
+#[no_mangle]
+pub extern fn eh_personality() {
+}
+
+#[lang = "panic_fmt"]
+#[no_mangle]
+pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
+                               _file: &'static str,
+                               _line: u32) -> ! {
+    loop {}
+}
 ```
 
-The compiler currently makes a few assumptions about symbols which are available
-in the executable to call. Normally these functions are provided by the standard
-library, but without it you must define your own.
+## More about the langauge items
+
+The compiler currently makes a few assumptions about symbols which are
+available in the executable to call. Normally these functions are provided by
+the standard library, but without it you must define your own. These symbols
+are called "language items", and they each have an internal name, and then a
+signature that an implementation must conform to.
 
 The first of these two functions, `eh_personality`, is used by the failure
 mechanisms of the compiler. This is often mapped to GCC's personality function
 (see the [libstd implementation][unwind] for more information), but crates
 which do not trigger a panic can be assured that this function is never
-called. The second function, `panic_fmt`, is also used by the failure
-mechanisms of the compiler.
-
+called. Both the language item and the symbol name are `eh_personality`.
 [unwind]: https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/gcc.rs
+
+The second function, `panic_fmt`, is also used by the failure mechanisms of the
+compiler. When a panic happens, this controls the message that's displayed on
+the screen. While the language item's name is `panic_fmt`, the symbol name is
+`rust_begin_panic`.
index ba9ef19830b698cbd9cf4504ab8af29ece4d9a98..fff8ca752b0b91fd1d5bc5c91ec6b2edbf3bce97 100644 (file)
@@ -56,7 +56,7 @@ Good to go!
 
 Nope.
 
-The drop checker will generously determine that Vec<T> does not own any values
+The drop checker will generously determine that `Vec<T>` does not own any values
 of type T. This will in turn make it conclude that it doesn't need to worry
 about Vec dropping any T's in its destructor for determining drop check
 soundness. This will in turn allow people to create unsoundness using
index b3073f5e526033271c855588b8fb343d40d63bb5..b8509321e3d19b0679ba7a29aea280336229dab2 100644 (file)
@@ -853,6 +853,20 @@ extern crate std; // equivalent to: extern crate std as std;
 extern crate std as ruststd; // linking to 'std' under another name
 ```
 
+When naming Rust crates, hyphens are disallowed. However, Cargo packages may
+make use of them. In such case, when `Cargo.toml` doesn't specify a crate name,
+Cargo will transparently replace `-` with `_` (Refer to [RFC 940] for more
+details).
+
+Here is an example:
+
+```{.ignore}
+// Importing the Cargo package hello-world
+extern crate hello_world; // hyphen replaced with an underscore
+```
+
+[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md
+
 #### Use declarations
 
 A _use declaration_ creates one or more local name bindings synonymous with
@@ -3744,9 +3758,9 @@ Since `'static` "lives longer" than `'a`, `&'static str` is a subtype of
 
 ## Type coercions
 
-Coercions are defined in [RFC401]. A coercion is implicit and has no syntax.
+Coercions are defined in [RFC 401]. A coercion is implicit and has no syntax.
 
-[RFC401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
+[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
 
 ### Coercion sites
 
@@ -3886,7 +3900,7 @@ Coercion is allowed between the following types:
 
     In the future, coerce_inner will be recursively extended to tuples and
     structs. In addition, coercions from sub-traits to super-traits will be
-    added. See [RFC401] for more details.
+    added. See [RFC 401] for more details.
 
 # Special traits
 
index fb455441910b8ca4f9fca9c98164e1e0320f73c3..354be34b6a2950efe920bd2e44e57efe77e2bf74 100755 (executable)
@@ -49,6 +49,13 @@ if [ -z $TARG_DIR ]; then
     exit 1
 fi
 
+case "$TARG_DIR" in
+--print-rustc-release)
+  # not actually copying to TARG_DIR, just print the local rustc version and exit
+  ${PREFIX}/bin/rustc${BIN_SUF} --version --verbose | sed -ne 's/^release: //p'
+;;
+*)
+
 cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
 cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
 cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
@@ -66,3 +73,5 @@ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DI
 
 # do not fail if one of the above fails, as all we need is a working rustc!
 exit 0
+
+esac
index c52c0b0730be785d8d8aad84bdd68577df4023e3..4a806a3c98602aa224b963e8a862526d3b1b48ef 100644 (file)
@@ -18,7 +18,7 @@
 /// An implementation of SipHash 1-3.
 ///
 /// See: https://131002.net/siphash/
-#[unstable(feature = "sip_hash_13", issue = "29754")]
+#[unstable(feature = "sip_hash_13", issue = "34767")]
 #[derive(Debug, Clone, Default)]
 pub struct SipHasher13 {
     hasher: Hasher<Sip13Rounds>,
@@ -27,7 +27,7 @@ pub struct SipHasher13 {
 /// An implementation of SipHash 2-4.
 ///
 /// See: https://131002.net/siphash/
-#[unstable(feature = "sip_hash_13", issue = "29754")]
+#[unstable(feature = "sip_hash_13", issue = "34767")]
 #[derive(Debug, Clone, Default)]
 pub struct SipHasher24 {
     hasher: Hasher<Sip24Rounds>,
@@ -154,14 +154,14 @@ pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher {
 impl SipHasher13 {
     /// Creates a new `SipHasher13` with the two initial keys set to 0.
     #[inline]
-    #[unstable(feature = "sip_hash_13", issue = "29754")]
+    #[unstable(feature = "sip_hash_13", issue = "34767")]
     pub fn new() -> SipHasher13 {
         SipHasher13::new_with_keys(0, 0)
     }
 
     /// Creates a `SipHasher13` that is keyed off the provided keys.
     #[inline]
-    #[unstable(feature = "sip_hash_13", issue = "29754")]
+    #[unstable(feature = "sip_hash_13", issue = "34767")]
     pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
         SipHasher13 {
             hasher: Hasher::new_with_keys(key0, key1)
@@ -172,14 +172,14 @@ pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
 impl SipHasher24 {
     /// Creates a new `SipHasher24` with the two initial keys set to 0.
     #[inline]
-    #[unstable(feature = "sip_hash_13", issue = "29754")]
+    #[unstable(feature = "sip_hash_13", issue = "34767")]
     pub fn new() -> SipHasher24 {
         SipHasher24::new_with_keys(0, 0)
     }
 
     /// Creates a `SipHasher24` that is keyed off the provided keys.
     #[inline]
-    #[unstable(feature = "sip_hash_13", issue = "29754")]
+    #[unstable(feature = "sip_hash_13", issue = "34767")]
     pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher24 {
         SipHasher24 {
             hasher: Hasher::new_with_keys(key0, key1)
@@ -232,7 +232,7 @@ fn finish(&self) -> u64 {
     }
 }
 
-#[unstable(feature = "sip_hash_13", issue = "29754")]
+#[unstable(feature = "sip_hash_13", issue = "34767")]
 impl super::Hasher for SipHasher13 {
     #[inline]
     fn write(&mut self, msg: &[u8]) {
@@ -245,7 +245,7 @@ fn finish(&self) -> u64 {
     }
 }
 
-#[unstable(feature = "sip_hash_13", issue = "29754")]
+#[unstable(feature = "sip_hash_13", issue = "34767")]
 impl super::Hasher for SipHasher24 {
     #[inline]
     fn write(&mut self, msg: &[u8]) {
index e849369d647c4754967d63f3d7cd627ae0fc8929..0ad1f671f155b8182c038ce0ec8e8ae9483308b7 100644 (file)
@@ -25,6 +25,8 @@
 //!
 //! # How to use the core library
 //!
+//! Please note that all of these details are currently not considered stable.
+//!
 // FIXME: Fill me in with more detail when the interface settles
 //! This library is built on the assumption of a few existing symbols:
 //!
 //!   These functions are often provided by the system libc, but can also be
 //!   provided by the [rlibc crate](https://crates.io/crates/rlibc).
 //!
-//! * `rust_begin_unwind` - This function takes three arguments, a
-//!   `fmt::Arguments`, a `&str`, and a `u32`. These three arguments dictate
-//!   the panic message, the file at which panic was invoked, and the line.
-//!   It is up to consumers of this core library to define this panic
-//!   function; it is only required to never return.
+//! * `rust_begin_panic` - This function takes three arguments, a
+//!   `fmt::Arguments`, a `&'static str`, and a `u32`. These three arguments
+//!   dictate the panic message, the file at which panic was invoked, and the
+//!   line. It is up to consumers of this core library to define this panic
+//!   function; it is only required to never return. This requires a `lang`
+//!   attribute named `panic_fmt`.
 
 // Since libcore defines many fundamental lang items, all tests live in a
 // separate crate, libcoretest, to avoid bizarre issues.
index fcdbde0d19f4f5a1808621423602e199918e1cd0..97648cc34699a9dc6baaf133fa8a28893b2fe74a 100644 (file)
@@ -2318,7 +2318,7 @@ impl usize {
 /// let num = 12.4_f32;
 /// let inf = f32::INFINITY;
 /// let zero = 0f32;
-/// let sub: f32 = 0.000000000000000000000000000000000000011754942;
+/// let sub: f32 = 1.1754942e-38;
 /// let nan = f32::NAN;
 ///
 /// assert_eq!(num.classify(), FpCategory::Normal);