]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #49758 - bjorn3:miri_public_write_discriminant_value, r=oli-obk
authorbors <bors@rust-lang.org>
Sun, 8 Apr 2018 14:12:13 +0000 (14:12 +0000)
committerbors <bors@rust-lang.org>
Sun, 8 Apr 2018 14:12:13 +0000 (14:12 +0000)
miri: Make write_discriminant_value public

97 files changed:
src/Cargo.lock
src/bootstrap/bootstrap.py
src/bootstrap/lib.rs
src/bootstrap/tool.rs
src/doc/index.md
src/liballoc/Cargo.toml
src/liballoc/benches/lib.rs
src/liballoc/lib.rs
src/liballoc/tests/lib.rs
src/liballoc_jemalloc/Cargo.toml
src/liballoc_system/Cargo.toml
src/libcore/cmp.rs
src/libcore/intrinsics.rs
src/libcore/lib.rs
src/libcore/macros.rs
src/libcore/panicking.rs
src/libcore/tests/lib.rs
src/libpanic_abort/Cargo.toml
src/libpanic_unwind/Cargo.toml
src/libpanic_unwind/gcc.rs
src/libpanic_unwind/lib.rs
src/libpanic_unwind/seh64_gnu.rs
src/libpanic_unwind/windows.rs
src/libproc_macro/lib.rs
src/libproc_macro/quote.rs
src/libprofiler_builtins/Cargo.toml
src/librustc/ich/impls_ty.rs
src/librustc/lib.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/weak_lang_items.rs
src/librustc/traits/select.rs
src/librustc_apfloat/lib.rs
src/librustc_apfloat/tests/ieee.rs
src/librustc_asan/Cargo.toml
src/librustc_back/target/apple_base.rs
src/librustc_back/target/mod.rs
src/librustc_back/target/msp430_none_elf.rs
src/librustc_back/target/thumb_base.rs
src/librustc_back/target/windows_base.rs
src/librustc_back/target/windows_msvc_base.rs
src/librustc_borrowck/lib.rs
src/librustc_const_math/lib.rs
src/librustc_data_structures/lib.rs
src/librustc_errors/lib.rs
src/librustc_incremental/lib.rs
src/librustc_lint/lib.rs
src/librustc_lsan/Cargo.toml
src/librustc_metadata/lib.rs
src/librustc_mir/dataflow/impls/borrows.rs
src/librustc_mir/lib.rs
src/librustc_mir/monomorphize/collector.rs
src/librustc_msan/Cargo.toml
src/librustc_traits/lib.rs
src/librustc_trans/base.rs
src/librustc_trans/debuginfo/gdb.rs
src/librustc_trans/lib.rs
src/librustc_trans_utils/lib.rs
src/librustc_tsan/Cargo.toml
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/lib.rs
src/librustdoc/html/static/main.js
src/librustdoc/html/static/rustdoc.css
src/librustdoc/html/static/storage.js
src/librustdoc/lib.rs
src/libserialize/lib.rs
src/libstd/lib.rs
src/libstd/panicking.rs
src/libstd/process.rs
src/libstd/sys/unix/process/process_common.rs
src/libstd/sys/windows/process.rs
src/libstd_unicode/Cargo.toml
src/libsyntax/lib.rs
src/libsyntax/print/pprust.rs
src/libsyntax/std_inject.rs
src/libsyntax_pos/lib.rs
src/libunwind/Cargo.toml
src/libunwind/libunwind.rs
src/rustc/dlmalloc_shim/Cargo.toml
src/rustc/libc_shim/Cargo.toml
src/stage0.txt
src/test/incremental/issue-49595/auxiliary/lit_a.rs [new file with mode: 0644]
src/test/incremental/issue-49595/auxiliary/lit_b.rs [new file with mode: 0644]
src/test/incremental/issue-49595/issue_49595.rs [new file with mode: 0644]
src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs [new file with mode: 0644]
src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs [new file with mode: 0644]
src/test/run-make-fulldeps/std-core-cycle/Makefile
src/test/run-pass/defaults-well-formedness.rs
src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs [new file with mode: 0644]
src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-str.rs [new file with mode: 0644]
src/test/ui/borrowck/two-phase-multi-mut.rs [new file with mode: 0644]
src/test/ui/borrowck/two-phase-multi-mut.stderr [new file with mode: 0644]
src/test/ui/borrowck/two-phase-multiple-activations.rs [new file with mode: 0644]
src/test/ui/issue-48728.rs [new file with mode: 0644]
src/test/ui/issue-48728.stderr [new file with mode: 0644]
src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs [new file with mode: 0644]
src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr [new file with mode: 0644]
src/tools/build-manifest/src/main.rs

index f70fc81829f58e95a8d1c36d3abd99d194a82a0b..004d1c0ffc933aa56b69d79a12958630ef09784e 100644 (file)
@@ -10,6 +10,7 @@ dependencies = [
 name = "alloc"
 version = "0.0.0"
 dependencies = [
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "std_unicode 0.0.0",
@@ -23,6 +24,7 @@ dependencies = [
  "alloc_system 0.0.0",
  "build_helper 0.1.0",
  "cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
  "libc 0.0.0",
 ]
@@ -32,6 +34,7 @@ name = "alloc_system"
 version = "0.0.0"
 dependencies = [
  "alloc 0.0.0",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
  "dlmalloc 0.0.0",
  "libc 0.0.0",
@@ -541,6 +544,7 @@ name = "dlmalloc"
 version = "0.0.0"
 dependencies = [
  "alloc 0.0.0",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -976,6 +980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "libc"
 version = "0.0.0"
 dependencies = [
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -1254,6 +1259,7 @@ dependencies = [
 name = "panic_abort"
 version = "0.0.0"
 dependencies = [
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
  "libc 0.0.0",
 ]
@@ -1263,6 +1269,7 @@ name = "panic_unwind"
 version = "0.0.0"
 dependencies = [
  "alloc 0.0.0",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
  "libc 0.0.0",
  "unwind 0.0.0",
@@ -1401,6 +1408,7 @@ name = "profiler_builtins"
 version = "0.0.0"
 dependencies = [
  "cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -1797,6 +1805,7 @@ dependencies = [
  "alloc_system 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -1942,6 +1951,7 @@ dependencies = [
  "alloc_system 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -1991,6 +2001,7 @@ dependencies = [
  "alloc_system 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -2130,6 +2141,7 @@ dependencies = [
  "alloc_system 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -2343,6 +2355,7 @@ dependencies = [
 name = "std_unicode"
 version = "0.0.0"
 dependencies = [
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
 ]
 
@@ -2725,6 +2738,7 @@ dependencies = [
 name = "unwind"
 version = "0.0.0"
 dependencies = [
+ "compiler_builtins 0.0.0",
  "core 0.0.0",
  "libc 0.0.0",
 ]
index cf54591f25cd576cd62fa204f939a95bfec1d40e..487440becf630de7471c0228bab09c014e33d2ac 100644 (file)
@@ -770,10 +770,7 @@ def bootstrap(help_triggered):
     if 'dev' in data:
         build.set_dev_environment()
 
-    # No help text depends on submodules. This check saves ~1 minute of git commands, even if
-    # all the submodules are present and downloaded!
-    if not help_triggered:
-        build.update_submodules()
+    build.update_submodules()
 
     # Fetch/build the bootstrap
     build.build = args.build or build.build_triple()
index ea4368c0323fbd761b127afd0e32a3a65222a869..0a7f0e5ff4ee25c64116f80a23227dab368bf063 100644 (file)
 //! also check out the `src/bootstrap/README.md` file for more information.
 
 #![deny(warnings)]
-#![feature(conservative_impl_trait, fs_read_write, core_intrinsics)]
-#![feature(slice_concat_ext)]
+#![feature(core_intrinsics)]
 
 #[macro_use]
 extern crate build_helper;
@@ -1155,7 +1154,7 @@ fn create(&self, path: &Path, s: &str) {
 
     fn read(&self, path: &Path) -> String {
         if self.config.dry_run { return String::new(); }
-        t!(fs::read_string(path))
+        t!(fs::read_to_string(path))
     }
 
     fn create_dir(&self, dir: &Path) {
index 93b6153fcb2f8c58c2758f3a6284e54e5867df83..5fc92611e6529066e3828694740919a4cc9e1c62 100644 (file)
@@ -12,7 +12,6 @@
 use std::env;
 use std::path::PathBuf;
 use std::process::{Command, exit};
-use std::slice::SliceConcatExt;
 
 use Mode;
 use Compiler;
index 2e36831d7e86f9e7bcb022eb7f5ff0d3d03d0969..2ea889da1fde201aa89bff93f0dd5c9032548759 100644 (file)
@@ -13,65 +13,65 @@ unofficial documentation resources as well!
 Many of these resources take the form of "books"; we collectively call these
 "The Rust Bookshelf." Some are large, some are small.
 
-## Learn Rust
+# Learn Rust
 
 If you'd like to learn Rust, this is the spot for you! All of these resources
 assume that you have programmed before, but not in any specific language:
 
-### The Rust Programming Language
+## The Rust Programming Language
 
 Affectionately nicknamed "the book," [The Rust Programming
 Language](book/index.html) will give you an overview of the language from
 first principles. You'll build a few projects along the way, and by the end,
 you'll have a solid grasp of the language.
 
-### Rust By Example
+## Rust By Example
 
 If reading multiple hundreds of pages about a language isn't your style, then
 [Rust By Example](rust-by-example/index.html) has you covered. While the book talks about code with
 a lot of words, RBE shows off a bunch of code, and keeps the talking to a
 minimum. It also includes exercises!
 
-## Use Rust
+# Use Rust
 
 Once you've gotten familliar with the language, these resources can help you
 when you're actually using it day-to-day.
 
-### The Standard Library
+## The Standard Library
 
 Rust's standard library has [extensive API documentation](std/index.html),
 with explanations of how to use various things, as well as example code for
 accomplishing various tasks.
 
-### The Cargo Book
+## The Cargo Book
 
 [The Cargo Book](cargo/index.html) is a guide to Cargo, Rust's build tool and dependency manager.
 
-### The Rustdoc Book
+## The Rustdoc Book
 
 [The Rustdoc Book](rustdoc/index.html) describes our documentation tool, `rustdoc`.
 
-### Extended Error Listing
+## Extended Error Listing
 
 Many of Rust's errors come with error codes, and you can request extended
 diagnostics from the compiler on those errors. You can also [read them
 here](error-index.html), if you prefer to read them that way.
 
-## Master Rust
+# Master Rust
 
 Once you're quite familiar with the language, you may find these advanced
 resources useful.
 
-### The Reference
+## The Reference
 
 [The Reference](reference/index.html) is not a formal spec, but is more detailed and
 comprehensive than the book.
 
-### The Rustonomicon
+## The Rustonomicon
 
 [The Rustonomicon](nomicon/index.html) is your guidebook to the dark arts of unsafe
 Rust. It's also sometimes called "the 'nomicon."
 
-### The Unstable Book
+## The Unstable Book
 
 [The Unstable Book](unstable-book/index.html) has documentation for unstable features.
index 3bf919b0c0016e3c689b87146e5a0ba30c940f22..2eb8ea1260446a44cfd8fad1f09c91fdfe5ffcec 100644 (file)
@@ -10,6 +10,7 @@ path = "lib.rs"
 [dependencies]
 core = { path = "../libcore" }
 std_unicode = { path = "../libstd_unicode" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
 
 [dev-dependencies]
 rand = "0.4"
index a43aadfe9a23a72c42b511a8c5a5a3f8add8c015..4d92fc67b2a503cee318477fdaa1503c5c5cb881 100644 (file)
@@ -10,7 +10,6 @@
 
 #![deny(warnings)]
 
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(rand)]
 #![feature(repr_simd)]
 #![feature(slice_sort_by_cached_key)]
index 6ce2547ef6e6d1a8518d9b3835d3331234c0b94b..da26e7c852c463caa5312f5d4b1946480f8a330f 100644 (file)
@@ -97,8 +97,6 @@
 #![feature(fmt_internals)]
 #![feature(from_ref)]
 #![feature(fundamental)]
-#![cfg_attr(stage0, feature(generic_param_attrs))]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(lang_items)]
 #![feature(needs_allocator)]
 #![feature(nonzero)]
 #![feature(exact_chunks)]
 #![feature(pointer_methods)]
 #![feature(inclusive_range_fields)]
+#![cfg_attr(stage0, feature(generic_param_attrs))]
 
 #![cfg_attr(not(test), feature(fn_traits, swap_with_slice, i128))]
 #![cfg_attr(test, feature(test))]
index 1a49fb9964ad727ef7c765c185f8024c35e56764..a173ef10a818ead9882a2285ad8cd9f93bd84ea1 100644 (file)
@@ -14,7 +14,6 @@
 #![feature(alloc_system)]
 #![feature(attr_literals)]
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(const_fn)]
 #![feature(drain_filter)]
 #![feature(exact_size_is_empty)]
index 6d7d83dd99388aa10145a78c4b7b663dd38af802..fd4a45530463df9854455a883061962ba470e8b8 100644 (file)
@@ -16,6 +16,7 @@ alloc = { path = "../liballoc" }
 alloc_system = { path = "../liballoc_system" }
 core = { path = "../libcore" }
 libc = { path = "../rustc/libc_shim" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
 
 [build-dependencies]
 build_helper = { path = "../build_helper" }
index f9a57f7d97a74ea914602769708754e84958d9b4..936e20a32e10e9d064f55f22094052eaafc41455 100644 (file)
@@ -13,6 +13,7 @@ doc = false
 alloc = { path = "../liballoc" }
 core = { path = "../libcore" }
 libc = { path = "../rustc/libc_shim" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
 
 # See comments in the source for what this dependency is
 [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
index 67445daa436024b54b0bae004af0c440d7c3fcd2..3ae9b05b865386563ee9e78764e5a7a18fb61ba7 100644 (file)
@@ -427,7 +427,7 @@ fn cmp(&self, other: &Reverse<T>) -> Ordering {
 ///     }
 /// }
 /// ```
-#[cfg_attr(not(stage0), lang = "ord")]
+#[lang = "ord"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Ord: Eq + PartialOrd<Self> {
     /// This method returns an `Ordering` between `self` and `other`.
@@ -597,8 +597,7 @@ fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
 /// assert_eq!(x < y, true);
 /// assert_eq!(x.lt(&y), true);
 /// ```
-#[cfg_attr(stage0, lang = "ord")]
-#[cfg_attr(not(stage0), lang = "partial_ord")]
+#[lang = "partial_ord"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_on_unimplemented = "can't compare `{Self}` with `{Rhs}`"]
 pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
index 3b740adc46832d06e0c21c5429d5527542c62a04..83274682250b0911f2e41b61c43894dbe4bed4fd 100644 (file)
@@ -1293,7 +1293,6 @@ pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
     pub fn bswap<T>(x: T) -> T;
 
     /// Reverses the bits in an integer type `T`.
-    #[cfg(not(stage0))]
     pub fn bitreverse<T>(x: T) -> T;
 
     /// Performs checked integer addition.
@@ -1316,7 +1315,6 @@ pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
 
     /// Performs an exact division, resulting in undefined behavior where
     /// `x % y != 0` or `y == 0` or `x == T::min_value() && y == -1`
-    #[cfg(not(stage0))]
     pub fn exact_div<T>(x: T, y: T) -> T;
 
     /// Performs an unchecked division, resulting in undefined behavior
@@ -1401,8 +1399,3 @@ pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
     /// Probably will never become stable.
     pub fn nontemporal_store<T>(ptr: *mut T, val: T);
 }
-
-#[cfg(stage0)]
-pub unsafe fn exact_div<T>(a: T, b: T) -> T {
-    unchecked_div(a, b)
-}
index 5a62b8438f93d2a8dccdd5568e36c00427f0dd99..cf9abb26d3e1abe353a5eb9fe8b6359ab5001e03 100644 (file)
@@ -78,8 +78,6 @@
 #![feature(doc_spotlight)]
 #![feature(fn_must_use)]
 #![feature(fundamental)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(intrinsics)]
 #![feature(iterator_flatten)]
 #![feature(iterator_repeat_with)]
 #![feature(untagged_unions)]
 #![feature(unwind_attributes)]
 
-#![cfg_attr(stage0, allow(unused_attributes))]
-#![cfg_attr(stage0, feature(never_type))]
-
 #[prelude_import]
 #[allow(unused)]
 use prelude::v1::*;
index 8a87bea71e2530cf9562698aa6650955a854cc33..90a9cb3379b82ed8d8b4da3811df406cf540feef 100644 (file)
@@ -28,71 +28,6 @@ macro_rules! panic {
     });
 }
 
-/// Ensure that a boolean expression is `true` at runtime.
-///
-/// This will invoke the [`panic!`] macro if the provided expression cannot be
-/// evaluated to `true` at runtime.
-///
-/// # Uses
-///
-/// Assertions are always checked in both debug and release builds, and cannot
-/// be disabled. See [`debug_assert!`] for assertions that are not enabled in
-/// release builds by default.
-///
-/// Unsafe code relies on `assert!` to enforce run-time invariants that, if
-/// violated could lead to unsafety.
-///
-/// Other use-cases of `assert!` include [testing] and enforcing run-time
-/// invariants in safe code (whose violation cannot result in unsafety).
-///
-/// # Custom Messages
-///
-/// This macro has a second form, where a custom panic message can
-/// be provided with or without arguments for formatting.  See [`std::fmt`]
-/// for syntax for this form.
-///
-/// [`panic!`]: macro.panic.html
-/// [`debug_assert!`]: macro.debug_assert.html
-/// [testing]: ../book/second-edition/ch11-01-writing-tests.html#checking-results-with-the-assert-macro
-/// [`std::fmt`]: ../std/fmt/index.html
-///
-/// # Examples
-///
-/// ```
-/// // the panic message for these assertions is the stringified value of the
-/// // expression given.
-/// assert!(true);
-///
-/// fn some_computation() -> bool { true } // a very simple function
-///
-/// assert!(some_computation());
-///
-/// // assert with a custom message
-/// let x = true;
-/// assert!(x, "x wasn't true!");
-///
-/// let a = 3; let b = 27;
-/// assert!(a + b == 30, "a = {}, b = {}", a, b);
-/// ```
-#[macro_export]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(stage0)]
-macro_rules! assert {
-    ($cond:expr) => (
-        if !$cond {
-            panic!(concat!("assertion failed: ", stringify!($cond)))
-        }
-    );
-    ($cond:expr,) => (
-        assert!($cond)
-    );
-    ($cond:expr, $($arg:tt)+) => (
-        if !$cond {
-            panic!($($arg)+)
-        }
-    );
-}
-
 /// Asserts that two expressions are equal to each other (using [`PartialEq`]).
 ///
 /// On panic, this macro will print the values of the expressions with their
index 94db0baa3f95f883f9eb73855ce0c0ff24b939fa..6b3dc75af46332c29c8da67421cf4fc72c837192 100644 (file)
@@ -64,8 +64,7 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32))
     #[allow(improper_ctypes)]
     extern {
         #[lang = "panic_fmt"]
-        #[cfg_attr(stage0, unwind)]
-        #[cfg_attr(not(stage0), unwind(allowed))]
+        #[unwind(allowed)]
         fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: u32, col: u32) -> !;
     }
     let (file, line, col) = *file_line_col;
index de7211e718c9f20333b33a576cbf019f71cc1389..971759dcdd08dba1bcedbf12119e1ab2b3839ca5 100644 (file)
 #![feature(fmt_internals)]
 #![feature(hashmap_internals)]
 #![feature(iterator_step_by)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(iterator_flatten)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 #![feature(iterator_repeat_with)]
 #![feature(nonzero)]
 #![feature(pattern)]
index e0eac41f49ec92b1ada6f8c0c027e811161fcd2a..633d273b3b93cd49834bd972a5dce5ab106a7ae1 100644 (file)
@@ -12,3 +12,4 @@ doc = false
 [dependencies]
 core = { path = "../libcore" }
 libc = { path = "../rustc/libc_shim" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index a978ea16e9e74245ecd355fe6dab581c6d005463..74aaa4d5ae3db6bf606fbcad57a1866324826fba 100644 (file)
@@ -14,3 +14,4 @@ alloc = { path = "../liballoc" }
 core = { path = "../libcore" }
 libc = { path = "../rustc/libc_shim" }
 unwind = { path = "../libunwind" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index ca2fd561cadcfcc75d9bb719cc5937fee4227b31..eb6dc5b5488694ee05a74e7378e32388674e4131 100644 (file)
@@ -286,8 +286,7 @@ unsafe fn find_eh_action(context: *mut uw::_Unwind_Context)
 // See docs in the `unwind` module.
 #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
 #[lang = "eh_unwind_resume"]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
 unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
     uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception);
 }
index a5cebc3e4d04b6eee6b74854f82d1146508878d9..a5c227cb4015ca82b6e7abdebb31ac5d22031ab8 100644 (file)
 // Entry point for raising an exception, just delegates to the platform-specific
 // implementation.
 #[no_mangle]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
 pub unsafe extern "C" fn __rust_start_panic(data: usize, vtable: usize) -> u32 {
     imp::panic(mem::transmute(raw::TraitObject {
         data: data as *mut (),
index 090cd095380ee8dfcaffdaeb3600e664130105b3..c3715f96c6482eb7f234a04db1db26eac44d5eeb 100644 (file)
@@ -108,8 +108,7 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box<Any + Send> {
 }
 
 #[lang = "eh_unwind_resume"]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
 unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: c::LPVOID) -> ! {
     let params = [panic_ctx as c::ULONG_PTR];
     c::RaiseException(RUST_PANIC,
index 50fba5faee747facb0f1309ebd900411f912982e..5f1dda36a889ea0aff118b969d5da63d37f9d3ef 100644 (file)
@@ -79,21 +79,18 @@ pub enum EXCEPTION_DISPOSITION {
 pub use self::EXCEPTION_DISPOSITION::*;
 
 extern "system" {
-    #[cfg_attr(stage0, unwind)]
-    #[cfg_attr(not(stage0), unwind(allowed))]
+    #[unwind(allowed)]
     pub fn RaiseException(dwExceptionCode: DWORD,
                           dwExceptionFlags: DWORD,
                           nNumberOfArguments: DWORD,
                           lpArguments: *const ULONG_PTR);
-    #[cfg_attr(stage0, unwind)]
-    #[cfg_attr(not(stage0), unwind(allowed))]
+    #[unwind(allowed)]
     pub fn RtlUnwindEx(TargetFrame: LPVOID,
                        TargetIp: LPVOID,
                        ExceptionRecord: *const EXCEPTION_RECORD,
                        ReturnValue: LPVOID,
                        OriginalContext: *const CONTEXT,
                        HistoryTable: *const UNWIND_HISTORY_TABLE);
-    #[cfg_attr(stage0, unwind)]
-    #[cfg_attr(not(stage0), unwind(allowed))]
+    #[unwind(allowed)]
     pub fn _CxxThrowException(pExceptionObject: *mut c_void, pThrowInfo: *mut u8);
 }
index 32697e46a08ac58787543402d0767f3ea72bf8bd..6aa5572721dbd329bd0e3c7b7d3043158a3ed507 100644 (file)
@@ -34,7 +34,6 @@
        test(no_crate_inject, attr(deny(warnings))),
        test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
 
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(lang_items)]
@@ -127,7 +126,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl fmt::Debug for TokenStream {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.0.fmt(f)
+        f.write_str("TokenStream ")?;
+        f.debug_list().entries(self.clone()).finish()
     }
 }
 
@@ -222,7 +222,7 @@ pub fn quote_span(span: Span) -> TokenStream {
 
 /// A region of source code, along with macro expansion information.
 #[unstable(feature = "proc_macro", issue = "38356")]
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone)]
 pub struct Span(syntax_pos::Span);
 
 macro_rules! diagnostic_method {
@@ -334,6 +334,16 @@ pub fn eq(&self, other: &Span) -> bool {
     diagnostic_method!(help, Level::Help);
 }
 
+#[unstable(feature = "proc_macro", issue = "38356")]
+impl fmt::Debug for Span {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{:?} bytes({}..{})",
+               self.0.ctxt(),
+               self.0.lo().0,
+               self.0.hi().0)
+    }
+}
+
 /// A line-column pair representing the start or end of a `Span`.
 #[unstable(feature = "proc_macro", issue = "38356")]
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -422,7 +432,7 @@ fn eq(&self, other: &FileName) -> bool {
 
 /// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`).
 #[unstable(feature = "proc_macro", issue = "38356")]
-#[derive(Clone, Debug)]
+#[derive(Clone)]
 pub enum TokenTree {
     /// A delimited tokenstream
     Group(Group),
@@ -463,6 +473,20 @@ pub fn set_span(&mut self, span: Span) {
     }
 }
 
+#[unstable(feature = "proc_macro", issue = "38356")]
+impl fmt::Debug for TokenTree {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // Each of these has the name in the struct type in the derived debug,
+        // so don't bother with an extra layer of indirection
+        match *self {
+            TokenTree::Group(ref tt) => tt.fmt(f),
+            TokenTree::Term(ref tt) => tt.fmt(f),
+            TokenTree::Op(ref tt) => tt.fmt(f),
+            TokenTree::Literal(ref tt) => tt.fmt(f),
+        }
+    }
+}
+
 #[unstable(feature = "proc_macro", issue = "38356")]
 impl From<Group> for TokenTree {
     fn from(g: Group) -> TokenTree {
@@ -717,7 +741,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 #[derive(Clone, Debug)]
 #[unstable(feature = "proc_macro", issue = "38356")]
 pub struct Literal {
-    token: token::Token,
+    lit: token::Lit,
+    suffix: Option<ast::Name>,
     span: Span,
 }
 
@@ -734,10 +759,9 @@ macro_rules! suffixed_int_literals {
         /// below.
         #[unstable(feature = "proc_macro", issue = "38356")]
         pub fn $name(n: $kind) -> Literal {
-            let lit = token::Lit::Integer(Symbol::intern(&n.to_string()));
-            let ty = Some(Symbol::intern(stringify!($kind)));
             Literal {
-                token: token::Literal(lit, ty),
+                lit: token::Lit::Integer(Symbol::intern(&n.to_string())),
+                suffix: Some(Symbol::intern(stringify!($kind))),
                 span: Span::call_site(),
             }
         }
@@ -759,9 +783,9 @@ macro_rules! unsuffixed_int_literals {
         /// below.
         #[unstable(feature = "proc_macro", issue = "38356")]
         pub fn $name(n: $kind) -> Literal {
-            let lit = token::Lit::Integer(Symbol::intern(&n.to_string()));
             Literal {
-                token: token::Literal(lit, None),
+                lit: token::Lit::Integer(Symbol::intern(&n.to_string())),
+                suffix: None,
                 span: Span::call_site(),
             }
         }
@@ -814,9 +838,9 @@ pub fn f32_unsuffixed(n: f32) -> Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
         Literal {
-            token: token::Literal(lit, None),
+            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
+            suffix: None,
             span: Span::call_site(),
         }
     }
@@ -837,9 +861,9 @@ pub fn f32_suffixed(n: f32) -> Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
         Literal {
-            token: token::Literal(lit, Some(Symbol::intern("f32"))),
+            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
+            suffix: Some(Symbol::intern("f32")),
             span: Span::call_site(),
         }
     }
@@ -859,9 +883,9 @@ pub fn f64_unsuffixed(n: f64) -> Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
         Literal {
-            token: token::Literal(lit, None),
+            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
+            suffix: None,
             span: Span::call_site(),
         }
     }
@@ -882,9 +906,9 @@ pub fn f64_suffixed(n: f64) -> Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
         Literal {
-            token: token::Literal(lit, Some(Symbol::intern("f64"))),
+            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
+            suffix: Some(Symbol::intern("f64")),
             span: Span::call_site(),
         }
     }
@@ -897,7 +921,8 @@ pub fn string(string: &str) -> Literal {
             escaped.extend(ch.escape_debug());
         }
         Literal {
-            token: token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None),
+            lit: token::Lit::Str_(Symbol::intern(&escaped)),
+            suffix: None,
             span: Span::call_site(),
         }
     }
@@ -908,7 +933,8 @@ pub fn character(ch: char) -> Literal {
         let mut escaped = String::new();
         escaped.extend(ch.escape_unicode());
         Literal {
-            token: token::Literal(token::Lit::Char(Symbol::intern(&escaped)), None),
+            lit: token::Lit::Char(Symbol::intern(&escaped)),
+            suffix: None,
             span: Span::call_site(),
         }
     }
@@ -919,7 +945,8 @@ pub fn byte_string(bytes: &[u8]) -> Literal {
         let string = bytes.iter().cloned().flat_map(ascii::escape_default)
             .map(Into::<char>::into).collect::<String>();
         Literal {
-            token: token::Literal(token::Lit::ByteStr(Symbol::intern(&string)), None),
+            lit: token::Lit::ByteStr(Symbol::intern(&string)),
+            suffix: None,
             span: Span::call_site(),
         }
     }
@@ -1055,7 +1082,7 @@ macro_rules! op {
             Ident(ident, true) => {
                 tt!(Term::new(&format!("r#{}", ident), Span(span)))
             }
-            Literal(..) => tt!(self::Literal { token, span: Span(span) }),
+            Literal(lit, suffix) => tt!(self::Literal { lit, suffix, span: Span(span) }),
             DocComment(c) => {
                 let style = comments::doc_comment_style(&c.as_str());
                 let stripped = comments::strip_doc_comment_decoration(&c.as_str());
@@ -1111,33 +1138,36 @@ fn to_internal(self) -> tokenstream::TokenStream {
                 return TokenTree::Token(tt.span.0, token).into();
             }
             self::TokenTree::Literal(self::Literal {
-                token: Literal(Lit::Integer(ref a), b),
+                lit: Lit::Integer(ref a),
+                suffix,
                 span,
             })
                 if a.as_str().starts_with("-") =>
             {
                 let minus = BinOp(BinOpToken::Minus);
                 let integer = Symbol::intern(&a.as_str()[1..]);
-                let integer = Literal(Lit::Integer(integer), b);
+                let integer = Literal(Lit::Integer(integer), suffix);
                 let a = TokenTree::Token(span.0, minus);
                 let b = TokenTree::Token(span.0, integer);
                 return vec![a, b].into_iter().collect()
             }
             self::TokenTree::Literal(self::Literal {
-                token: Literal(Lit::Float(ref a), b),
+                lit: Lit::Float(ref a),
+                suffix,
                 span,
             })
                 if a.as_str().starts_with("-") =>
             {
                 let minus = BinOp(BinOpToken::Minus);
                 let float = Symbol::intern(&a.as_str()[1..]);
-                let float = Literal(Lit::Float(float), b);
+                let float = Literal(Lit::Float(float), suffix);
                 let a = TokenTree::Token(span.0, minus);
                 let b = TokenTree::Token(span.0, float);
                 return vec![a, b].into_iter().collect()
             }
             self::TokenTree::Literal(tt) => {
-                return TokenTree::Token(tt.span.0, tt.token).into()
+                let token = Literal(tt.lit, tt.suffix);
+                return TokenTree::Token(tt.span.0, token).into()
             }
         };
 
index cc8575b88be97f9004d8dff382a0724d442a1d8c..a0ec692809499f47152482115a5ea40ccd791fc9 100644 (file)
@@ -208,13 +208,15 @@ pub fn with_contents_and_suffix(self, contents: Term, suffix: Option<Term>)
                 match self {
                     $(LiteralKind::$i => {
                         Literal {
-                            token: token::Literal(token::Lit::$i(sym), suffix),
+                            lit: token::Lit::$i(sym),
+                            suffix,
                             span: contents.span,
                         }
                     })*
                     $(LiteralKind::$raw(n) => {
                         Literal {
-                            token: token::Literal(token::Lit::$raw(sym, n), suffix),
+                            lit: token::Lit::$raw(sym, n),
+                            suffix,
                             span: contents.span,
                         }
                     })*
@@ -224,16 +226,11 @@ pub fn with_contents_and_suffix(self, contents: Term, suffix: Option<Term>)
 
         impl Literal {
             fn kind_contents_and_suffix(self) -> (LiteralKind, Term, Option<Term>) {
-                let (lit, suffix) = match self.token {
-                    token::Literal(lit, suffix) => (lit, suffix),
-                    _ => panic!("unsupported literal {:?}", self.token),
-                };
-
-                let (kind, contents) = match lit {
+                let (kind, contents) = match self.lit {
                     $(token::Lit::$i(contents) => (LiteralKind::$i, contents),)*
                     $(token::Lit::$raw(contents, n) => (LiteralKind::$raw(n), contents),)*
                 };
-                let suffix = suffix.map(|sym| Term::new(&sym.as_str(), self.span()));
+                let suffix = self.suffix.map(|sym| Term::new(&sym.as_str(), self.span()));
                 (kind, Term::new(&contents.as_str(), self.span()), suffix)
             }
         }
index 04f456917b95703b5eebe33a62e81baa864a36d7..79192fbb6819c4ba09f6822c6bf3515261e31fc3 100644 (file)
@@ -13,6 +13,7 @@ doc = false
 
 [dependencies]
 core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
 
 [build-dependencies]
 cc = "1.0.1"
index f86913490258e51c11d72f1fba3fe1b08836fd68..af4d3429bb1d57699210dd13645a0f07598a0e5c 100644 (file)
@@ -417,7 +417,7 @@ fn hash_stable<W: StableHasherResult>(
             let tcx = tcx.expect("can't hash AllocIds during hir lowering");
             if let Some(alloc) = tcx.interpret_interner.get_alloc(*self) {
                 AllocDiscriminant::Alloc.hash_stable(hcx, hasher);
-                if !hcx.alloc_id_recursion_tracker.insert(*self) {
+                if hcx.alloc_id_recursion_tracker.insert(*self) {
                     tcx
                         .interpret_interner
                         .get_corresponding_static_def_id(*self)
index dcad8132c2b2478a0b3eac0d0475010b8d647e67..7da664e6d0255ae825f67f23c3f53933ce2cb04c 100644 (file)
 
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 #![feature(const_fn)]
-#![cfg_attr(stage0, feature(copy_closures, clone_closures))]
 #![feature(core_intrinsics)]
 #![feature(drain_filter)]
 #![feature(dyn_trait)]
 #![feature(entry_or_default)]
 #![feature(from_ref)]
 #![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![cfg_attr(windows, feature(libc))]
-#![cfg_attr(stage0, feature(match_default_bindings))]
 #![feature(macro_lifetime_matcher)]
 #![feature(macro_vis_matcher)]
 #![feature(exhaustive_patterns)]
@@ -68,8 +63,6 @@
 #![feature(slice_patterns)]
 #![feature(specialization)]
 #![feature(unboxed_closures)]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
-#![cfg_attr(stage0, feature(universal_impl_trait))]
 #![feature(trace_macros)]
 #![feature(trusted_len)]
 #![feature(catch_expr)]
index 6bf0c5d1ba3e39478389c9fa1d60b95fec599f37..5875e5e4097af496036aaa5b221866ffa5fc6e1a 100644 (file)
@@ -503,8 +503,37 @@ pub fn expr_ty_adjusted(&self, expr: &hir::Expr) -> McResult<Ty<'tcx>> {
         self.resolve_type_vars_or_error(expr.hir_id, self.tables.expr_ty_adjusted_opt(expr))
     }
 
+    /// Returns the type of value that this pattern matches against.
+    /// Some non-obvious cases:
+    ///
+    /// - a `ref x` binding matches against a value of type `T` and gives
+    ///   `x` the type `&T`; we return `T`.
+    /// - a pattern with implicit derefs (thanks to default binding
+    ///   modes #42640) may look like `Some(x)` but in fact have
+    ///   implicit deref patterns attached (e.g., it is really
+    ///   `&Some(x)`). In that case, we return the "outermost" type
+    ///   (e.g., `&Option<T>).
     fn pat_ty(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
+        // Check for implicit `&` types wrapping the pattern; note
+        // that these are never attached to binding patterns, so
+        // actually this is somewhat "disjoint" from the code below
+        // that aims to account for `ref x`.
+        if let Some(vec) = self.tables.pat_adjustments().get(pat.hir_id) {
+            if let Some(first_ty) = vec.first() {
+                debug!("pat_ty(pat={:?}) found adjusted ty `{:?}`", pat, first_ty);
+                return Ok(first_ty);
+            }
+        }
+
+        self.pat_ty_unadjusted(pat)
+    }
+
+
+    /// Like `pat_ty`, but ignores implicit `&` patterns.
+    fn pat_ty_unadjusted(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
         let base_ty = self.node_ty(pat.hir_id)?;
+        debug!("pat_ty(pat={:?}) base_ty={:?}", pat, base_ty);
+
         // This code detects whether we are looking at a `ref x`,
         // and if so, figures out what the type *being borrowed* is.
         let ret_ty = match pat.node {
@@ -531,8 +560,8 @@ fn pat_ty(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
             }
             _ => base_ty,
         };
-        debug!("pat_ty(pat={:?}) base_ty={:?} ret_ty={:?}",
-               pat, base_ty, ret_ty);
+        debug!("pat_ty(pat={:?}) ret_ty={:?}", pat, ret_ty);
+
         Ok(ret_ty)
     }
 
@@ -1246,7 +1275,7 @@ fn cat_pattern_<F>(&self, mut cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McR
                      self.tcx.adt_def(enum_def).variant_with_id(def_id).fields.len())
                 }
                 Def::StructCtor(_, CtorKind::Fn) => {
-                    match self.pat_ty(&pat)?.sty {
+                    match self.pat_ty_unadjusted(&pat)?.sty {
                         ty::TyAdt(adt_def, _) => {
                             (cmt, adt_def.non_enum_variant().fields.len())
                         }
@@ -1297,7 +1326,7 @@ fn cat_pattern_<F>(&self, mut cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McR
 
           PatKind::Tuple(ref subpats, ddpos) => {
             // (p1, ..., pN)
-            let expected_len = match self.pat_ty(&pat)?.sty {
+            let expected_len = match self.pat_ty_unadjusted(&pat)?.sty {
                 ty::TyTuple(ref tys) => tys.len(),
                 ref ty => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
             };
index 95e75b4f0646efc42442ce7a60c425aad22fa152..e19f4483f6569f536549ef57501d9bcebe13e025 100644 (file)
@@ -64,6 +64,24 @@ pub fn link_name(attrs: &[ast::Attribute]) -> Option<Symbol> {
     })
 }
 
+/// Returns whether the specified `lang_item` doesn't actually need to be
+/// present for this compilation.
+///
+/// Not all lang items are always required for each compilation, particularly in
+/// the case of panic=abort. In these situations some lang items are injected by
+/// crates and don't actually need to be defined in libstd.
+pub fn whitelisted(tcx: TyCtxt, lang_item: lang_items::LangItem) -> bool {
+    // If we're not compiling with unwinding, we won't actually need these
+    // symbols. Other panic runtimes ensure that the relevant symbols are
+    // available to link things together, but they're never exercised.
+    if tcx.sess.panic_strategy() != PanicStrategy::Unwind {
+        return lang_item == lang_items::EhPersonalityLangItem ||
+            lang_item == lang_items::EhUnwindResumeLangItem
+    }
+
+    false
+}
+
 fn verify<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     items: &lang_items::LanguageItems) {
     // We only need to check for the presence of weak lang items if we're
@@ -89,18 +107,9 @@ fn verify<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
     }
 
-    // If we're not compiling with unwinding, we won't actually need these
-    // symbols. Other panic runtimes ensure that the relevant symbols are
-    // available to link things together, but they're never exercised.
-    let mut whitelisted = HashSet::new();
-    if tcx.sess.panic_strategy() != PanicStrategy::Unwind {
-        whitelisted.insert(lang_items::EhPersonalityLangItem);
-        whitelisted.insert(lang_items::EhUnwindResumeLangItem);
-    }
-
     $(
         if missing.contains(&lang_items::$item) &&
-           !whitelisted.contains(&lang_items::$item) &&
+           !whitelisted(tcx, lang_items::$item) &&
            items.$name().is_none() {
             tcx.sess.err(&format!("language item required, but not found: `{}`",
                                   stringify!($name)));
index b1649686323f8750e09e47f33be76fdf28a7f839..58c591bf9351258885ce10111369a488f963ecb1 100644 (file)
@@ -961,11 +961,21 @@ fn insert_evaluation_cache(&mut self,
         if self.can_use_global_caches(param_env) {
             let mut cache = self.tcx().evaluation_cache.hashmap.borrow_mut();
             if let Some(trait_ref) = self.tcx().lift_to_global(&trait_ref) {
+                debug!(
+                    "insert_evaluation_cache(trait_ref={:?}, candidate={:?}) global",
+                    trait_ref,
+                    result,
+                );
                 cache.insert(trait_ref, WithDepNode::new(dep_node, result));
                 return;
             }
         }
 
+        debug!(
+            "insert_evaluation_cache(trait_ref={:?}, candidate={:?})",
+            trait_ref,
+            result,
+        );
         self.infcx.evaluation_cache.hashmap
                                    .borrow_mut()
                                    .insert(trait_ref, WithDepNode::new(dep_node, result));
@@ -1069,25 +1079,29 @@ fn candidate_from_obligation_no_cache<'o>(&mut self,
                 if self.intercrate_ambiguity_causes.is_some() {
                     debug!("evaluate_stack: intercrate_ambiguity_causes is some");
                     // Heuristics: show the diagnostics when there are no candidates in crate.
-                    let candidate_set = self.assemble_candidates(stack)?;
-                    if !candidate_set.ambiguous && candidate_set.vec.iter().all(|c| {
-                        !self.evaluate_candidate(stack, &c).may_apply()
-                    }) {
-                        let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
-                        let self_ty = trait_ref.self_ty();
-                        let trait_desc = trait_ref.to_string();
-                        let self_desc = if self_ty.has_concrete_skeleton() {
-                            Some(self_ty.to_string())
-                        } else {
-                            None
-                        };
-                        let cause = if let Conflict::Upstream = conflict {
-                            IntercrateAmbiguityCause::UpstreamCrateUpdate { trait_desc, self_desc }
-                        } else {
-                            IntercrateAmbiguityCause::DownstreamCrate { trait_desc, self_desc }
-                        };
-                        debug!("evaluate_stack: pushing cause = {:?}", cause);
-                        self.intercrate_ambiguity_causes.as_mut().unwrap().push(cause);
+                    if let Ok(candidate_set) = self.assemble_candidates(stack) {
+                        if !candidate_set.ambiguous && candidate_set.vec.iter().all(|c| {
+                            !self.evaluate_candidate(stack, &c).may_apply()
+                        }) {
+                            let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
+                            let self_ty = trait_ref.self_ty();
+                            let trait_desc = trait_ref.to_string();
+                            let self_desc = if self_ty.has_concrete_skeleton() {
+                                Some(self_ty.to_string())
+                            } else {
+                                None
+                            };
+                            let cause = if let Conflict::Upstream = conflict {
+                                IntercrateAmbiguityCause::UpstreamCrateUpdate {
+                                    trait_desc,
+                                    self_desc,
+                                }
+                            } else {
+                                IntercrateAmbiguityCause::DownstreamCrate { trait_desc, self_desc }
+                            };
+                            debug!("evaluate_stack: pushing cause = {:?}", cause);
+                            self.intercrate_ambiguity_causes.as_mut().unwrap().push(cause);
+                        }
                     }
                 }
                 return Ok(None);
@@ -1285,12 +1299,22 @@ fn insert_candidate_cache(&mut self,
             let mut cache = tcx.selection_cache.hashmap.borrow_mut();
             if let Some(trait_ref) = tcx.lift_to_global(&trait_ref) {
                 if let Some(candidate) = tcx.lift_to_global(&candidate) {
+                    debug!(
+                        "insert_candidate_cache(trait_ref={:?}, candidate={:?}) global",
+                        trait_ref,
+                        candidate,
+                    );
                     cache.insert(trait_ref, WithDepNode::new(dep_node, candidate));
                     return;
                 }
             }
         }
 
+        debug!(
+            "insert_candidate_cache(trait_ref={:?}, candidate={:?}) local",
+            trait_ref,
+            candidate,
+        );
         self.infcx.selection_cache.hashmap
                                   .borrow_mut()
                                   .insert(trait_ref, WithDepNode::new(dep_node, candidate));
index 6f08fcf702595eb49957fc70ff8c43516c6925c9..276f6cd09bf7accfce96b3051206735f437e7ee6 100644 (file)
 #![deny(warnings)]
 #![forbid(unsafe_code)]
 
-#![cfg_attr(stage0, feature(slice_patterns))]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(try_from))]
-
 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
 #[allow(unused_extern_crates)]
 extern crate rustc_cratesio_shim;
index 627d79724b28a463568723c97dedc96728eaa13d..6e06ea858efad12413fef5d59b75361c56e0344e 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![cfg_attr(stage0, feature(i128_type))]
-
 #[macro_use]
 extern crate rustc_apfloat;
 
index 8f8ef1cc4a0111165ced04bddc19f49a1078fe43..34d8b75a5bfb3476a1f587d33ad663f2d8498f37 100644 (file)
@@ -17,3 +17,4 @@ cmake = "0.1.18"
 alloc = { path = "../liballoc" }
 alloc_system = { path = "../liballoc_system" }
 core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index 72173b62594e9658cd77fa4802f6d154d4ccd44d..480de9ff486e5d1e1af6864c3f0a2c0f8d0499bd 100644 (file)
@@ -47,6 +47,7 @@ pub fn opts() -> TargetOptions {
         exe_allocation_crate: super::maybe_jemalloc(),
         has_elf_tls: version >= (10, 7),
         abi_return_struct_as_int: true,
+        emit_debug_gdb_scripts: false,
         .. Default::default()
     }
 }
index 507243a58a5f9506b62c282c7a7c6875e7f470bb..592b27ac641b5204d2af6ec4a16cce4d625e938c 100644 (file)
@@ -478,6 +478,9 @@ pub struct TargetOptions {
 
     /// Whether or not bitcode is embedded in object files
     pub embed_bitcode: bool,
+
+    /// Whether a .debug_gdb_scripts section will be added to the output object file
+    pub emit_debug_gdb_scripts: bool,
 }
 
 impl Default for TargetOptions {
@@ -550,6 +553,7 @@ fn default() -> TargetOptions {
             codegen_backend: "llvm".to_string(),
             default_hidden_visibility: false,
             embed_bitcode: false,
+            emit_debug_gdb_scripts: true,
         }
     }
 }
@@ -799,6 +803,7 @@ macro_rules! key {
         key!(codegen_backend);
         key!(default_hidden_visibility, bool);
         key!(embed_bitcode, bool);
+        key!(emit_debug_gdb_scripts, bool);
 
         if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) {
             for name in array.iter().filter_map(|abi| abi.as_string()) {
@@ -1002,6 +1007,7 @@ macro_rules! target_option_val {
         target_option_val!(codegen_backend);
         target_option_val!(default_hidden_visibility);
         target_option_val!(embed_bitcode);
+        target_option_val!(emit_debug_gdb_scripts);
 
         if default.abi_blacklist != self.options.abi_blacklist {
             d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()
index d0f512ae47cd9d02392ad4358bbacdd9f1009fbc..31df9be0bc3f81e7b92f677a5bffa0e6d53f4538 100644 (file)
@@ -59,6 +59,9 @@ pub fn target() -> TargetResult {
             // too much overhead for such small target.
             trap_unreachable: false,
 
+            // See the thumb_base.rs file for an explanation of this value
+            emit_debug_gdb_scripts: false,
+
             .. Default::default( )
         }
     })
index 6a8f52f509310b0cf0a962be74c3f56b1dca7932..bb1fbfad2618f17291ce9fe694b86d7faa3b9699 100644 (file)
@@ -53,6 +53,13 @@ pub fn opts() -> TargetOptions {
         // costs it involves.
         relocation_model: "static".to_string(),
         abi_blacklist: super::arm_base::abi_blacklist(),
+        // When this section is added a volatile load to its start address is also generated. This
+        // volatile load is a footgun as it can end up loading an invalid memory address, depending
+        // on how the user set up their linker scripts. This section adds pretty printer for stuff
+        // like std::Vec, which is not that used in no-std context, so it's best to left it out
+        // until we figure a way to add the pretty printers without requiring a volatile load cf.
+        // rust-lang/rust#44993.
+        emit_debug_gdb_scripts: false,
         .. Default::default()
     }
 }
index 05b6247c9518f040fedda7f653c6346803473732..971b21e062f69415d858743eff0d3187cb86f993 100644 (file)
@@ -102,6 +102,7 @@ pub fn opts() -> TargetOptions {
         ],
         custom_unwind_resume: true,
         abi_return_struct_as_int: true,
+        emit_debug_gdb_scripts: false,
 
         .. Default::default()
     }
index 34aa17267f8bea59e9e6cdf44c0c49591d20f167..06e879bec3492310184cce57472dfef0e0b2e535 100644 (file)
@@ -34,6 +34,7 @@ pub fn opts() -> TargetOptions {
         crt_static_allows_dylibs: true,
         crt_static_respected: true,
         abi_return_struct_as_int: true,
+        emit_debug_gdb_scripts: false,
 
         .. Default::default()
     }
index d54654c60868c26d586907659b1b6a3d3ec1ecff..6fe2ac2b0ca25a6c90104419394101097d5b652b 100644 (file)
@@ -16,7 +16,6 @@
 #![allow(non_camel_case_types)]
 
 #![feature(from_ref)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
 #![feature(quote)]
 
 #[macro_use] extern crate log;
index 7177e2818fbcc8029b98c4d0b95b0f40cb87c0d3..c4c5886d465d8ad02f8beb1ff47240aa08d7d5a6 100644 (file)
@@ -19,8 +19,6 @@
       html_root_url = "https://doc.rust-lang.org/nightly/")]
 #![deny(warnings)]
 
-#![cfg_attr(stage0, feature(i128_type, i128))]
-
 extern crate rustc_apfloat;
 
 extern crate syntax;
index 622fb423b51e4450b0b15ea1b36df5c4bde58d13..1e1628936d5cac9b495b46ad730db41ff3da749a 100644 (file)
 #![feature(unboxed_closures)]
 #![feature(fn_traits)]
 #![feature(unsize)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
-#![cfg_attr(stage0, feature(i128_type, i128))]
 #![feature(specialization)]
 #![feature(optin_builtin_traits)]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
 #![feature(macro_vis_matcher)]
 #![feature(allow_internal_unstable)]
-#![cfg_attr(stage0, feature(universal_impl_trait))]
 
 #![cfg_attr(unix, feature(libc))]
 #![cfg_attr(test, feature(test))]
index 43fe812a6ce80a9522a83bcc5c82113908c9d86a..a723e455222047a534794da1cf9d4498a17b3244 100644 (file)
@@ -17,8 +17,6 @@
 #![allow(unused_attributes)]
 #![feature(range_contains)]
 #![cfg_attr(unix, feature(libc))]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(optin_builtin_traits)]
 
 extern crate atty;
index cad72ff778b55155e816b9d78950ad6b5c3e5f3a..9e72ede309d44cf9d1846ae815c799ed19119580 100644 (file)
       html_root_url = "https://doc.rust-lang.org/nightly/")]
 #![deny(warnings)]
 
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 #![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(specialization)]
 
 extern crate graphviz;
index d024adad9d0305af87d052541c06f26fd7934a8e..c915181213d3859d9480495efa97072f58983954 100644 (file)
 #![cfg_attr(test, feature(test))]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(macro_vis_matcher)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(never_type))]
 
 #[macro_use]
 extern crate syntax;
index 087c3162119432a60af7000c58fd7c654dd11c09..9c19b53742654e4c760056a09d1233d25fad7851 100644 (file)
@@ -17,3 +17,4 @@ cmake = "0.1.18"
 alloc = { path = "../liballoc" }
 alloc_system = { path = "../liballoc_system" }
 core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index 4af5ec9ae08ea0d023e23e1516d9f36b5899644b..e89b5a7fc1b4e1dcedf550da7ad719d5d34c13be 100644 (file)
@@ -14,9 +14,7 @@
 #![deny(warnings)]
 
 #![feature(box_patterns)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 #![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(libc)]
 #![feature(macro_lifetime_matcher)]
 #![feature(proc_macro_internals)]
index fb3042014df6af8e6098a4683a31d14f4fb9dc0d..aa991427be09397b615d9ef466536c7b8afdd5a2 100644 (file)
@@ -64,10 +64,7 @@ pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
     assigned_map: FxHashMap<Place<'tcx>, FxHashSet<BorrowIndex>>,
 
     /// Locations which activate borrows.
-    /// NOTE: A given location may activate more than one borrow in the future
-    /// when more general two-phase borrow support is introduced, but for now we
-    /// only need to store one borrow index
-    activation_map: FxHashMap<Location, BorrowIndex>,
+    activation_map: FxHashMap<Location, FxHashSet<BorrowIndex>>,
 
     /// Every borrow has a region; this maps each such regions back to
     /// its borrow-indexes.
@@ -174,7 +171,7 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
             idx_vec: IndexVec<BorrowIndex, BorrowData<'tcx>>,
             location_map: FxHashMap<Location, BorrowIndex>,
             assigned_map: FxHashMap<Place<'tcx>, FxHashSet<BorrowIndex>>,
-            activation_map: FxHashMap<Location, BorrowIndex>,
+            activation_map: FxHashMap<Location, FxHashSet<BorrowIndex>>,
             region_map: FxHashMap<Region<'tcx>, FxHashSet<BorrowIndex>>,
             local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
             region_span_map: FxHashMap<RegionKind, Span>,
@@ -211,12 +208,7 @@ fn root_local(mut p: &mir::Place<'_>) -> Option<mir::Local> {
                     let idx = self.idx_vec.push(borrow);
                     self.location_map.insert(location, idx);
 
-                    // This assert is a good sanity check until more general 2-phase borrow
-                    // support is introduced. See NOTE on the activation_map field for more
-                    assert!(!self.activation_map.contains_key(&activate_location),
-                            "More than one activation introduced at the same location.");
-                    self.activation_map.insert(activate_location, idx);
-
+                    insert(&mut self.activation_map, &activate_location, idx);
                     insert(&mut self.assigned_map, assigned_place, idx);
                     insert(&mut self.region_map, &region, idx);
                     if let Some(local) = root_local(borrowed_place) {
@@ -552,9 +544,11 @@ fn perform_activations_at_location(&self,
                                        location: Location) {
         // Handle activations
         match self.activation_map.get(&location) {
-            Some(&activated) => {
-                debug!("activating borrow {:?}", activated);
-                sets.gen(&ReserveOrActivateIndex::active(activated))
+            Some(activations) => {
+                for activated in activations {
+                    debug!("activating borrow {:?}", activated);
+                    sets.gen(&ReserveOrActivateIndex::active(*activated))
+                }
             }
             None => {}
         }
index 84baa8c541781f8f21240aa2dd07071f51f51c7c..8762e7550cdedffb11c6af54187e2c4a68ef6e48 100644 (file)
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(catch_expr)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(decl_macro)]
 #![feature(dyn_trait)]
 #![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(macro_vis_matcher)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
 #![feature(exhaustive_patterns)]
 #![feature(range_contains)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(nonzero)]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
-#![cfg_attr(stage0, feature(never_type))]
 #![feature(inclusive_range_fields)]
 
 extern crate arena;
index ef018237dbad9c21fe26c4a89dcc260dd015ee36..209f6dbfa485af40d37da07c08f6f34c709fb890 100644 (file)
 
 use rustc_data_structures::bitvec::BitVector;
 
-use std::iter;
-
 #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
 pub enum MonoItemCollectionMode {
     Eager,
@@ -1061,13 +1059,15 @@ fn push_extra_entry_roots(&mut self) {
         // late-bound regions, since late-bound
         // regions must appear in the argument
         // listing.
-        let main_ret_ty = main_ret_ty.no_late_bound_regions().unwrap();
+        let main_ret_ty = self.tcx.erase_regions(
+            &main_ret_ty.no_late_bound_regions().unwrap(),
+        );
 
         let start_instance = Instance::resolve(
             self.tcx,
             ty::ParamEnv::reveal_all(),
             start_def_id,
-            self.tcx.mk_substs(iter::once(Kind::from(main_ret_ty)))
+            self.tcx.intern_substs(&[Kind::from(main_ret_ty)])
         ).unwrap();
 
         self.output.push(create_fn_mono_item(start_instance));
index 8d7279b29eb552db3ac95907a5926334d7044e97..17ec2b96438ad02b97746e66de4a6d5a9c7021ad 100644 (file)
@@ -17,3 +17,4 @@ cmake = "0.1.18"
 alloc = { path = "../liballoc" }
 alloc_system = { path = "../liballoc_system" }
 core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index 90f368edeeca664434153c1b5c6f23900fc67b1f..cfa3b6912f2e47cdd803a41477cdc368f4593a70 100644 (file)
@@ -14,8 +14,6 @@
 #![deny(warnings)]
 
 #![feature(crate_visibility_modifier)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
 
 #[macro_use]
 extern crate log;
index 7ab3499ead3696623d262d0c7608f028ca4f928d..0329264a3125f3467ad30e31e5e509fef7c11d23 100644 (file)
@@ -36,6 +36,7 @@
 use metadata;
 use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use rustc::middle::lang_items::StartFnLangItem;
+use rustc::middle::weak_lang_items;
 use rustc::mir::mono::{Linkage, Visibility, Stats};
 use rustc::middle::cstore::{EncodedMetadata};
 use rustc::ty::{self, Ty, TyCtxt};
@@ -82,7 +83,6 @@
 use std::sync::Arc;
 use std::time::{Instant, Duration};
 use std::{i32, usize};
-use std::iter;
 use std::sync::mpsc;
 use syntax_pos::Span;
 use syntax_pos::symbol::InternedString;
@@ -553,7 +553,9 @@ fn create_entry_fn<'cx>(cx: &'cx CodegenCx,
         // late-bound regions, since late-bound
         // regions must appear in the argument
         // listing.
-        let main_ret_ty = main_ret_ty.no_late_bound_regions().unwrap();
+        let main_ret_ty = cx.tcx.erase_regions(
+            &main_ret_ty.no_late_bound_regions().unwrap(),
+        );
 
         if declare::get_defined_value(cx, "main").is_some() {
             // FIXME: We should be smart and show a better diagnostic here.
@@ -580,8 +582,11 @@ fn create_entry_fn<'cx>(cx: &'cx CodegenCx,
 
         let (start_fn, args) = if use_start_lang_item {
             let start_def_id = cx.tcx.require_lang_item(StartFnLangItem);
-            let start_fn = callee::resolve_and_get_fn(cx, start_def_id, cx.tcx.mk_substs(
-                iter::once(Kind::from(main_ret_ty))));
+            let start_fn = callee::resolve_and_get_fn(
+                cx,
+                start_def_id,
+                cx.tcx.intern_substs(&[Kind::from(main_ret_ty)]),
+            );
             (start_fn, vec![bx.pointercast(rust_main, Type::i8p(cx).ptr_to()),
                             arg_argc, arg_argv])
         } else {
@@ -1137,6 +1142,13 @@ pub fn new(tcx: TyCtxt) -> CrateInfo {
                     info.lang_item_to_crate.insert(item, id.krate);
                 }
             }
+
+            // No need to look for lang items that are whitelisted and don't
+            // actually need to exist.
+            let missing = missing.iter()
+                .cloned()
+                .filter(|&l| !weak_lang_items::whitelisted(tcx, l))
+                .collect();
             info.missing_lang_items.insert(cnum, missing);
         }
 
index 03e7c63dbca36a87a2c3a2677ebafc441e524847..0b4858c7ab051085350c48fa95fa01d0e05fd5c3 100644 (file)
@@ -83,7 +83,6 @@ pub fn needs_gdb_debug_scripts_section(cx: &CodegenCx) -> bool {
                             "omit_gdb_pretty_printer_section");
 
     !omit_gdb_pretty_printer_section &&
-    !cx.sess().target.target.options.is_like_osx &&
-    !cx.sess().target.target.options.is_like_windows &&
-    cx.sess().opts.debuginfo != NoDebugInfo
+    cx.sess().opts.debuginfo != NoDebugInfo &&
+    cx.sess().target.target.options.emit_debug_gdb_scripts
 }
index f8f2fdd9320d2a5fd061a7137664f1b9200eb465..344f959c1414ce29ca1ac4e2bf762314463cca59 100644 (file)
 #![feature(custom_attribute)]
 #![feature(fs_read_write)]
 #![allow(unused_attributes)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(libc)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(slice_patterns))]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 #![feature(optin_builtin_traits)]
 #![feature(inclusive_range_fields)]
 #![feature(underscore_lifetimes)]
@@ -408,7 +404,7 @@ struct CrateInfo {
     wasm_custom_sections: BTreeMap<String, Vec<u8>>,
     wasm_imports: FxHashMap<String, String>,
     lang_item_to_crate: FxHashMap<LangItem, CrateNum>,
-    missing_lang_items: FxHashMap<CrateNum, Lrc<Vec<LangItem>>>,
+    missing_lang_items: FxHashMap<CrateNum, Vec<LangItem>>,
 }
 
 __build_diagnostic_array! { librustc_trans, DIAGNOSTICS }
index 99de124c6e1ad7fb510965230fda017e7468f255..cf47d9b62a94e3578942ee06a50584f1da6f88b6 100644 (file)
 #![feature(box_syntax)]
 #![feature(custom_attribute)]
 #![allow(unused_attributes)]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
 
 extern crate ar;
 extern crate flate2;
index 7b83985ba673167370da3e40d6fb8dd6d9ba5e2f..8bb67c0bbac5f4e601154bf939c328550d71cba0 100644 (file)
@@ -17,3 +17,4 @@ cmake = "0.1.18"
 alloc = { path = "../liballoc" }
 alloc_system = { path = "../liballoc_system" }
 core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index 406ff9463a03c314f4da185ca068dd0ae2c24a37..7dc73a1d5f01977a45aa07581030c55753b5414c 100644 (file)
@@ -423,12 +423,18 @@ fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
                     _ => t.super_visit_with(self)
                 }
             }
+
+            fn visit_region(&mut self, _: ty::Region<'tcx>) -> bool {
+                true
+            }
         }
         let mut param_count = CountParams { params: FxHashSet() };
-        pred.visit_with(&mut param_count);
+        let has_region = pred.visit_with(&mut param_count);
         let substituted_pred = pred.subst(fcx.tcx, substs);
-        // Don't check non-defaulted params, dependent defaults or preds with multiple params.
-        if substituted_pred.references_error() || param_count.params.len() > 1 {
+        // Don't check non-defaulted params, dependent defaults (including lifetimes)
+        // or preds with multiple params.
+        if substituted_pred.references_error() || param_count.params.len() > 1
+            || has_region {
             continue;
         }
         // Avoid duplication of predicates that contain no parameters, for example.
index 44ecb32a0bf9b1fcbb453a191a962beb9b5e1992..6f71db998bd419e4b8513a59acec722543eb547c 100644 (file)
 
 #![allow(non_camel_case_types)]
 
-#![cfg_attr(stage0, feature(advanced_slice_patterns))]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
-#![cfg_attr(stage0, feature(copy_closures, clone_closures))]
 #![feature(crate_visibility_modifier)]
 #![feature(from_ref)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
 #![feature(exhaustive_patterns)]
 #![feature(option_filter)]
 #![feature(quote)]
 #![feature(refcell_replace_swap)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(slice_patterns)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(never_type))]
 #![feature(dyn_trait)]
 
 #[macro_use] extern crate log;
index 3c115e2b8bacfa8e721334c9c3de554760092485..3a3fa833c238ba569da70ade3fa9444ee0dd9ec0 100644 (file)
         };
     }
 
+    function getPageId() {
+        var id = document.location.href.split('#')[1];
+        if (id) {
+            return id.split('?')[0].split('&')[0];
+        }
+        return null;
+    }
+
     function hasClass(elem, className) {
         if (elem && className && elem.className) {
             var elemClass = elem.className;
         }
     }
 
-    function toggleAllDocs() {
+    function toggleAllDocs(pageId) {
         var toggle = document.getElementById("toggle-all-docs");
         if (hasClass(toggle, "will-expand")) {
             updateLocalStorage("rustdoc-collapse", "false");
             toggle.title = "expand all docs";
 
             onEach(document.getElementsByClassName("collapse-toggle"), function(e) {
-                collapseDocs(e, "hide");
+                collapseDocs(e, "hide", pageId);
             });
         }
     }
 
-    function collapseDocs(toggle, mode) {
+    function collapseDocs(toggle, mode, pageId) {
         if (!toggle || !toggle.parentNode) {
             return;
         }
                 }
             }
 
-            var relatedDoc = toggle.parentNode;
+            var parentElem = toggle.parentNode;
+            var relatedDoc = parentElem;
             var docblock = relatedDoc.nextElementSibling;
 
             while (!hasClass(relatedDoc, "impl-items")) {
                 relatedDoc = relatedDoc.nextElementSibling;
             }
 
-            if (!relatedDoc && !hasClass(docblock, "docblock")) {
+            if ((!relatedDoc && !hasClass(docblock, "docblock")) ||
+                (pageId && onEach(relatedDoc.childNodes, function(e) {
+                    return e.id === pageId;
+                }) === true)) {
                 return;
             }
 
         }
     }
 
-    function autoCollapseAllImpls() {
+    function autoCollapseAllImpls(pageId) {
         // Automatically minimize all non-inherent impls
         onEach(document.getElementsByClassName('impl'), function(n) {
             // inherent impl ids are like 'impl' or impl-<number>'
             if (!inherent) {
                 onEach(n.childNodes, function(m) {
                     if (hasClass(m, "collapse-toggle")) {
-                        collapseDocs(m, "hide");
+                        collapseDocs(m, "hide", pageId);
                     }
                 });
             }
         }
     })
 
-    autoCollapseAllImpls();
+    autoCollapseAllImpls(getPageId());
 
     function createToggleWrapper() {
         var span = document.createElement('span');
     };
 
     if (getCurrentValue("rustdoc-collapse") === "true") {
-        toggleAllDocs();
+        toggleAllDocs(getPageId());
     }
 }());
 
index 31a501d24e7dbb728a53f6b453be59dd3d19ab86..f4918033c8e882d8838367d2ce247fe77e6166ed 100644 (file)
@@ -533,6 +533,9 @@ a {
        left: -5px;
 }
 .small-section-header > .anchor {
+       left: -20px;
+}
+.small-section-header > .anchor:not(.field) {
        left: -28px;
 }
 .anchor:before {
index 2f4e203ebc5c2447e19f33ccf82adec4617dd823..4ef8349fa9ce911a8df2858a74f5446c0fa248ad 100644 (file)
@@ -19,10 +19,11 @@ function onEach(arr, func) {
     if (arr && arr.length > 0 && func) {
         for (var i = 0; i < arr.length; i++) {
             if (func(arr[i]) === true) {
-                break;
+                return true;
             }
         }
     }
+    return false;
 }
 
 function updateLocalStorage(name, value) {
index e31390f59e292cead33782f4d7dac0d2cc4ea70d..42e87f88fd40d475b5b7143511ff3a6c47817f4e 100644 (file)
@@ -20,7 +20,6 @@
 #![feature(box_syntax)]
 #![feature(fs_read_write)]
 #![feature(set_stdio)]
-#![cfg_attr(stage0, feature(slice_patterns))]
 #![feature(test)]
 #![feature(unicode)]
 #![feature(vec_remove_item)]
index ee95252346223fa86d2869822a8b2d41b302767d..f78eed30694786cf17d59a1291bba7fff4d3691b 100644 (file)
@@ -23,7 +23,6 @@
 
 #![feature(box_syntax)]
 #![feature(core_intrinsics)]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(specialization)]
 #![cfg_attr(test, feature(test))]
 
index 6f6abfdd31e57e81eab965d54199119e73742b7a..3227aa9acff2358de36e85c13c377c14894b45fa 100644 (file)
 #![cfg_attr(stage0, feature(generic_param_attrs))]
 #![feature(hashmap_internals)]
 #![feature(heap_api)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
 #![feature(int_error_internals)]
 #![feature(integer_atomics)]
 #![feature(into_cow)]
 #![feature(doc_spotlight)]
 #![cfg_attr(test, feature(update_panic_count))]
 #![cfg_attr(windows, feature(used))]
-#![cfg_attr(stage0, feature(never_type))]
-#![cfg_attr(stage0, feature(termination_trait))]
 
 #![default_lib_allocator]
 
 // add a new crate name so we can attach the re-exports to it.
 #[macro_reexport(assert_eq, assert_ne, debug_assert, debug_assert_eq,
                  debug_assert_ne, unreachable, unimplemented, write, writeln, try)]
-#[cfg_attr(stage0, macro_reexport(assert))]
 extern crate core as __core;
 
 #[macro_use]
 
 // compiler-rt intrinsics
 #[doc(masked)]
+#[cfg(stage0)]
 extern crate compiler_builtins;
 
 // During testing, this crate is not actually the "real" std library, but rather
index 454ac64735c67900e37f40cf5212da99e247d7fe..fba3269204e90e10dbe32bab39be95c5db9d47e2 100644 (file)
@@ -55,8 +55,7 @@ fn __rust_maybe_catch_panic(f: fn(*mut u8),
                                 data: *mut u8,
                                 data_ptr: *mut usize,
                                 vtable_ptr: *mut usize) -> u32;
-    #[cfg_attr(stage0, unwind)]
-    #[cfg_attr(not(stage0), unwind(allowed))]
+    #[unwind(allowed)]
     fn __rust_start_panic(data: usize, vtable: usize) -> u32;
 }
 
@@ -316,8 +315,7 @@ pub fn panicking() -> bool {
 /// Entry point of panic from the libcore crate.
 #[cfg(not(test))]
 #[lang = "panic_fmt"]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
 pub extern fn rust_begin_panic(msg: fmt::Arguments,
                                file: &'static str,
                                line: u32,
index 40bc84f4bc104a900636a7f0ad5587dcb3cdb269..92f0406c09bb5c752170212e06fe94effebd306a 100644 (file)
@@ -1452,6 +1452,7 @@ pub trait Termination {
 
 #[unstable(feature = "termination_trait_lib", issue = "43301")]
 impl Termination for () {
+    #[inline]
     fn report(self) -> i32 { ExitCode::SUCCESS.report() }
 }
 
@@ -1481,6 +1482,7 @@ fn report(self) -> i32 {
 
 #[unstable(feature = "termination_trait_lib", issue = "43301")]
 impl Termination for ExitCode {
+    #[inline]
     fn report(self) -> i32 {
         self.0.as_i32()
     }
index b7f30600b8a4c7dc3bf63c21a3cb2397510202d4..6396bb3a49e2844c93865187354a0d2338c3b780 100644 (file)
@@ -404,6 +404,7 @@ impl ExitCode {
     pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
     pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
 
+    #[inline]
     pub fn as_i32(&self) -> i32 {
         self.0 as i32
     }
index afa8e3e1369354f370d5cbf5442b09dd2f3ef53b..bd5507e8f896731aaa68ccad0eb818807f309e0b 100644 (file)
@@ -414,6 +414,7 @@ impl ExitCode {
     pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
     pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
 
+    #[inline]
     pub fn as_i32(&self) -> i32 {
         self.0 as i32
     }
index b3346dbe2fb1240ddd1033907e169134b2ad4442..283070a0e2cf7f42d9a54bd2a8a6a16a46cab8e2 100644 (file)
@@ -15,3 +15,4 @@ path = "tests/lib.rs"
 
 [dependencies]
 core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index dc349c1a3e6a12f51b728a4b16111d085a12b9d0..c456dc45d2182dd43cce74b7b29b30bd203f4f83 100644 (file)
@@ -22,9 +22,7 @@
 
 #![feature(unicode)]
 #![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
 #![feature(non_exhaustive)]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(const_atomic_usize_new)]
 #![feature(rustc_attrs)]
 
index 8d42206c5ccffa4c62c8c0f48ea123942aa5154f..8168db19058764f0585f148769062c1ffd917510 100644 (file)
@@ -94,7 +94,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
                        is_expanded: bool) -> io::Result<()> {
     let mut s = State::new_from_input(cm, sess, filename, input, out, ann, is_expanded);
 
-    if is_expanded && !std_inject::injected_crate_name().is_none() {
+    if is_expanded && std_inject::injected_crate_name().is_some() {
         // We need to print `#![no_std]` (and its feature gate) so that
         // compiling pretty-printed source won't inject libstd again.
         // However we don't want these attributes in the AST because
index 63d7b3336a861a9158d5c26aa3fa0f594a33a79a..bba7a2d73773646d5db9df809836d6645e811177 100644 (file)
@@ -44,27 +44,38 @@ pub fn injected_crate_name() -> Option<&'static str> {
 }
 
 pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option<&str>) -> ast::Crate {
-    let name = if attr::contains_name(&krate.attrs, "no_core") {
+    // the first name in this list is the crate name of the crate with the prelude
+    let names: &[&str] = if attr::contains_name(&krate.attrs, "no_core") {
         return krate;
     } else if attr::contains_name(&krate.attrs, "no_std") {
-        "core"
+        if attr::contains_name(&krate.attrs, "compiler_builtins") {
+            &["core"]
+        } else {
+            &["core", "compiler_builtins"]
+        }
     } else {
-        "std"
+        &["std"]
     };
 
-    INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name)));
+    for name in names {
+        krate.module.items.insert(0, P(ast::Item {
+            attrs: vec![attr::mk_attr_outer(DUMMY_SP,
+                                            attr::mk_attr_id(),
+                                            attr::mk_word_item(ast::Ident::from_str("macro_use")))],
+            vis: dummy_spanned(ast::VisibilityKind::Inherited),
+            node: ast::ItemKind::ExternCrate(alt_std_name.map(Symbol::intern)),
+            ident: ast::Ident::from_str(name),
+            id: ast::DUMMY_NODE_ID,
+            span: DUMMY_SP,
+            tokens: None,
+        }));
+    }
 
-    krate.module.items.insert(0, P(ast::Item {
-        attrs: vec![attr::mk_attr_outer(DUMMY_SP,
-                                        attr::mk_attr_id(),
-                                        attr::mk_word_item(ast::Ident::from_str("macro_use")))],
-        vis: dummy_spanned(ast::VisibilityKind::Inherited),
-        node: ast::ItemKind::ExternCrate(alt_std_name.map(Symbol::intern)),
-        ident: ast::Ident::from_str(name),
-        id: ast::DUMMY_NODE_ID,
-        span: DUMMY_SP,
-        tokens: None,
-    }));
+    // the crates have been injected, the assumption is that the first one is the one with
+    // the prelude.
+    let name = names[0];
+
+    INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name)));
 
     let span = ignored_span(DUMMY_SP);
     krate.module.items.insert(0, P(ast::Item {
index 8b2ebfef2504e13aa4b6ddeb7341eeaa45ac5890..33428eb271abd8a381bbfac32f438fab66e9cd85 100644 (file)
@@ -21,7 +21,6 @@
 
 #![feature(const_fn)]
 #![feature(custom_attribute)]
-#![cfg_attr(stage0, feature(i128_type))]
 #![feature(optin_builtin_traits)]
 #![allow(unused_attributes)]
 #![feature(specialization)]
index fbd9789d2f52d16c98aa91319664b707cb9c2ad8..4760461df64e3895e73561fccd66785dedc6ff92 100644 (file)
@@ -14,3 +14,4 @@ doc = false
 [dependencies]
 core = { path = "../libcore" }
 libc = { path = "../rustc/libc_shim" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
index aa73b11fb3813683534bc7286c502c13d36bfd54..a640a2b777537decc21d176cfe144a934501ef59 100644 (file)
@@ -83,8 +83,7 @@ pub enum _Unwind_Context {}
 pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
                                                       exception: *mut _Unwind_Exception);
 extern "C" {
-    #[cfg_attr(stage0, unwind)]
-    #[cfg_attr(not(stage0), unwind(allowed))]
+    #[unwind(allowed)]
     pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
     pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
     pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void;
@@ -221,8 +220,7 @@ pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void {
 if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
     // Not 32-bit iOS
     extern "C" {
-        #[cfg_attr(stage0, unwind)]
-        #[cfg_attr(not(stage0), unwind(allowed))]
+        #[unwind(allowed)]
         pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
         pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
                                  trace_argument: *mut c_void)
@@ -231,8 +229,7 @@ pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
 } else {
     // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
     extern "C" {
-        #[cfg_attr(stage0, unwind)]
-        #[cfg_attr(not(stage0), unwind(allowed))]
+        #[unwind(allowed)]
         pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
     }
 
index cf8440c40da1aaa8736f3467b950895abdec649c..d2fe159d80673d54dbdb48a6fd0affacfc3665d4 100644 (file)
@@ -11,4 +11,5 @@ doc = false
 
 [dependencies]
 core = { path = "../../libcore" }
+compiler_builtins = { path = "../../rustc/compiler_builtins_shim" }
 alloc = { path = "../../liballoc" }
index 0c04402124a2de290c13d4c2f3b47c9083da6ea7..e77897d6433136603451492472ebd6834a1fd561 100644 (file)
@@ -29,6 +29,8 @@ doc = false
 #
 # See https://github.com/rust-lang/rfcs/pull/1133.
 core = { path = "../../libcore" }
+compiler_builtins = { path = "../compiler_builtins_shim" }
+
 
 [features]
 # Certain parts of libc are conditionally compiled differently than when used
index 96ec1e6834dff30aa0c129f31b3af9a41349369b..e8db3358cf076b49d5c7054a073fa372db534bde 100644 (file)
@@ -12,7 +12,7 @@
 # source tarball for a stable release you'll likely see `1.x.0` for rustc and
 # `0.x.0` for Cargo where they were released on `date`.
 
-date: 2018-03-18
+date: 2018-04-04
 rustc: beta
 cargo: beta
 
diff --git a/src/test/incremental/issue-49595/auxiliary/lit_a.rs b/src/test/incremental/issue-49595/auxiliary/lit_a.rs
new file mode 100644 (file)
index 0000000..f36baa0
--- /dev/null
@@ -0,0 +1,11 @@
+// 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.
+
+pub const A: &str = "hello";
diff --git a/src/test/incremental/issue-49595/auxiliary/lit_b.rs b/src/test/incremental/issue-49595/auxiliary/lit_b.rs
new file mode 100644 (file)
index 0000000..2252437
--- /dev/null
@@ -0,0 +1,11 @@
+// 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.
+
+pub const A: &str = "xxxxx";
diff --git a/src/test/incremental/issue-49595/issue_49595.rs b/src/test/incremental/issue-49595/issue_49595.rs
new file mode 100644 (file)
index 0000000..b899e02
--- /dev/null
@@ -0,0 +1,42 @@
+// 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.
+
+// revisions:cfail1 cfail2 cfail3
+// compile-flags: -Z query-dep-graph --test
+// must-compile-successfully
+
+#![feature(rustc_attrs)]
+#![crate_type = "rlib"]
+
+#![rustc_partition_translated(module="issue_49595-tests", cfg="cfail2")]
+#![rustc_partition_translated(module="issue_49595-lit_test", cfg="cfail3")]
+
+mod tests {
+    #[cfg_attr(not(cfail1), ignore)]
+    #[test]
+    fn test() {
+    }
+}
+
+
+// Checks that changing a string literal without changing its span
+// takes effect.
+
+// replacing a module to have a stable span
+#[cfg_attr(not(cfail3), path = "auxiliary/lit_a.rs")]
+#[cfg_attr(cfail3, path = "auxiliary/lit_b.rs")]
+mod lit;
+
+pub mod lit_test {
+    #[test]
+    fn lit_test() {
+        println!("{}", ::lit::A);
+    }
+}
diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
new file mode 100644 (file)
index 0000000..bd6bcf8
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+// must-compile-successfully
+// failure-status: 1
+
+#![feature(dyn_trait)]
+
+use std::error::Error;
+use std::io;
+
+fn main() -> Result<(), Box<dyn Error>> {
+    Err(Box::new(io::Error::new(io::ErrorKind::Other, "returned Box<dyn Error> from main()")))
+}
diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs
new file mode 100644 (file)
index 0000000..9f01b0b
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern: An error message for you
+// failure-status: 1
+
+fn main() -> Result<(), &'static str> {
+    Err("An error message for you")
+}
index adc5be8016cf447ca614a1ac3af2a4ddf3375cd7..ce3b2d46bbc7b99dffa493e96554995ef49c7a0b 100644 (file)
@@ -13,3 +13,4 @@ endif
 all:
        $(RUSTC) bar.rs
        $(RUSTC) foo.rs $(FLAGS)
+       $(RUSTC) foo.rs $(FLAGS) -C panic=abort
index f35946790955360be57bf8f2e09c009ef82c6670..9b06bf837ae0ccf266e24f63ce341dfb7cf1afc1 100644 (file)
@@ -27,4 +27,8 @@ trait SelfBound<T: Copy=Self> {}
 // Not even for well-formedness.
 struct WellFormedProjection<A, T=<A as Iterator>::Item>(A, T);
 
+// Issue #49344, predicates with lifetimes should not be checked.
+trait Scope<'a> {}
+struct Request<'a, S: Scope<'a> = i32>(S, &'a ());
+
 fn main() {}
diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs
new file mode 100644 (file)
index 0000000..24c30a5
--- /dev/null
@@ -0,0 +1,17 @@
+// 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(dyn_trait)]
+
+use std::error::Error;
+
+fn main() -> Result<(), Box<dyn Error>> {
+    Ok(())
+}
diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-str.rs
new file mode 100644 (file)
index 0000000..2023ff7
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() -> Result<(), &'static str> {
+    Ok(())
+}
diff --git a/src/test/ui/borrowck/two-phase-multi-mut.rs b/src/test/ui/borrowck/two-phase-multi-mut.rs
new file mode 100644 (file)
index 0000000..2b82362
--- /dev/null
@@ -0,0 +1,26 @@
+// 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(nll)]
+
+struct Foo {
+}
+
+impl Foo {
+    fn method(&mut self, foo: &mut Foo) {
+    }
+}
+
+fn main() {
+    let mut foo = Foo { };
+    foo.method(&mut foo);
+    //~^     cannot borrow `foo` as mutable more than once at a time
+    //~^^    cannot borrow `foo` as mutable more than once at a time
+}
diff --git a/src/test/ui/borrowck/two-phase-multi-mut.stderr b/src/test/ui/borrowck/two-phase-multi-mut.stderr
new file mode 100644 (file)
index 0000000..0c02acf
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+  --> $DIR/two-phase-multi-mut.rs:23:16
+   |
+LL |     foo.method(&mut foo);
+   |     -----------^^^^^^^^-
+   |     |          |
+   |     |          second mutable borrow occurs here
+   |     first mutable borrow occurs here
+   |     borrow later used here
+
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+  --> $DIR/two-phase-multi-mut.rs:23:5
+   |
+LL |     foo.method(&mut foo);
+   |     ^^^^^^^^^^^--------^
+   |     |          |
+   |     |          first mutable borrow occurs here
+   |     second mutable borrow occurs here
+   |     borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/two-phase-multiple-activations.rs b/src/test/ui/borrowck/two-phase-multiple-activations.rs
new file mode 100644 (file)
index 0000000..e1ed41b
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+
+// revisions: lxl nll
+//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+
+// run-pass
+
+use std::io::Result;
+
+struct Foo {}
+
+pub trait FakeRead {
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>;
+}
+
+impl FakeRead for Foo {
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
+        Ok(4)
+    }
+}
+
+fn main() {
+    let mut a = Foo {};
+    let mut v = Vec::new();
+    a.read_to_end(&mut v);
+}
diff --git a/src/test/ui/issue-48728.rs b/src/test/ui/issue-48728.rs
new file mode 100644 (file)
index 0000000..251ebf5
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2015 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.
+
+// Regression test for #48728, an ICE that occurred computing
+// coherence "help" information.
+
+#[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone`
+struct Node<T: ?Sized>(Box<T>);
+
+impl<T: Clone + ?Sized> Clone for Node<[T]> {
+    fn clone(&self) -> Self {
+        Node(Box::clone(&self.0))
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/issue-48728.stderr b/src/test/ui/issue-48728.stderr
new file mode 100644 (file)
index 0000000..05c87fe
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Node<[_]>`:
+  --> $DIR/issue-48728.rs:14:10
+   |
+LL | #[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone`
+   |          ^^^^^ conflicting implementation for `Node<[_]>`
+...
+LL | impl<T: Clone + ?Sized> Clone for Node<[T]> {
+   | ------------------------------------------- first implementation here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs
new file mode 100644 (file)
index 0000000..8dc1627
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2017 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.
+
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct Foo {
+}
+
+impl Foo {
+    fn get(&self) -> Option<&Result<String, String>> {
+        None
+    }
+
+    fn mutate(&mut self) { }
+}
+
+fn main() {
+    let mut foo = Foo { };
+
+    // foo.get() returns type Option<&Result<String, String>>, so
+    // using `string` keeps borrow of `foo` alive. Hence calling
+    // `foo.mutate()` should be an error.
+    while let Some(Ok(string)) = foo.get() {
+        foo.mutate();
+        //~^ ERROR cannot borrow `foo` as mutable
+        println!("foo={:?}", *string);
+    }
+}
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
new file mode 100644 (file)
index 0000000..2da5ac8
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-issue-49631.rs:30:9
+   |
+LL |     while let Some(Ok(string)) = foo.get() {
+   |                                  ---     - immutable borrow ends here
+   |                                  |
+   |                                  immutable borrow occurs here
+LL |         foo.mutate();
+   |         ^^^ mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
index 0f482c95e05a27a7774bd558a439f35313b42e11..9f2389292158b8070fe6eb8da4d942ebe9b3e349 100644 (file)
     "sparc-unknown-linux-gnu",
     "sparc64-unknown-linux-gnu",
     "sparcv9-sun-solaris",
+    "thumbv6m-none-eabi",
+    "thumbv7em-none-eabi",
+    "thumbv7em-none-eabihf",
+    "thumbv7m-none-eabi",
     "wasm32-unknown-emscripten",
     "wasm32-unknown-unknown",
     "x86_64-apple-darwin",