]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #53139 - danc86:riscv-no-gdb-scripts, r=petrochenkov
authorkennytm <kennytm@gmail.com>
Tue, 7 Aug 2018 10:52:20 +0000 (18:52 +0800)
committerkennytm <kennytm@gmail.com>
Tue, 7 Aug 2018 10:52:20 +0000 (18:52 +0800)
set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target

Same as the other embedded targets, see:
https://github.com/rust-lang/rust/pull/49728

This is a temporary workaround for #44993.

45 files changed:
.travis.yml
src/Cargo.lock
src/bootstrap/check.rs
src/bootstrap/compile.rs
src/bootstrap/lib.rs
src/liballoc/boxed.rs
src/libcore/str/mod.rs
src/libcore/task/context.rs
src/libcore/task/executor.rs [deleted file]
src/libcore/task/mod.rs
src/libcore/task/spawn.rs [new file with mode: 0644]
src/librustc/hir/def.rs
src/librustc/hir/map/mod.rs
src/librustc/ich/impls_hir.rs
src/librustc_codegen_llvm/Cargo.toml
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/consts.rs
src/librustc_codegen_llvm/declare.rs
src/librustc_codegen_llvm/llvm/ffi.rs
src/librustc_codegen_llvm/meth.rs
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/constant.rs
src/librustc_codegen_llvm/mir/place.rs
src/librustc_metadata/decoder.rs
src/librustc_mir/diagnostics.rs
src/librustc_save_analysis/lib.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/coherence/builtin.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/rustdoc.css
src/libstd/sync/once.rs
src/libstd/sys/unix/mutex.rs
src/libsyntax/feature_gate.rs
src/libsyntax/parse/token.rs
src/rustllvm/RustWrapper.cpp
src/test/codegen/consts.rs
src/test/codegen/remap_path_prefix/main.rs
src/test/run-make-fulldeps/symbols-are-reasonable/Makefile [deleted file]
src/test/run-make-fulldeps/symbols-are-reasonable/lib.rs [deleted file]
src/test/run-pass-fulldeps/myriad-closures.rs
src/test/run-pass/async-await.rs
src/test/run-pass/futures-api.rs
src/test/run-pass/issue-38226.rs
src/test/run-pass/issue-52169.rs [new file with mode: 0644]
src/test/ui/feature-gate-unwind-attributes.rs

index a860aaa5b7e6b0becc86e9bda37fb674203bbe0d..d010a8370b502b2159ac4ecfe6750d6cda9a9303 100644 (file)
@@ -277,6 +277,8 @@ after_success:
       du . | sort -nr | head -n100
 
 after_failure:
+  # Requested by travis to debug "shutting down NOW" errors
+  - sudo tail -n 500 /var/log/syslog
   - >
       echo "#### Build failed; Disk usage after running script:";
       df -h;
index 7c57cf32d1b14448323ac54edbf321aaad03a5cd..30d56f7656d7d0a00f1974139e0792522bf0390a 100644 (file)
@@ -2184,30 +2184,10 @@ dependencies = [
 name = "rustc_codegen_llvm"
 version = "0.0.0"
 dependencies = [
- "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc 0.0.0",
  "rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc_allocator 0.0.0",
- "rustc_apfloat 0.0.0",
- "rustc_codegen_utils 0.0.0",
- "rustc_data_structures 0.0.0",
- "rustc_errors 0.0.0",
- "rustc_incremental 0.0.0",
  "rustc_llvm 0.0.0",
- "rustc_mir 0.0.0",
- "rustc_platform_intrinsics 0.0.0",
- "rustc_target 0.0.0",
- "serialize 0.0.0",
- "syntax 0.0.0",
- "syntax_pos 0.0.0",
- "tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
index 2f0ae7d9d2cfac31da3407a8a07ee6141c46a4c2..133e5aa37a7db9715e55b83867e8a9ab0ad3fff2 100644 (file)
@@ -137,8 +137,10 @@ fn run(self, builder: &Builder) {
         let target = self.target;
         let backend = self.backend;
 
+        let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
+        builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target));
+
         let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "check");
-        let features = builder.rustc_features().to_string();
         cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
         rustc_cargo_env(builder, &mut cargo);
 
@@ -146,7 +148,7 @@ fn run(self, builder: &Builder) {
 
         let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
         run_cargo(builder,
-                  cargo.arg("--features").arg(features),
+                  &mut cargo,
                   &codegen_backend_stamp(builder, compiler, target, backend),
                   true);
     }
index 8c4f2df60fe6ff1ca0f7576bb91365613987504a..2f8816d111a9d2b4d6f89171d897d8fcca36088b 100644 (file)
@@ -670,16 +670,17 @@ fn run(self, builder: &Builder) {
             return;
         }
 
+        let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
+        builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target));
+
         let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "build");
-        let mut features = builder.rustc_features().to_string();
         cargo.arg("--manifest-path")
             .arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
         rustc_cargo_env(builder, &mut cargo);
 
-        features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
+        let features = build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
 
-        let tmp_stamp = builder.cargo_out(compiler, Mode::Codegen, target)
-            .join(".tmp.stamp");
+        let tmp_stamp = out_dir.join(".tmp.stamp");
 
         let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
         let files = run_cargo(builder,
index 1efff19dfb993a69da84014b34587d77ab484499..38965949bf22f6ce594090aa6c25812c4549f32f 100644 (file)
@@ -555,8 +555,8 @@ fn stage_out(&self, compiler: Compiler, mode: Mode) -> PathBuf {
         let suffix = match mode {
             Mode::Std => "-std",
             Mode::Test => "-test",
-            Mode::Codegen => "-rustc",
             Mode::Rustc => "-rustc",
+            Mode::Codegen => "-codegen",
             Mode::ToolBootstrap => "-bootstrap-tools",
             Mode::ToolStd => "-tools",
             Mode::ToolRustc => "-tools",
index 2cf9b13a67a2750754b0f98070a52aec2e979d34..08db5136d040450c0164841ed8fed83d0be2ad1f 100644 (file)
@@ -67,7 +67,7 @@
 use core::mem::{self, PinMut};
 use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
 use core::ptr::{self, NonNull, Unique};
-use core::task::{Context, Poll, Executor, SpawnErrorKind, SpawnObjError};
+use core::task::{Context, Poll, Spawn, SpawnErrorKind, SpawnObjError};
 
 use raw_vec::RawVec;
 use str::from_boxed_utf8_unchecked;
@@ -973,11 +973,14 @@ unsafe fn drop(ptr: *mut ()) {
 }
 
 #[unstable(feature = "futures_api", issue = "50547")]
-impl<E> Executor for Box<E>
-    where E: Executor + ?Sized
+impl<Sp> Spawn for Box<Sp>
+    where Sp: Spawn + ?Sized
 {
-    fn spawn_obj(&mut self, task: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
-        (**self).spawn_obj(task)
+    fn spawn_obj(
+        &mut self,
+        future: FutureObj<'static, ()>,
+    ) -> Result<(), SpawnObjError> {
+        (**self).spawn_obj(future)
     }
 
     fn status(&self) -> Result<(), SpawnErrorKind> {
index 86b8349fa3c89cd1894f39d8172b4d02e9465873..356534a91879cde36e2ef26405b6e1030c910a7b 100644 (file)
@@ -2117,8 +2117,6 @@ impl str {
     /// This length is in bytes, not [`char`]s or graphemes. In other words,
     /// it may not be what a human considers the length of the string.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -2590,8 +2588,6 @@ pub fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) {
     /// Value, and may not match your idea of what a 'character' is. Iteration
     /// over grapheme clusters may be what you actually want.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -2643,8 +2639,6 @@ pub fn chars(&self) -> Chars {
     /// The iterator yields tuples. The position is first, the [`char`] is
     /// second.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -2946,7 +2940,6 @@ pub fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool
     /// The pattern can be a `&str`, [`char`], or a closure that determines if
     /// a character matches.
     ///
-    /// [`char`]: primitive.char.html
     /// [`None`]: option/enum.Option.html#variant.None
     ///
     /// # Examples
@@ -2994,7 +2987,6 @@ pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> {
     /// The pattern can be a `&str`, [`char`], or a closure that determines if
     /// a character matches.
     ///
-    /// [`char`]: primitive.char.html
     /// [`None`]: option/enum.Option.html#variant.None
     ///
     /// # Examples
@@ -3050,7 +3042,6 @@ pub fn rfind<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>
     /// If the pattern allows a reverse search but its results might differ
     /// from a forward search, the [`rsplit`] method can be used.
     ///
-    /// [`char`]: primitive.char.html
     /// [`rsplit`]: #method.rsplit
     ///
     /// # Examples
@@ -3157,8 +3148,6 @@ pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> {
     /// The pattern can be a `&str`, [`char`], or a closure that determines the
     /// split.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator requires that the pattern supports a reverse
@@ -3224,7 +3213,6 @@ pub fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P>
     /// elements. This is true for, eg, [`char`] but not for `&str`.
     ///
     /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
-    /// [`char`]: primitive.char.html
     ///
     /// If the pattern allows a reverse search but its results might differ
     /// from a forward search, the [`rsplit_terminator`] method can be used.
@@ -3259,8 +3247,6 @@ pub fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator
     /// Additional libraries might provide more complex patterns like
     /// regular expressions.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// Equivalent to [`split`], except that the trailing substring is
     /// skipped if empty.
     ///
@@ -3306,8 +3292,6 @@ pub fn rsplit_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplitTerminat
     /// The pattern can be a `&str`, [`char`], or a closure that determines the
     /// split.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator will not be double ended, because it is
@@ -3361,8 +3345,6 @@ pub fn splitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> SplitN<'a, P> {
     /// The pattern can be a `&str`, [`char`], or a closure that
     /// determines the split.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator will not be double ended, because it is not
@@ -3407,8 +3389,6 @@ pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> RSplitN<'a, P>
     /// The pattern can be a `&str`, [`char`], or a closure that
     /// determines if a character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator will be a [`DoubleEndedIterator`] if the pattern
@@ -3416,7 +3396,6 @@ pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> RSplitN<'a, P>
     /// elements. This is true for, eg, [`char`] but not for `&str`.
     ///
     /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
-    /// [`char`]: primitive.char.html
     ///
     /// If the pattern allows a reverse search but its results might differ
     /// from a forward search, the [`rmatches`] method can be used.
@@ -3446,8 +3425,6 @@ pub fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P> {
     /// The pattern can be a `&str`, [`char`], or a closure that determines if
     /// a character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator requires that the pattern supports a reverse
@@ -3488,8 +3465,6 @@ pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P>
     /// The pattern can be a `&str`, [`char`], or a closure that determines
     /// if a character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator will be a [`DoubleEndedIterator`] if the pattern
@@ -3532,8 +3507,6 @@ pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P
     /// The pattern can be a `&str`, [`char`], or a closure that determines if a
     /// character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Iterator behavior
     ///
     /// The returned iterator requires that the pattern supports a reverse
@@ -3665,8 +3638,6 @@ pub fn trim_right(&self) -> &str {
     /// The pattern can be a [`char`] or a closure that determines if a
     /// character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Examples
     ///
     /// Simple patterns:
@@ -3711,8 +3682,6 @@ pub fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
     /// The pattern can be a `&str`, [`char`], or a closure that determines if
     /// a character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Text directionality
     ///
     /// A string is a sequence of bytes. 'Left' in this context means the first
@@ -3750,8 +3719,6 @@ pub fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str {
     /// The pattern can be a `&str`, [`char`], or a closure that
     /// determines if a character matches.
     ///
-    /// [`char`]: primitive.char.html
-    ///
     /// # Text directionality
     ///
     /// A string is a sequence of bytes. 'Right' in this context means the last
index 121f93b666bcecbe3dbe4e180e1a68e5fa33473b..5a29c8528ef3a0801c9a467a4f1ec21d5abd267c 100644 (file)
@@ -13,7 +13,7 @@
             issue = "50547")]
 
 use fmt;
-use super::{Executor, Waker, LocalWaker};
+use super::{Spawn, Waker, LocalWaker};
 
 /// Information about the currently-running task.
 ///
@@ -21,7 +21,7 @@
 /// when performing a single `poll` step on a task.
 pub struct Context<'a> {
     local_waker: &'a LocalWaker,
-    executor: &'a mut dyn Executor,
+    spawner: &'a mut dyn Spawn,
 }
 
 impl<'a> fmt::Debug for Context<'a> {
@@ -32,13 +32,14 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl<'a> Context<'a> {
-    /// Create a new task `Context` with the provided `local_waker`, `waker`, and `executor`.
+    /// Create a new task `Context` with the provided `local_waker`, `waker`,
+    /// and `spawner`.
     #[inline]
-    pub fn new(local_waker: &'a LocalWaker, executor: &'a mut dyn Executor) -> Context<'a> {
-        Context {
-            local_waker,
-            executor,
-        }
+    pub fn new(
+        local_waker: &'a LocalWaker,
+        spawner: &'a mut dyn Spawn,
+    ) -> Context<'a> {
+        Context { local_waker, spawner }
     }
 
     /// Get the `LocalWaker` associated with the current task.
@@ -53,40 +54,45 @@ pub fn waker(&self) -> &'a Waker {
         unsafe { &*(self.local_waker as *const LocalWaker as *const Waker) }
     }
 
-    /// Get the default executor associated with this task.
+    /// Get the spawner associated with this task.
     ///
     /// This method is useful primarily if you want to explicitly handle
     /// spawn failures.
     #[inline]
-    pub fn executor(&mut self) -> &mut dyn Executor {
-        self.executor
+    pub fn spawner(&mut self) -> &mut dyn Spawn {
+        self.spawner
     }
 
-    /// Produce a context like the current one, but using the given waker instead.
+    /// Produce a context like the current one, but using the given waker
+    /// instead.
     ///
     /// This advanced method is primarily used when building "internal
     /// schedulers" within a task, where you want to provide some customized
     /// wakeup logic.
     #[inline]
-    pub fn with_waker<'b>(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b> {
+    pub fn with_waker<'b>(
+        &'b mut self,
+        local_waker: &'b LocalWaker,
+    ) -> Context<'b> {
         Context {
             local_waker,
-            executor: self.executor,
+            spawner: self.spawner,
         }
     }
 
-    /// Produce a context like the current one, but using the given executor
+    /// Produce a context like the current one, but using the given spawner
     /// instead.
     ///
     /// This advanced method is primarily used when building "internal
     /// schedulers" within a task.
     #[inline]
-    pub fn with_executor<'b, E>(&'b mut self, executor: &'b mut E) -> Context<'b>
-        where E: Executor
-    {
+    pub fn with_spawner<'b, Sp: Spawn>(
+        &'b mut self,
+        spawner: &'b mut Sp,
+    ) -> Context<'b> {
         Context {
             local_waker: self.local_waker,
-            executor,
+            spawner,
         }
     }
 }
diff --git a/src/libcore/task/executor.rs b/src/libcore/task/executor.rs
deleted file mode 100644 (file)
index affcbf4..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![unstable(feature = "futures_api",
-            reason = "futures in libcore are unstable",
-            issue = "50547")]
-
-use fmt;
-use future::{FutureObj, LocalFutureObj};
-
-/// A task executor.
-///
-/// Futures are polled until completion by tasks, a kind of lightweight
-/// "thread". A *task executor* is responsible for the creation of these tasks
-/// and the coordination of their execution on real operating system threads. In
-/// particular, whenever a task signals that it can make further progress via a
-/// wake-up notification, it is the responsibility of the task executor to put
-/// the task into a queue to continue executing it, i.e. polling the future in
-/// it, later.
-pub trait Executor {
-    /// Spawns a new task with the given future. The future will be polled until
-    /// completion.
-    ///
-    /// # Errors
-    ///
-    /// The executor may be unable to spawn tasks, either because it has
-    /// been shut down or is resource-constrained.
-    fn spawn_obj(
-        &mut self,
-        future: FutureObj<'static, ()>,
-    ) -> Result<(), SpawnObjError>;
-
-    /// Determines whether the executor is able to spawn new tasks.
-    ///
-    /// # Returns
-    ///
-    /// An `Ok` return means the executor is *likely* (but not guaranteed)
-    /// to accept a subsequent spawn attempt. Likewise, an `Err` return
-    /// means that `spawn` is likely, but not guaranteed, to yield an error.
-    #[inline]
-    fn status(&self) -> Result<(), SpawnErrorKind> {
-        Ok(())
-    }
-}
-
-/// Provides the reason that an executor was unable to spawn.
-pub struct SpawnErrorKind {
-    _hidden: (),
-}
-
-impl fmt::Debug for SpawnErrorKind {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("SpawnErrorKind")
-            .field(&"shutdown")
-            .finish()
-    }
-}
-
-impl SpawnErrorKind {
-    /// Spawning is failing because the executor has been shut down.
-    pub fn shutdown() -> SpawnErrorKind {
-        SpawnErrorKind { _hidden: () }
-    }
-
-    /// Check whether this error is the `shutdown` error.
-    pub fn is_shutdown(&self) -> bool {
-        true
-    }
-}
-
-/// The result of a failed spawn
-#[derive(Debug)]
-pub struct SpawnObjError {
-    /// The kind of error
-    pub kind: SpawnErrorKind,
-
-    /// The future for which spawning inside a task was attempted
-    pub future: FutureObj<'static, ()>,
-}
-
-/// The result of a failed spawn
-#[derive(Debug)]
-pub struct SpawnLocalObjError {
-    /// The kind of error
-    pub kind: SpawnErrorKind,
-
-    /// The future for which spawning inside a task was attempted
-    pub future: LocalFutureObj<'static, ()>,
-}
index c4f075361640f1b887e099b8c797b0ded7082265..f51e5f7ce0e311d3a37e07589e2f1cd984cd59fd 100644 (file)
 mod context;
 pub use self::context::Context;
 
-mod executor;
-pub use self::executor::{
-  Executor, SpawnErrorKind, SpawnObjError, SpawnLocalObjError
-};
+mod spawn;
+pub use self::spawn::{Spawn, SpawnErrorKind, SpawnObjError, SpawnLocalObjError};
 
 mod poll;
 pub use self::poll::Poll;
diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs
new file mode 100644 (file)
index 0000000..58ee85d
--- /dev/null
@@ -0,0 +1,93 @@
+// 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.
+
+#![unstable(feature = "futures_api",
+            reason = "futures in libcore are unstable",
+            issue = "50547")]
+
+use fmt;
+use future::{FutureObj, LocalFutureObj};
+
+/// Spawns tasks that poll futures to completion onto its associated task
+/// executor.
+///
+/// The term "task" refers to a kind of lightweight "thread". Task executors
+/// are responsible for scheduling the execution of tasks on operating system
+/// threads.
+pub trait Spawn {
+    /// Spawns a new task with the given future. The future will be polled until
+    /// completion.
+    ///
+    /// # Errors
+    ///
+    /// The executor may be unable to spawn tasks, either because it has
+    /// been shut down or is resource-constrained.
+    fn spawn_obj(
+        &mut self,
+        future: FutureObj<'static, ()>,
+    ) -> Result<(), SpawnObjError>;
+
+    /// Determines whether the executor is able to spawn new tasks.
+    ///
+    /// # Returns
+    ///
+    /// An `Ok` return means the executor is *likely* (but not guaranteed)
+    /// to accept a subsequent spawn attempt. Likewise, an `Err` return
+    /// means that `spawn` is likely, but not guaranteed, to yield an error.
+    #[inline]
+    fn status(&self) -> Result<(), SpawnErrorKind> {
+        Ok(())
+    }
+}
+
+/// Provides the reason that an executor was unable to spawn.
+pub struct SpawnErrorKind {
+    _hidden: (),
+}
+
+impl fmt::Debug for SpawnErrorKind {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("SpawnErrorKind")
+            .field(&"shutdown")
+            .finish()
+    }
+}
+
+impl SpawnErrorKind {
+    /// Spawning is failing because the executor has been shut down.
+    pub fn shutdown() -> SpawnErrorKind {
+        SpawnErrorKind { _hidden: () }
+    }
+
+    /// Check whether this error is the `shutdown` error.
+    pub fn is_shutdown(&self) -> bool {
+        true
+    }
+}
+
+/// The result of a failed spawn
+#[derive(Debug)]
+pub struct SpawnObjError {
+    /// The kind of error
+    pub kind: SpawnErrorKind,
+
+    /// The future for which spawning inside a task was attempted
+    pub future: FutureObj<'static, ()>,
+}
+
+/// The result of a failed spawn
+#[derive(Debug)]
+pub struct SpawnLocalObjError {
+    /// The kind of error
+    pub kind: SpawnErrorKind,
+
+    /// The future for which spawning inside a task was attempted
+    pub future: LocalFutureObj<'static, ()>,
+}
index cb5e1e600d3d2e8659b21d7bdcc8cc84231dd5a3..b297accc75fd5a2a100df19f7525a62a6329ec73 100644 (file)
@@ -70,8 +70,6 @@ pub enum Def {
     Macro(DefId, MacroKind),
     NonMacroAttr, // e.g. `#[inline]` or `#[rustfmt::skip]`
 
-    GlobalAsm(DefId),
-
     // Both namespaces
     Err,
 }
@@ -251,8 +249,7 @@ pub fn def_id(&self) -> DefId {
             Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
             Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
             Def::AssociatedConst(id) | Def::Macro(id, ..) |
-            Def::Existential(id) | Def::AssociatedExistential(id) |
-            Def::GlobalAsm(id) | Def::TyForeign(id) => {
+            Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => {
                 id
             }
 
@@ -302,7 +299,6 @@ pub fn kind_name(&self) -> &'static str {
             Def::Label(..) => "label",
             Def::SelfTy(..) => "self type",
             Def::Macro(.., macro_kind) => macro_kind.descr(),
-            Def::GlobalAsm(..) => "global asm",
             Def::ToolMod => "tool module",
             Def::NonMacroAttr => "non-macro attribute",
             Def::Err => "unresolved item",
index 49231e58cf0fc574d39cad754c6f46cea58dbf22..b05bcadf82649daa57cb8573a60d2a613ce8263a 100644 (file)
@@ -432,7 +432,6 @@ pub fn describe_def(&self, node_id: NodeId) -> Option<Def> {
                     ItemKind::Const(..) => Some(Def::Const(def_id())),
                     ItemKind::Fn(..) => Some(Def::Fn(def_id())),
                     ItemKind::Mod(..) => Some(Def::Mod(def_id())),
-                    ItemKind::GlobalAsm(..) => Some(Def::GlobalAsm(def_id())),
                     ItemKind::Existential(..) => Some(Def::Existential(def_id())),
                     ItemKind::Ty(..) => Some(Def::TyAlias(def_id())),
                     ItemKind::Enum(..) => Some(Def::Enum(def_id())),
@@ -445,6 +444,7 @@ pub fn describe_def(&self, node_id: NodeId) -> Option<Def> {
                     ItemKind::ExternCrate(_) |
                     ItemKind::Use(..) |
                     ItemKind::ForeignMod(..) |
+                    ItemKind::GlobalAsm(..) |
                     ItemKind::Impl(..) => None,
                 }
             }
index fe87053681ae8b6d735eda1243fdab00e9bae532..69872cffdc1b1ea54891628ce55e3583690f1d7c 100644 (file)
@@ -1015,7 +1015,6 @@ fn to_stable_hash_key(&self,
     Upvar(def_id, index, expr_id),
     Label(node_id),
     Macro(def_id, macro_kind),
-    GlobalAsm(def_id),
     ToolMod,
     NonMacroAttr,
     Err
index 6ddae57e336ede3c2059cf1105b1a35ca1701d4c..28fa49846b7369de67024aacf0ac81e4121952b4 100644 (file)
@@ -10,39 +10,12 @@ crate-type = ["dylib"]
 test = false
 
 [dependencies]
-bitflags = "1.0.1"
 cc = "1.0.1"
-flate2 = "1.0"
-jobserver = "0.1.5"
-libc = "0.2"
-log = "0.4"
 num_cpus = "1.0"
-rustc = { path = "../librustc" }
 rustc-demangle = "0.1.4"
-rustc_allocator = { path = "../librustc_allocator" }
-rustc_apfloat = { path = "../librustc_apfloat" }
-rustc_target = { path = "../librustc_target" }
-rustc_data_structures = { path = "../librustc_data_structures" }
-rustc_errors = { path = "../librustc_errors" }
-rustc_incremental = { path = "../librustc_incremental" }
 rustc_llvm = { path = "../librustc_llvm" }
-rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }
-rustc_codegen_utils = { path = "../librustc_codegen_utils" }
-rustc_mir = { path = "../librustc_mir" }
-serialize = { path = "../libserialize" }
-syntax = { path = "../libsyntax" }
-syntax_pos = { path = "../libsyntax_pos" }
-tempfile = "3.0"
-
-# not actually used but needed to make sure we enable the same feature set as
-# winapi used in librustc
-env_logger = { version = "0.5", default-features = false }
 
 [features]
-# Used to communicate the feature to `rustc_target` in the same manner that the
-# `rustc` driver script communicate this.
-jemalloc = ["rustc_target/jemalloc"]
-
 # This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm`
 # when this option is enabled or not. That way we can build two, cache two
 # artifacts, and have nice speedy rebuilds.
index a5c6a0d5cd690e4828b2b4595db3220b9a7cb291..5e23c6e868f47200e2a4d2131ae18dfee4bf357c 100644 (file)
@@ -541,11 +541,23 @@ unsafe fn optimize(cgcx: &CodegenContext,
             };
 
             if config.verify_llvm_ir { assert!(addpass("verify")); }
+
+            // Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need
+            // to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise
+            // we'll get errors in LLVM.
+            let using_thin_buffers = llvm::LLVMRustThinLTOAvailable() && (config.emit_bc
+                || config.obj_is_bitcode || config.emit_bc_compressed || config.embed_bitcode);
+            let mut have_name_anon_globals_pass = false;
             if !config.no_prepopulate_passes {
                 llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
                 llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
                 let opt_level = config.opt_level.unwrap_or(llvm::CodeGenOptLevel::None);
                 let prepare_for_thin_lto = cgcx.lto == Lto::Thin || cgcx.lto == Lto::ThinLocal;
+                have_name_anon_globals_pass = have_name_anon_globals_pass || prepare_for_thin_lto;
+                if using_thin_buffers && !prepare_for_thin_lto {
+                    assert!(addpass("name-anon-globals"));
+                    have_name_anon_globals_pass = true;
+                }
                 with_llvm_pmb(llmod, &config, opt_level, prepare_for_thin_lto, &mut |b| {
                     llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(b, fpm);
                     llvm::LLVMPassManagerBuilderPopulateModulePassManager(b, mpm);
@@ -557,6 +569,9 @@ unsafe fn optimize(cgcx: &CodegenContext,
                     diag_handler.warn(&format!("unknown pass `{}`, ignoring",
                                             pass));
                 }
+                if pass == "name-anon-globals" {
+                    have_name_anon_globals_pass = true;
+                }
             }
 
             for pass in &cgcx.plugin_passes {
@@ -565,6 +580,22 @@ unsafe fn optimize(cgcx: &CodegenContext,
                                             `{}` but LLVM does not \
                                             recognize it", pass));
                 }
+                if pass == "name-anon-globals" {
+                    have_name_anon_globals_pass = true;
+                }
+            }
+
+            if using_thin_buffers && !have_name_anon_globals_pass {
+                // As described above, this will probably cause an error in LLVM
+                if config.no_prepopulate_passes {
+                    diag_handler.err("The current compilation is going to use thin LTO buffers \
+                                     without running LLVM's NameAnonGlobals pass. \
+                                     This will likely cause errors in LLVM. Consider adding \
+                                     -C passes=name-anon-globals to the compiler command line.");
+                } else {
+                    bug!("We are using thin LTO buffers without running the NameAnonGlobals pass. \
+                         This will likely cause errors in LLVM and shoud never happen.");
+                }
             }
         }
 
index 72ff65361cada9d3e6974d100f27f1a61f2f76fe..21bf490beb0fb352c1d3168e5d3dca675d345ca8 100644 (file)
@@ -66,16 +66,22 @@ pub fn addr_of_mut(
     cx: &CodegenCx<'ll, '_>,
     cv: &'ll Value,
     align: Align,
-    kind: &str,
+    kind: Option<&str>,
 ) -> &'ll Value {
     unsafe {
-        let name = cx.generate_local_symbol_name(kind);
-        let gv = declare::define_global(cx, &name[..], val_ty(cv)).unwrap_or_else(||{
-            bug!("symbol `{}` is already defined", name);
-        });
+        let gv = match kind {
+            Some(kind) if !cx.tcx.sess.fewer_names() => {
+                let name = cx.generate_local_symbol_name(kind);
+                let gv = declare::define_global(cx, &name[..], val_ty(cv)).unwrap_or_else(||{
+                    bug!("symbol `{}` is already defined", name);
+                });
+                llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
+                gv
+            },
+            _ => declare::define_private_global(cx, val_ty(cv)),
+        };
         llvm::LLVMSetInitializer(gv, cv);
         set_global_alignment(cx, gv, align);
-        llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
         SetUnnamedAddr(gv, true);
         gv
     }
@@ -85,7 +91,7 @@ pub fn addr_of(
     cx: &CodegenCx<'ll, '_>,
     cv: &'ll Value,
     align: Align,
-    kind: &str,
+    kind: Option<&str>,
 ) -> &'ll Value {
     if let Some(&gv) = cx.const_globals.borrow().get(&cv) {
         unsafe {
index 9812d7f9a41a21cc81ad0642606fa13e700b4505..a0310eecd591d4f30da92605628f54eb4dfb34a5 100644 (file)
@@ -35,7 +35,6 @@
 
 use std::ffi::CString;
 
-
 /// Declare a global value.
 ///
 /// If there’s a value with the same name already declared, the function will
@@ -170,6 +169,15 @@ pub fn define_global(cx: &CodegenCx<'ll, '_>, name: &str, ty: &'ll Type) -> Opti
     }
 }
 
+/// Declare a private global
+///
+/// Use this function when you intend to define a global without a name.
+pub fn define_private_global(cx: &CodegenCx<'ll, '_>, ty: &'ll Type) -> &'ll Value {
+    unsafe {
+        llvm::LLVMRustInsertPrivateGlobal(cx.llmod, ty)
+    }
+}
+
 /// Declare a Rust function with an intention to define it.
 ///
 /// Use this function when you intend to define a function. This function will
index 989498ea92bcefd770af80cee557ac8f6741648b..a894f8e2fdb96a95686ceec3986ba3b4308870ba 100644 (file)
@@ -623,6 +623,7 @@ pub fn LLVMConstExtractValue(AggConstant: &Value,
     pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
     pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
     pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
+    pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
     pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
     pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
     pub fn LLVMDeleteGlobal(GlobalVar: &Value);
index 9c0dd0dc3d8b54f54e5409c381c7cdeb3d68467e..8a1159bc4773cfa4f231d309eb665cd1281044f4 100644 (file)
@@ -106,7 +106,7 @@ pub fn get_vtable(
 
     let vtable_const = C_struct(cx, &components, false);
     let align = cx.data_layout().pointer_align;
-    let vtable = consts::addr_of(cx, vtable_const, align, "vtable");
+    let vtable = consts::addr_of(cx, vtable_const, align, Some("vtable"));
 
     debuginfo::create_vtable_metadata(cx, ty, vtable);
 
index 684ecfaeec8f159d858f736e22b2d45b6a6699cd..4e389c3b915f011ebb4eb35a1f59dc2a2c7b7a45 100644 (file)
@@ -377,7 +377,7 @@ fn codegen_terminator(&mut self,
                         let file_line_col = consts::addr_of(bx.cx,
                                                             file_line_col,
                                                             align,
-                                                            "panic_bounds_check_loc");
+                                                            Some("panic_bounds_check_loc"));
                         (lang_items::PanicBoundsCheckFnLangItem,
                          vec![file_line_col, index, len])
                     }
@@ -391,7 +391,7 @@ fn codegen_terminator(&mut self,
                         let msg_file_line_col = consts::addr_of(bx.cx,
                                                                 msg_file_line_col,
                                                                 align,
-                                                                "panic_loc");
+                                                                Some("panic_loc"));
                         (lang_items::PanicFnLangItem,
                          vec![msg_file_line_col])
                     }
index 267db4467c21a23e376e7c89c9099404c000628d..a6e14a99f3c8eafe156d2756b59095c21cccc907 100644 (file)
@@ -58,9 +58,9 @@ pub fn scalar_to_llvm(
                 Some(AllocType::Memory(alloc)) => {
                     let init = const_alloc_to_llvm(cx, alloc);
                     if alloc.runtime_mutability == Mutability::Mutable {
-                        consts::addr_of_mut(cx, init, alloc.align, "byte_str")
+                        consts::addr_of_mut(cx, init, alloc.align, None)
                     } else {
-                        consts::addr_of(cx, init, alloc.align, "byte_str")
+                        consts::addr_of(cx, init, alloc.align, None)
                     }
                 }
                 Some(AllocType::Function(fn_instance)) => {
index abc3dbdab2f5b04d307bfce1424d717814499cf1..6fa0845dd0cebf14d45e56f5e6bcdf8b64675acf 100644 (file)
@@ -63,7 +63,7 @@ pub fn from_const_alloc(
         offset: Size,
     ) -> PlaceRef<'ll, 'tcx> {
         let init = const_alloc_to_llvm(bx.cx, alloc);
-        let base_addr = consts::addr_of(bx.cx, init, layout.align, "byte_str");
+        let base_addr = consts::addr_of(bx.cx, init, layout.align, None);
 
         let llval = unsafe { LLVMConstInBoundsGEP(
             consts::bitcast(base_addr, Type::i8p(bx.cx)),
index 45a61ec33085d2345e1fde4d47ce1fc1b3688a4f..5121b682d36a736a60702a6dfbe16bde1687d945 100644 (file)
@@ -427,10 +427,10 @@ fn to_def(&self, did: DefId) -> Option<Def> {
             EntryKind::Trait(_) => Def::Trait(did),
             EntryKind::Enum(..) => Def::Enum(did),
             EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang),
-            EntryKind::GlobalAsm => Def::GlobalAsm(did),
             EntryKind::ForeignType => Def::TyForeign(did),
 
             EntryKind::ForeignMod |
+            EntryKind::GlobalAsm |
             EntryKind::Impl(_) |
             EntryKind::Field |
             EntryKind::Generator(_) |
index 3c751d52b066498f93102a1aaf04c57bf2f9669c..714218a04178ed26059396cc5b6fc0908ba48c3f 100644 (file)
@@ -1281,9 +1281,7 @@ struct C { a: Cell<usize> }
 ```
 
 This is because cell types do operations that are not thread-safe. Due to this,
-they don't implement Sync and thus can't be placed in statics. In this
-case, `StaticMutex` would work just fine, but it isn't stable yet:
-https://doc.rust-lang.org/nightly/std/sync/struct.StaticMutex.html
+they don't implement Sync and thus can't be placed in statics.
 
 However, if you still wish to use these types, you can achieve this by an unsafe
 wrapper:
index 6e49951ff298ac652ffd9a841ca50b6e7b20ffde..3fada8d4aa88087fc434b8a1e84857bdf52f4757 100644 (file)
@@ -810,7 +810,6 @@ fn fn_type(path: &ast::Path) -> bool {
             HirDef::SelfTy(..) |
             HirDef::Label(..) |
             HirDef::Macro(..) |
-            HirDef::GlobalAsm(..) |
             HirDef::ToolMod |
             HirDef::NonMacroAttr |
             HirDef::Err => None,
index 0ca92d724b55934e1717a593f6cd9f24b0b4ae13..546553ac2455de6dd5ad1e038b6c2a3fa8fb59e2 100644 (file)
@@ -68,9 +68,7 @@ pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
     if let Err(ErrorReported) = compare_synthetic_generics(tcx,
                                                            impl_m,
-                                                           impl_m_span,
-                                                           trait_m,
-                                                           trait_item_span) {
+                                                           trait_m) {
         return;
     }
 
@@ -729,14 +727,11 @@ trait `{}` has {}",
 
 fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                         impl_m: &ty::AssociatedItem,
-                                        _impl_m_span: Span, // FIXME necessary?
-                                        trait_m: &ty::AssociatedItem,
-                                        _trait_item_span: Option<Span>) // FIXME necessary?
+                                        trait_m: &ty::AssociatedItem)
                                         -> Result<(), ErrorReported> {
     // FIXME(chrisvittal) Clean up this function, list of FIXME items:
     //     1. Better messages for the span labels
     //     2. Explanation as to what is going on
-    //     3. Correct the function signature for what we actually use
     // If we get here, we already have the same number of generics, so the zip will
     // be okay.
     let mut error_found = false;
index 4d9a4a03a6b50326bdc92c48f9dfdc8a3657dba3..ba65d0606b37267ee00a4f837b1b420628b707e6 100644 (file)
@@ -41,21 +41,19 @@ struct Checker<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx> Checker<'a, 'tcx> {
     fn check<F>(&self, trait_def_id: Option<DefId>, mut f: F) -> &Self
-        where F: FnMut(TyCtxt<'a, 'tcx, 'tcx>, DefId, DefId)
+        where F: FnMut(TyCtxt<'a, 'tcx, 'tcx>, DefId)
     {
         if Some(self.trait_def_id) == trait_def_id {
             for &impl_id in self.tcx.hir.trait_impls(self.trait_def_id) {
                 let impl_def_id = self.tcx.hir.local_def_id(impl_id);
-                f(self.tcx, self.trait_def_id, impl_def_id);
+                f(self.tcx, impl_def_id);
             }
         }
         self
     }
 }
 
-fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                          _drop_did: DefId,
-                                          impl_did: DefId) {
+fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) {
     match tcx.type_of(impl_did).sty {
         ty::TyAdt(..) => {}
         _ => {
@@ -87,9 +85,7 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 }
 
-fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                          _copy_did: DefId,
-                                          impl_did: DefId) {
+fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) {
     debug!("visit_implementation_of_copy: impl_did={:?}", impl_did);
 
     let impl_node_id = if let Some(n) = tcx.hir.as_local_node_id(impl_did) {
@@ -157,9 +153,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 }
 
-fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                                    _: DefId,
-                                                    impl_did: DefId) {
+fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) {
     debug!("visit_implementation_of_coerce_unsized: impl_did={:?}",
            impl_did);
 
index c2978a62489a0d86bd787212f9abc144d2d4dc81..470aa2c10e977898f31b54d6c95d3c17c68dc33c 100644 (file)
@@ -1613,7 +1613,6 @@ impl fmt::Display for AllTypes {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f,
 "<h1 class='fqn'>\
-     <span class='in-band'>List of all items</span>\
      <span class='out-of-band'>\
          <span id='render-detail'>\
              <a id=\"toggle-all-docs\" href=\"javascript:void(0)\" title=\"collapse all docs\">\
@@ -1621,6 +1620,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
              </a>\
          </span>
      </span>
+     <span class='in-band'>List of all items</span>\
 </h1>")?;
         print_entries(f, &self.structs, "Structs", "structs")?;
         print_entries(f, &self.enums, "Enums", "enums")?;
@@ -2068,7 +2068,34 @@ impl<'a> fmt::Display for Item<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         debug_assert!(!self.item.is_stripped());
         // Write the breadcrumb trail header for the top
-        write!(fmt, "<h1 class='fqn'><span class='in-band'>")?;
+        write!(fmt, "<h1 class='fqn'><span class='out-of-band'>")?;
+        if let Some(version) = self.item.stable_since() {
+            write!(fmt, "<span class='since' title='Stable since Rust version {0}'>{0}</span>",
+                   version)?;
+        }
+        write!(fmt,
+               "<span id='render-detail'>\
+                   <a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \
+                      title=\"collapse all docs\">\
+                       [<span class='inner'>&#x2212;</span>]\
+                   </a>\
+               </span>")?;
+
+        // Write `src` tag
+        //
+        // When this item is part of a `pub use` in a downstream crate, the
+        // [src] link in the downstream documentation will actually come back to
+        // this page, and this link will be auto-clicked. The `id` attribute is
+        // used to find the link to auto-click.
+        if self.cx.shared.include_sources && !self.item.is_primitive() {
+            if let Some(l) = self.src_href() {
+                write!(fmt, "<a class='srclink' href='{}' title='{}'>[src]</a>",
+                       l, "goto source code")?;
+            }
+        }
+
+        write!(fmt, "</span>")?; // out-of-band
+        write!(fmt, "<span class='in-band'>")?;
         match self.item.inner {
             clean::ModuleItem(ref m) => if m.is_crate {
                     write!(fmt, "Crate ")?;
@@ -2105,34 +2132,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         write!(fmt, "<a class=\"{}\" href=''>{}</a>",
                self.item.type_(), self.item.name.as_ref().unwrap())?;
 
-        write!(fmt, "</span>")?; // in-band
-        write!(fmt, "<span class='out-of-band'>")?;
-        if let Some(version) = self.item.stable_since() {
-            write!(fmt, "<span class='since' title='Stable since Rust version {0}'>{0}</span>",
-                   version)?;
-        }
-        write!(fmt,
-               "<span id='render-detail'>\
-                   <a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \
-                      title=\"collapse all docs\">\
-                       [<span class='inner'>&#x2212;</span>]\
-                   </a>\
-               </span>")?;
-
-        // Write `src` tag
-        //
-        // When this item is part of a `pub use` in a downstream crate, the
-        // [src] link in the downstream documentation will actually come back to
-        // this page, and this link will be auto-clicked. The `id` attribute is
-        // used to find the link to auto-click.
-        if self.cx.shared.include_sources && !self.item.is_primitive() {
-            if let Some(l) = self.src_href() {
-                write!(fmt, "<a class='srclink' href='{}' title='{}'>[src]</a>",
-                       l, "goto source code")?;
-            }
-        }
-
-        write!(fmt, "</span></h1>")?; // out-of-band
+        write!(fmt, "</span></h1>")?; // in-band
 
         match self.item.inner {
             clean::ModuleItem(ref m) =>
index 496029e33fc65cebf2541ec3155aa68b1a788d5a..57a111daa897718b5920d831350a3a228f992716 100644 (file)
@@ -97,7 +97,7 @@ h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.important), h4
 h1.fqn {
        border-bottom: 1px dashed;
        margin-top: 0;
-       position: relative;
+       overflow: auto;
 }
 h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) {
        border-bottom: 1px solid;
@@ -352,14 +352,11 @@ nav.sub {
 }
 
 .content .out-of-band {
+       float: right;
        font-size: 23px;
        margin: 0px;
        padding: 0px;
-       text-align: right;
-       display: inline-block;
        font-weight: normal;
-       position: absolute;
-       right: 0;
 }
 
 h3.impl > .out-of-band {
index 3abc260b4586878b8d17b139e1a2e8387c2d20e1..f6cb8beae84158e6fe6715676c16d60d420b2794 100644 (file)
 // initialization closure panics, the Once enters a "poisoned" state which means
 // that all future calls will immediately panic as well.
 //
-// So to implement this, one might first reach for a `StaticMutex`, but those
-// unfortunately need to be deallocated (e.g. call `destroy()`) to free memory
-// on all OSes (some of the BSDs allocate memory for mutexes). It also gets a
-// lot harder with poisoning to figure out when the mutex needs to be
-// deallocated because it's not after the closure finishes, but after the first
-// successful closure finishes.
+// So to implement this, one might first reach for a `Mutex`, but those cannot
+// be put into a `static`. It also gets a lot harder with poisoning to figure
+// out when the mutex needs to be deallocated because it's not after the closure
+// finishes, but after the first successful closure finishes.
 //
 // All in all, this is instead implemented with atomics and lock-free
 // operations! Whee! Each `Once` has one word of atomic state, and this state is
index 52cf3f97c5c83ba49e12fb37a746710d87840160..60b03cdbeb0e9923b8c6b640b386090d126f2dcf 100644 (file)
@@ -49,9 +49,6 @@ pub unsafe fn init(&mut self) {
         // references, we instead create the mutex with type
         // PTHREAD_MUTEX_NORMAL which is guaranteed to deadlock if we try to
         // re-lock it from the same thread, thus avoiding undefined behavior.
-        //
-        // We can't do anything for StaticMutex, but that type is deprecated
-        // anyways.
         let mut attr: libc::pthread_mutexattr_t = mem::uninitialized();
         let r = libc::pthread_mutexattr_init(&mut attr);
         debug_assert_eq!(r, 0);
index a3822a4a1f93b1c8ee522d19474855879f2be112..3dac7734e9175cd20909854c7d23c13b727e4073 100644 (file)
@@ -323,7 +323,7 @@ pub fn use_extern_macros(&self) -> bool {
     (active, abi_x86_interrupt, "1.17.0", Some(40180), None),
 
     // Allows the `catch {...}` expression
-    (active, catch_expr, "1.17.0", Some(31436), Some(Edition::Edition2018)),
+    (active, catch_expr, "1.17.0", Some(31436), None),
 
     // Used to preserve symbols (see llvm.used)
     (active, used, "1.18.0", Some(40289), None),
index c449cc0a6525a9bdcb41136908f536706311a421..1d0c6b5317a38d3484de1adbfd1ed0ef95eb9f5a 100644 (file)
@@ -302,6 +302,10 @@ pub fn from_ast_ident(ident: ast::Ident) -> Token {
             BinOp(Minus) => true,
             Ident(ident, false) if ident.name == keywords::True.name() => true,
             Ident(ident, false) if ident.name == keywords::False.name() => true,
+            Interpolated(ref nt) => match nt.0 {
+                NtLiteral(..) => true,
+                _             => false,
+            },
             _            => false,
         }
     }
index 4bcb4fd7ad385a4ec1c0db8593a65cb578d248e6..9b9c908ea52721ff3f5e4121e322541cbfd5fdab 100644 (file)
@@ -12,6 +12,7 @@
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
+#include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Object/ObjectFile.h"
@@ -116,6 +117,15 @@ LLVMRustGetOrInsertGlobal(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty) {
   return wrap(unwrap(M)->getOrInsertGlobal(Name, unwrap(Ty)));
 }
 
+extern "C" LLVMValueRef
+LLVMRustInsertPrivateGlobal(LLVMModuleRef M, LLVMTypeRef Ty) {
+  return wrap(new GlobalVariable(*unwrap(M),
+                                 unwrap(Ty),
+                                 false,
+                                 GlobalValue::PrivateLinkage,
+                                 nullptr));
+}
+
 extern "C" LLVMTypeRef LLVMRustMetadataTypeInContext(LLVMContextRef C) {
   return wrap(Type::getMetadataTy(*unwrap(C)));
 }
index 30fffbb769b30dc2aa0484021446a1f4891cb585..301f5544486270b68cfa652b3e36c5e46be9dc73 100644 (file)
 // CHECK: @STATIC = {{.*}}, align 4
 
 // This checks the constants from inline_enum_const
-// CHECK: @byte_str.{{[0-9]+}} = {{.*}}, align 2
+// CHECK: @{{[0-9]+}} = {{.*}}, align 2
 
 // This checks the constants from {low,high}_align_const, they share the same
 // constant, but the alignment differs, so the higher one should be used
-// CHECK: [[LOW_HIGH:@byte_str.[0-9]+]] = {{.*}}, align 4
+// CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}}, align 4
 
 #[derive(Copy, Clone)]
 
index 4fb8c37558d48bbaa7ce1333709cbddf024bf8fa..dd0f89c931d8aa13d64374490584e4848875d1ac 100644 (file)
@@ -22,7 +22,7 @@
 include!("aux_mod.rs");
 
 // Here we check that the expansion of the file!() macro is mapped.
-// CHECK: @byte_str.1 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
+// CHECK: @0 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
 pub static FILE_PATH: &'static str = file!();
 
 fn main() {
diff --git a/src/test/run-make-fulldeps/symbols-are-reasonable/Makefile b/src/test/run-make-fulldeps/symbols-are-reasonable/Makefile
deleted file mode 100644 (file)
index a6d294d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
--include ../tools.mk
-
-# check that the compile generated symbols for strings, binaries,
-# vtables, etc. have semisane names (e.g. `str.1234`); it's relatively
-# easy to accidentally modify the compiler internals to make them
-# become things like `str"str"(1234)`.
-
-OUT=$(TMPDIR)/lib.s
-
-all:
-       $(RUSTC) lib.rs --emit=asm --crate-type=staticlib
-       # just check for symbol declarations with the names we're expecting.
-       $(CGREP) -e 'str\.[0-9]+:' 'byte_str\.[0-9]+:' 'vtable\.[0-9]+' < $(OUT)
diff --git a/src/test/run-make-fulldeps/symbols-are-reasonable/lib.rs b/src/test/run-make-fulldeps/symbols-are-reasonable/lib.rs
deleted file mode 100644 (file)
index b9285b2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 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.
-
-pub static X: &'static str = "foobarbaz";
-pub static Y: &'static [u8] = include_bytes!("lib.rs");
-
-trait Foo { fn dummy(&self) { } }
-impl Foo for usize {}
-
-#[no_mangle]
-pub extern "C" fn dummy() {
-    // force the vtable to be created
-    let _x = &1usize as &Foo;
-}
index a946ec635b29ffdccbdc8a56a4d959d9229230e7..baf27d6f57c3cda9c3c45953636b2e59eb9c1452 100644 (file)
@@ -14,7 +14,7 @@
 // See https://github.com/rust-lang/rust/issues/34793 for more information.
 
 // Make sure we don't optimize anything away:
-// compile-flags: -C no-prepopulate-passes
+// compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals
 
 // Expand something exponentially
 macro_rules! go_bacterial {
index 0ac37485d3dc81df976de0d747b979be4c3e0592..99b8ad83bf6ccfe44c76d2f25274cbf4da569b6a 100644 (file)
@@ -22,7 +22,7 @@
 use std::future::FutureObj;
 use std::task::{
     Context, Poll, Wake,
-    Executor, SpawnObjError,
+    Spawn, SpawnObjError,
     local_waker_from_nonlocal,
 };
 
@@ -36,8 +36,8 @@ fn wake(this: &Arc<Self>) {
     }
 }
 
-struct NoopExecutor;
-impl Executor for NoopExecutor {
+struct NoopSpawner;
+impl Spawn for NoopSpawner {
     fn spawn_obj(&mut self, _: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
         Ok(())
     }
@@ -127,8 +127,8 @@ fn test_future_yields_once_then_returns<F, Fut>(f: F)
     let mut fut = PinBox::new(f(9));
     let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) });
     let waker = local_waker_from_nonlocal(counter.clone());
-    let executor = &mut NoopExecutor;
-    let cx = &mut Context::new(&waker, executor);
+    let spawner = &mut NoopSpawner;
+    let cx = &mut Context::new(&waker, spawner);
 
     assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst));
     assert_eq!(Poll::Pending, fut.as_pin_mut().poll(cx));
index 6cb975a9560b9403cb726ea043dee7744eaf7bb9..476cb48c0d2ee7af5169b9616a3b425bb83f5f12 100644 (file)
@@ -23,7 +23,7 @@
 use std::task::{
     Context, Poll,
     Wake, Waker, LocalWaker,
-    Executor, SpawnObjError,
+    Spawn, SpawnObjError,
     local_waker, local_waker_from_nonlocal,
 };
 
@@ -42,9 +42,9 @@ unsafe fn wake_local(this: &Arc<Self>) {
     }
 }
 
-struct NoopExecutor;
+struct NoopSpawner;
 
-impl Executor for NoopExecutor {
+impl Spawn for NoopSpawner {
     fn spawn_obj(&mut self, _: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
         Ok(())
     }
@@ -59,7 +59,7 @@ fn poll(self: PinMut<Self>, cx: &mut Context) -> Poll<Self::Output> {
         cx.waker().wake();
         cx.waker().wake();
         cx.local_waker().wake();
-        cx.executor().spawn_obj(PinBox::new(MyFuture).into()).unwrap();
+        cx.spawner().spawn_obj(PinBox::new(MyFuture).into()).unwrap();
         Poll::Ready(())
     }
 }
@@ -70,8 +70,8 @@ fn test_local_waker() {
         nonlocal_wakes: AtomicUsize::new(0),
     });
     let waker = unsafe { local_waker(counter.clone()) };
-    let executor = &mut NoopExecutor;
-    let cx = &mut Context::new(&waker, executor);
+    let spawner = &mut NoopSpawner;
+    let cx = &mut Context::new(&waker, spawner);
     assert_eq!(Poll::Ready(()), PinMut::new(&mut MyFuture).poll(cx));
     assert_eq!(1, counter.local_wakes.load(atomic::Ordering::SeqCst));
     assert_eq!(2, counter.nonlocal_wakes.load(atomic::Ordering::SeqCst));
@@ -83,8 +83,8 @@ fn test_local_as_nonlocal_waker() {
         nonlocal_wakes: AtomicUsize::new(0),
     });
     let waker: LocalWaker = local_waker_from_nonlocal(counter.clone());
-    let executor = &mut NoopExecutor;
-    let cx = &mut Context::new(&waker, executor);
+    let spawner = &mut NoopSpawner;
+    let cx = &mut Context::new(&waker, spawner);
     assert_eq!(Poll::Ready(()), PinMut::new(&mut MyFuture).poll(cx));
     assert_eq!(0, counter.local_wakes.load(atomic::Ordering::SeqCst));
     assert_eq!(3, counter.nonlocal_wakes.load(atomic::Ordering::SeqCst));
index 33604212af9516c0357c7e7d6b1a53cfaa6ffb6d..dd9f9be7da713de4bfa956db02e81f85c161a843 100644 (file)
@@ -15,7 +15,7 @@
 
 // Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty
 // code gets optimized out:
-// compile-flags: -Cno-prepopulate-passes
+// compile-flags: -Cno-prepopulate-passes -Cpasses=name-anon-globals
 
 extern crate issue_38226_aux;
 
diff --git a/src/test/run-pass/issue-52169.rs b/src/test/run-pass/issue-52169.rs
new file mode 100644 (file)
index 0000000..f216341
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+#![feature(macro_literal_matcher)]
+
+macro_rules! a {
+    ($i:literal) => { "right" };
+    ($i:tt) => { "wrong" };
+}
+
+macro_rules! b {
+    ($i:literal) => { a!($i) };
+}
+
+fn main() {
+    assert_eq!(b!(0), "right");
+}
index c8f9cd943cdaaf9ab61d41e2b71cc1faefbef3e0..681842e30e006c8ea1415a112a59d7c2465c3e0f 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -C no-prepopulate-passes
+// compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals
 
 #![crate_type = "lib"]