diff --git a/RELEASES.md b/RELEASES.md index 8fcd22b0b448..a4e6f22ba3db 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -38,7 +38,6 @@ Stabilized APIs Cargo ----- -- [Cargo now supports alternative registries][cargo/4506] - [Cargo now supports uninstallation of multiple packages][cargo/4561] eg. `cargo uninstall foo bar` uninstalls `foo` and `bar`. - [Added unit test checking to `cargo check`][cargo/4592] @@ -49,7 +48,6 @@ Misc ---- - [Releases now ship with the Cargo book documentation.][45692] - [rustdoc now prints rendering warnings on every run.][45324] -- [Release tarballs now come with rustfmt][45903] Compatibility Notes ------------------- @@ -83,9 +81,7 @@ Compatibility Notes [45852]: https://github.com/rust-lang/rust/issues/45852 [45853]: https://github.com/rust-lang/rust/pull/45853 [45887]: https://github.com/rust-lang/rust/pull/45887 -[45903]: https://github.com/rust-lang/rust/pull/45903 [45920]: https://github.com/rust-lang/rust/pull/45920 -[cargo/4506]: https://github.com/rust-lang/cargo/pull/4506 [cargo/4561]: https://github.com/rust-lang/cargo/pull/4561 [cargo/4592]: https://github.com/rust-lang/cargo/pull/4592 [cargo/4637]: https://github.com/rust-lang/cargo/pull/4637 diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index 27259cc31a5e..1d5e7b73be55 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -21,7 +21,7 @@ #![feature(core_intrinsics)] #![feature(staged_api)] #![feature(rustc_attrs)] -#![cfg_attr(any(unix, target_os = "redox"), feature(libc))] +#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))] #![rustc_alloc_kind = "lib"] // The minimum alignment guaranteed by the architecture. This value is used to @@ -116,7 +116,7 @@ unsafe impl Alloc for System { } } -#[cfg(any(unix, target_os = "redox"))] +#[cfg(any(unix, target_os = "cloudabi", target_os = "redox"))] mod platform { extern crate libc; @@ -213,6 +213,16 @@ mod platform { struct Stderr; impl Write for Stderr { + #[cfg(target_os = "cloudabi")] + fn write_str(&mut self, _: &str) -> fmt::Result { + // CloudABI does not have any reserved file descriptor + // numbers. We should not attempt to write to file + // descriptor #2, as it may be associated with any kind of + // resource. + Ok(()) + } + + #[cfg(not(target_os = "cloudabi"))] fn write_str(&mut self, s: &str) -> fmt::Result { unsafe { libc::write(libc::STDERR_FILENO, diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 948ad104cdf2..f00128a8147d 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -330,6 +330,7 @@ macro_rules! debug_assert_ne { /// // The prefered method of quick returning Errors /// fn write_to_file_question() -> Result<(), MyError> { /// let mut file = File::create("my_best_friends.txt")?; +/// file.write_all(b"This is a list of my best friends.")?; /// Ok(()) /// } /// diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 5b1a9399c39b..93f6a0214d77 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1024,7 +1024,7 @@ impl ::fmt::Debug for ManuallyDrop { } } -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl Clone for ManuallyDrop { fn clone(&self) -> Self { ManuallyDrop::new(self.deref().clone()) @@ -1035,14 +1035,14 @@ impl Clone for ManuallyDrop { } } -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl Default for ManuallyDrop { fn default() -> Self { ManuallyDrop::new(Default::default()) } } -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl PartialEq for ManuallyDrop { fn eq(&self, other: &Self) -> bool { self.deref().eq(other) @@ -1053,10 +1053,10 @@ impl PartialEq for ManuallyDrop { } } -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl Eq for ManuallyDrop {} -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl PartialOrd for ManuallyDrop { fn partial_cmp(&self, other: &Self) -> Option<::cmp::Ordering> { self.deref().partial_cmp(other) @@ -1079,14 +1079,14 @@ impl PartialOrd for ManuallyDrop { } } -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl Ord for ManuallyDrop { fn cmp(&self, other: &Self) -> ::cmp::Ordering { self.deref().cmp(other) } } -#[stable(feature = "manually_drop", since = "1.20.0")] +#[stable(feature = "manually_drop_impls", since = "1.22.0")] impl ::hash::Hash for ManuallyDrop { fn hash(&self, state: &mut H) { self.deref().hash(state); diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 1ca995cae6d9..765b369e4b25 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1997,7 +1997,9 @@ mod traits { } } - #[stable(feature = "str_checked_slicing", since = "1.20.0")] + #[unstable(feature = "inclusive_range", + reason = "recently added, follows RFC", + issue = "28237")] impl SliceIndex for ops::RangeInclusive { type Output = str; #[inline] @@ -2040,7 +2042,9 @@ mod traits { - #[stable(feature = "str_checked_slicing", since = "1.20.0")] + #[unstable(feature = "inclusive_range", + reason = "recently added, follows RFC", + issue = "28237")] impl SliceIndex for ops::RangeToInclusive { type Output = str; #[inline] diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index e334d2014af7..3da9e9c87dde 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -944,6 +944,7 @@ macro_rules! atomic_int { $stable_cxchg:meta, $stable_debug:meta, $stable_access:meta, + $stable_from:meta, $s_int_type:expr, $int_ref:expr, $int_type:ident $atomic_type:ident $atomic_init:ident) => { /// An integer type which can be safely shared between threads. @@ -978,7 +979,7 @@ macro_rules! atomic_int { } } - #[stable(feature = "atomic_from", since = "1.23.0")] + #[$stable_from] impl From<$int_type> for $atomic_type { #[inline] fn from(v: $int_type) -> Self { Self::new(v) } @@ -1375,6 +1376,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "i8", "../../../std/primitive.i8.html", i8 AtomicI8 ATOMIC_I8_INIT } @@ -1384,6 +1386,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "u8", "../../../std/primitive.u8.html", u8 AtomicU8 ATOMIC_U8_INIT } @@ -1393,6 +1396,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "i16", "../../../std/primitive.i16.html", i16 AtomicI16 ATOMIC_I16_INIT } @@ -1402,6 +1406,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "u16", "../../../std/primitive.u16.html", u16 AtomicU16 ATOMIC_U16_INIT } @@ -1411,6 +1416,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "i32", "../../../std/primitive.i32.html", i32 AtomicI32 ATOMIC_I32_INIT } @@ -1420,6 +1426,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "u32", "../../../std/primitive.u32.html", u32 AtomicU32 ATOMIC_U32_INIT } @@ -1429,6 +1436,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "i64", "../../../std/primitive.i64.html", i64 AtomicI64 ATOMIC_I64_INIT } @@ -1438,6 +1446,7 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), + unstable(feature = "integer_atomics", issue = "32976"), "u64", "../../../std/primitive.u64.html", u64 AtomicU64 ATOMIC_U64_INIT } @@ -1447,6 +1456,7 @@ atomic_int!{ stable(feature = "extended_compare_and_swap", since = "1.10.0"), stable(feature = "atomic_debug", since = "1.3.0"), stable(feature = "atomic_access", since = "1.15.0"), + stable(feature = "atomic_from", since = "1.23.0"), "isize", "../../../std/primitive.isize.html", isize AtomicIsize ATOMIC_ISIZE_INIT } @@ -1456,6 +1466,7 @@ atomic_int!{ stable(feature = "extended_compare_and_swap", since = "1.10.0"), stable(feature = "atomic_debug", since = "1.3.0"), stable(feature = "atomic_access", since = "1.15.0"), + stable(feature = "atomic_from", since = "1.23.0"), "usize", "../../../std/primitive.usize.html", usize AtomicUsize ATOMIC_USIZE_INIT } diff --git a/src/librustc_back/target/cloudabi_base.rs b/src/librustc_back/target/cloudabi_base.rs index 3353e7936f0d..4cd52ebb26df 100644 --- a/src/librustc_back/target/cloudabi_base.rs +++ b/src/librustc_back/target/cloudabi_base.rs @@ -27,6 +27,18 @@ pub fn opts() -> TargetOptions { linker_is_gnu: true, pre_link_args: args, position_independent_executables: true, + // As CloudABI only supports static linkage, there is no need + // for dynamic TLS. The C library therefore does not provide + // __tls_get_addr(), which is normally used to perform dynamic + // TLS lookups by programs that make use of dlopen(). Only the + // "local-exec" and "initial-exec" TLS models can be used. + // + // "local-exec" is more efficient than "initial-exec", as the + // latter has one more level of indirection: it accesses the GOT + // (Global Offset Table) to obtain the effective address of a + // thread-local variable. Using a GOT is useful only when doing + // dynamic linking. + tls_model: "local-exec".to_string(), relro_level: RelroLevel::Full, exe_allocation_crate: super::maybe_jemalloc(), .. Default::default() diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs index 7d6534944651..4e6519562650 100644 --- a/src/librustc_llvm/ffi.rs +++ b/src/librustc_llvm/ffi.rs @@ -538,9 +538,6 @@ extern "C" { /// See llvm::LLVMTypeKind::getTypeID. pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind; - /// See llvm::Value::getContext - pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef; - // Operations on integer types pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef; pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef; @@ -812,13 +809,12 @@ extern "C" { Bundle: OperandBundleDefRef, Name: *const c_char) -> ValueRef; - pub fn LLVMRustBuildLandingPad(B: BuilderRef, - Ty: TypeRef, - PersFn: ValueRef, - NumClauses: c_uint, - Name: *const c_char, - F: ValueRef) - -> ValueRef; + pub fn LLVMBuildLandingPad(B: BuilderRef, + Ty: TypeRef, + PersFn: ValueRef, + NumClauses: c_uint, + Name: *const c_char) + -> ValueRef; pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef; pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef; diff --git a/src/librustc_trans/builder.rs b/src/librustc_trans/builder.rs index 5b697d6b99c9..4a0b1381a400 100644 --- a/src/librustc_trans/builder.rs +++ b/src/librustc_trans/builder.rs @@ -1012,12 +1012,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } pub fn landing_pad(&self, ty: Type, pers_fn: ValueRef, - num_clauses: usize, - llfn: ValueRef) -> ValueRef { + num_clauses: usize) -> ValueRef { self.count_insn("landingpad"); unsafe { - llvm::LLVMRustBuildLandingPad(self.llbuilder, ty.to_ref(), pers_fn, - num_clauses as c_uint, noname(), llfn) + llvm::LLVMBuildLandingPad(self.llbuilder, ty.to_ref(), pers_fn, + num_clauses as c_uint, noname()) } } diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs index 3cd60e7f1bc7..cfddd99d0dd9 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_trans/intrinsic.rs @@ -925,7 +925,7 @@ fn trans_gnu_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, // rust_try ignores the selector. let lpad_ty = Type::struct_(ccx, &[Type::i8p(ccx), Type::i32(ccx)], false); - let vals = catch.landing_pad(lpad_ty, bcx.ccx.eh_personality(), 1, catch.llfn()); + let vals = catch.landing_pad(lpad_ty, bcx.ccx.eh_personality(), 1); catch.add_clause(vals, C_null(Type::i8p(ccx))); let ptr = catch.extract_value(vals, 0); let ptr_align = bcx.tcx().data_layout.pointer_align; diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index 422b8210b354..8c9fb0395458 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -753,7 +753,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { let llpersonality = self.ccx.eh_personality(); let llretty = self.landing_pad_type(); - let lp = bcx.landing_pad(llretty, llpersonality, 1, self.llfn); + let lp = bcx.landing_pad(llretty, llpersonality, 1); bcx.set_cleanup(lp); let slot = self.get_personality_slot(&bcx); diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index a2022a2eeb23..a19fe825f21f 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -706,7 +706,7 @@ impl From for Box { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Arc { #[inline] fn from(s: CString) -> Arc { @@ -715,7 +715,7 @@ impl From for Arc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl<'a> From<&'a CStr> for Arc { #[inline] fn from(s: &CStr) -> Arc { @@ -724,7 +724,7 @@ impl<'a> From<&'a CStr> for Arc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Rc { #[inline] fn from(s: CString) -> Rc { @@ -733,7 +733,7 @@ impl From for Rc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl<'a> From<&'a CStr> for Rc { #[inline] fn from(s: &CStr) -> Rc { diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index cb902461f39f..109173d31c50 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -594,7 +594,7 @@ impl From for Box { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Arc { #[inline] fn from(s: OsString) -> Arc { @@ -603,7 +603,7 @@ impl From for Arc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl<'a> From<&'a OsStr> for Arc { #[inline] fn from(s: &OsStr) -> Arc { @@ -612,7 +612,7 @@ impl<'a> From<&'a OsStr> for Arc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Rc { #[inline] fn from(s: OsString) -> Rc { @@ -621,7 +621,7 @@ impl From for Rc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl<'a> From<&'a OsStr> for Rc { #[inline] fn from(s: &OsStr) -> Rc { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index eb125a4737a1..bed9efcb8469 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1454,7 +1454,7 @@ impl<'a> From for Cow<'a, Path> { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Arc { #[inline] fn from(s: PathBuf) -> Arc { @@ -1463,7 +1463,7 @@ impl From for Arc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl<'a> From<&'a Path> for Arc { #[inline] fn from(s: &Path) -> Arc { @@ -1472,7 +1472,7 @@ impl<'a> From<&'a Path> for Arc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Rc { #[inline] fn from(s: PathBuf) -> Rc { @@ -1481,7 +1481,7 @@ impl From for Rc { } } -#[stable(feature = "shared_from_slice2", since = "1.23.0")] +#[stable(feature = "shared_from_slice2", since = "1.24.0")] impl<'a> From<&'a Path> for Rc { #[inline] fn from(s: &Path) -> Rc { diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 81f5594bc523..3b4904c98e87 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -382,7 +382,7 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Mutex { } } -#[stable(feature = "mutex_from", since = "1.22.0")] +#[stable(feature = "mutex_from", since = "1.24.0")] impl From for Mutex { /// Creates a new mutex in an unlocked state ready for use. /// This is equivalent to [`Mutex::new`]. diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index fd6cff6b69c4..0f3f4e50f7e3 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -457,7 +457,7 @@ impl Default for RwLock { } } -#[stable(feature = "rw_lock_from", since = "1.22.0")] +#[stable(feature = "rw_lock_from", since = "1.24.0")] impl From for RwLock { /// Creates a new instance of an `RwLock` which is unlocked. /// This is equivalent to [`RwLock::new`]. diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 6f51ea67cb1d..96fb05ee06e3 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -1144,13 +1144,6 @@ extern "C" void LLVMRustWriteSMDiagnosticToString(LLVMSMDiagnosticRef D, unwrap(D)->print("", OS); } -extern "C" LLVMValueRef -LLVMRustBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, - LLVMValueRef PersFn, unsigned NumClauses, - const char *Name, LLVMValueRef F) { - return LLVMBuildLandingPad(B, Ty, PersFn, NumClauses, Name); -} - extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, unsigned ArgCount, @@ -1355,10 +1348,6 @@ extern "C" bool LLVMRustConstInt128Get(LLVMValueRef CV, bool sext, uint64_t *hig return true; } -extern "C" LLVMContextRef LLVMRustGetValueContext(LLVMValueRef V) { - return wrap(&unwrap(V)->getContext()); -} - enum class LLVMRustVisibility { Default = 0, Hidden = 1, @@ -1439,11 +1428,6 @@ LLVMRustModuleBufferLen(const LLVMRustModuleBuffer *Buffer) { extern "C" uint64_t LLVMRustModuleCost(LLVMModuleRef M) { - Module &Mod = *unwrap(M); - uint64_t cost = 0; - for (auto &F : Mod.functions()) { - (void)F; - cost += 1; - } - return cost; + auto f = unwrap(M)->functions(); + return std::distance(std::begin(f), std::end(f)); }