From 06dd020446f690b21683f93edd3124d7ef0c07c1 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 16 Feb 2019 12:35:45 +0100 Subject: [PATCH] Rustup to rustc 1.34.0-nightly (a9410cd1a 2019-02-15) --- ...002-Disable-u128-and-i128-in-libcore.patch | 78 +++++++++-------- src/base.rs | 85 ++++++++++--------- src/constant.rs | 8 +- src/link.rs | 23 ++++- src/link_copied.rs | 10 +-- 5 files changed, 108 insertions(+), 96 deletions(-) diff --git a/patches/0002-Disable-u128-and-i128-in-libcore.patch b/patches/0002-Disable-u128-and-i128-in-libcore.patch index ab41edd6ed52..0d1507d9eff1 100644 --- a/patches/0002-Disable-u128-and-i128-in-libcore.patch +++ b/patches/0002-Disable-u128-and-i128-in-libcore.patch @@ -1,32 +1,32 @@ -From 1119ae3f160d7e89064583f1d9d6685bc2e6928b Mon Sep 17 00:00:00 2001 +From 8080d322c8396b7b234cc92eb675f697c55f7298 Mon Sep 17 00:00:00 2001 From: bjorn3 -Date: Wed, 13 Feb 2019 14:37:22 +0100 +Date: Sat, 16 Feb 2019 12:09:42 +0100 Subject: [PATCH] Disable u128 and i128 in libcore --- src/libcore/clone.rs | 4 +- src/libcore/cmp.rs | 6 +- src/libcore/default.rs | 2 - - src/libcore/fmt/num.rs | 6 +- - src/libcore/hash/mod.rs | 20 ------- + src/libcore/fmt/num.rs | 8 +- + src/libcore/hash/mod.rs | 20 ----- src/libcore/iter/range.rs | 1 - src/libcore/iter/traits/accum.rs | 2 +- src/libcore/lib.rs | 2 - src/libcore/marker.rs | 4 +- src/libcore/mem.rs | 2 - - src/libcore/num/mod.rs | 100 +++++++++---------------------- - src/libcore/num/wrapping.rs | 14 ++--- - src/libcore/ops/arith.rs | 22 +++---- - src/libcore/ops/bit.rs | 30 ++++------ - src/libcore/sync/atomic.rs | 30 ---------- - src/libcore/tests/iter.rs | 15 ----- - src/libcore/tests/num/mod.rs | 18 ------ - src/libcore/time.rs | 123 --------------------------------------- - src/libstd/lib.rs | 4 -- - src/libstd/net/ip.rs | 20 ------- + src/libcore/num/mod.rs | 100 +++++++------------------ + src/libcore/num/wrapping.rs | 14 ++-- + src/libcore/ops/arith.rs | 22 +++--- + src/libcore/ops/bit.rs | 30 +++----- + src/libcore/sync/atomic.rs | 30 -------- + src/libcore/tests/iter.rs | 15 ---- + src/libcore/tests/num/mod.rs | 18 ----- + src/libcore/time.rs | 123 ------------------------------- + src/libstd/lib.rs | 4 - + src/libstd/net/ip.rs | 20 ----- src/libstd/num.rs | 2 +- src/libstd/panic.rs | 6 -- - 22 files changed, 63 insertions(+), 370 deletions(-) + 22 files changed, 63 insertions(+), 372 deletions(-) diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index ed90b7d..1739f91 100644 @@ -94,7 +94,7 @@ index 5ad05b3..1b5a1d1 100644 default_impl! { f32, 0.0f32, "Returns the default value of `0.0`" } default_impl! { f64, 0.0f64, "Returns the default value of `0.0`" } diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs -index 3a81233..f889d57 100644 +index b9fa364..cd9ee01 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -17,7 +17,6 @@ trait Int: PartialEq + PartialOrd + Div + Rem + @@ -117,22 +117,21 @@ index 3a81233..f889d57 100644 /// A type that represents a specific radix #[doc(hidden)] -@@ -176,7 +174,6 @@ integer! { i8, u8 } +@@ -176,8 +174,6 @@ integer! { i8, u8 } integer! { i16, u16 } integer! { i32, u32 } integer! { i64, u64 } -integer! { i128, u128 } +- - const DEC_DIGITS_LUT: &'static[u8] = + static DEC_DIGITS_LUT: &[u8; 200] = b"0001020304050607080910111213141516171819\ -@@ -252,7 +249,6 @@ macro_rules! impl_Display { - - impl_Display!(i8, u8, i16, u16, i32, u32: to_u32); - impl_Display!(i64, u64: to_u64); --impl_Display!(i128, u128: to_u128); - #[cfg(target_pointer_width = "16")] - impl_Display!(isize, usize: to_u16); - #[cfg(target_pointer_width = "32")] +@@ -274,5 +270,3 @@ mod imp { + impl_Display!(i8, u8, i16, u16, i32, u32, isize, usize as u32 via to_u32 named fmt_u32); + impl_Display!(i64, u64 as u64 via to_u64 named fmt_u64); + } +- +-impl_Display!(i128, u128 as u128 via to_u128 named fmt_u128); diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index d5d29c9..f98f382 100644 --- a/src/libcore/hash/mod.rs @@ -218,10 +217,10 @@ index dfe1d2a..06cc578 100644 /// An iterator adapter that produces output as long as the underlying diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs -index 9b37104..787b10b 100644 +index cd88d3e..532d680 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs -@@ -147,14 +147,12 @@ mod uint_macros; +@@ -148,14 +148,12 @@ mod uint_macros; #[path = "num/i16.rs"] pub mod i16; #[path = "num/i32.rs"] pub mod i32; #[path = "num/i64.rs"] pub mod i64; @@ -237,7 +236,7 @@ index 9b37104..787b10b 100644 #[path = "num/f32.rs"] pub mod f32; #[path = "num/f64.rs"] pub mod f64; diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs -index 457d556..91425fb 100644 +index c4b41f1..0ade53b 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -664,8 +664,8 @@ mod copy_impls { @@ -252,7 +251,7 @@ index 457d556..91425fb 100644 bool char } diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs -index 2a493e8..a7dba54 100644 +index 3f7455a..7a0c44a 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -164,12 +164,10 @@ pub fn forget_unsized(t: T) { @@ -898,10 +897,11 @@ index 51a6017..e6631db 100644 #[derive(Clone)] struct Test(Bigger); -@@ -1977,19 +1975,6 @@ fn test_step_replace_signed() { +@@ -1976,19 +1974,6 @@ fn test_step_replace_signed() { + assert_eq!(y, 5); } - #[test] +-#[test] -fn test_step_replace_no_between() { - let mut x = 4u128; - let y = x.replace_zero(); @@ -914,10 +914,9 @@ index 51a6017..e6631db 100644 - assert_eq!(y, 5); -} - --#[test] + #[test] fn test_rev_try_folds() { let f = &|acc, x| i32::checked_add(2*acc, x); - assert_eq!((1..10).rev().try_fold(7, f), (1..10).try_rfold(7, f)); diff --git a/src/libcore/tests/num/mod.rs b/src/libcore/tests/num/mod.rs index ab638e0..4a2aa4c 100644 --- a/src/libcore/tests/num/mod.rs @@ -1136,10 +1135,10 @@ index ac7e117..0dfd856 100644 /// /// # Examples diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs -index 3c358dc..2dd5699 100644 +index 9a4232d..592fea0 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs -@@ -395,8 +395,6 @@ pub use core::i16; +@@ -392,8 +392,6 @@ pub use core::i16; pub use core::i32; #[stable(feature = "rust1", since = "1.0.0")] pub use core::i64; @@ -1148,7 +1147,7 @@ index 3c358dc..2dd5699 100644 #[stable(feature = "rust1", since = "1.0.0")] pub use core::usize; #[stable(feature = "rust1", since = "1.0.0")] -@@ -429,8 +427,6 @@ pub use alloc_crate::string; +@@ -426,8 +424,6 @@ pub use alloc_crate::string; pub use alloc_crate::vec; #[stable(feature = "rust1", since = "1.0.0")] pub use core::char; @@ -1202,7 +1201,7 @@ index c80b9a5..e32a6b3 100644 #[cfg(test)] use fmt; #[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem}; diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs -index d27f6ca..8ac2a44 100644 +index 862fdf0..171ebeb 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -254,9 +254,6 @@ impl RefUnwindSafe for atomic::AtomicI32 {} @@ -1226,5 +1225,4 @@ index d27f6ca..8ac2a44 100644 #[cfg(target_has_atomic = "8")] #[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")] -- -2.11.0 - +2.17.2 (Apple Git-113) diff --git a/src/base.rs b/src/base.rs index d2f31de71d19..844c2479fd5f 100644 --- a/src/base.rs +++ b/src/base.rs @@ -392,6 +392,7 @@ fn trans_stmt<'a, 'tcx: 'a>( ty::Float(_) => trans_float_binop(fx, *bin_op, lhs, rhs, lval.layout().ty), ty::Char => trans_char_binop(fx, *bin_op, lhs, rhs, lval.layout().ty), ty::RawPtr(..) => trans_ptr_binop(fx, *bin_op, lhs, rhs, lval.layout().ty), + ty::FnPtr(..) => trans_ptr_binop(fx, *bin_op, lhs, rhs, lval.layout().ty), _ => unimplemented!("binop {:?} for {:?}", bin_op, ty), }; lval.write_cvalue(fx, res); @@ -992,49 +993,49 @@ fn trans_ptr_binop<'a, 'tcx: 'a>( rhs: CValue<'tcx>, ret_ty: Ty<'tcx>, ) -> CValue<'tcx> { - match lhs.layout().ty.sty { - ty::RawPtr(TypeAndMut { ty, mutbl: _ }) => { - if ty.is_sized(fx.tcx.at(DUMMY_SP), ParamEnv::reveal_all()) { - binop_match! { - fx, bin_op, false, lhs, rhs, ret_ty, "ptr"; - Add (_) bug; - Sub (_) bug; - Mul (_) bug; - Div (_) bug; - Rem (_) bug; - BitXor (_) bug; - BitAnd (_) bug; - BitOr (_) bug; - Shl (_) bug; - Shr (_) bug; - - Eq (_) icmp(Equal); - Lt (_) icmp(UnsignedLessThan); - Le (_) icmp(UnsignedLessThanOrEqual); - Ne (_) icmp(NotEqual); - Ge (_) icmp(UnsignedGreaterThanOrEqual); - Gt (_) icmp(UnsignedGreaterThan); - - Offset (_) iadd; - } - } else { - let lhs = lhs.load_value_pair(fx).0; - let rhs = rhs.load_value_pair(fx).0; - let res = match bin_op { - BinOp::Eq => fx.bcx.ins().icmp(IntCC::Equal, lhs, rhs), - BinOp::Ne => fx.bcx.ins().icmp(IntCC::NotEqual, lhs, rhs), - _ => unimplemented!( - "trans_ptr_binop({:?}, , ) not implemented", - bin_op - ), - }; - - assert_eq!(fx.tcx.types.bool, ret_ty); - let ret_layout = fx.layout_of(ret_ty); - CValue::ByVal(fx.bcx.ins().bint(types::I8, res), ret_layout) - } - } + let not_fat = match lhs.layout().ty.sty { + ty::RawPtr(TypeAndMut { ty, mutbl: _ }) => ty.is_sized(fx.tcx.at(DUMMY_SP), ParamEnv::reveal_all()), + ty::FnPtr(..) => true, _ => bug!("trans_ptr_binop on non ptr"), + }; + if not_fat { + binop_match! { + fx, bin_op, false, lhs, rhs, ret_ty, "ptr"; + Add (_) bug; + Sub (_) bug; + Mul (_) bug; + Div (_) bug; + Rem (_) bug; + BitXor (_) bug; + BitAnd (_) bug; + BitOr (_) bug; + Shl (_) bug; + Shr (_) bug; + + Eq (_) icmp(Equal); + Lt (_) icmp(UnsignedLessThan); + Le (_) icmp(UnsignedLessThanOrEqual); + Ne (_) icmp(NotEqual); + Ge (_) icmp(UnsignedGreaterThanOrEqual); + Gt (_) icmp(UnsignedGreaterThan); + + Offset (_) iadd; + } + } else { + let lhs = lhs.load_value_pair(fx).0; + let rhs = rhs.load_value_pair(fx).0; + let res = match bin_op { + BinOp::Eq => fx.bcx.ins().icmp(IntCC::Equal, lhs, rhs), + BinOp::Ne => fx.bcx.ins().icmp(IntCC::NotEqual, lhs, rhs), + _ => unimplemented!( + "trans_ptr_binop({:?}, , ) not implemented", + bin_op + ), + }; + + assert_eq!(fx.tcx.types.bool, ret_ty); + let ret_layout = fx.layout_of(ret_ty); + CValue::ByVal(fx.bcx.ins().bint(types::I8, res), ret_layout) } } diff --git a/src/constant.rs b/src/constant.rs index 8f05df353c9e..29c5a0f38e45 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -5,7 +5,7 @@ use rustc::mir::interpret::{ }; use rustc::ty::{Const, LazyConst}; use rustc_mir::interpret::{ - EvalContext, MPlaceTy, Machine, Memory, MemoryKind, OpTy, PlaceTy, Pointer, StackPopCleanup, + EvalContext, MPlaceTy, Machine, Memory, MemoryKind, OpTy, PlaceTy, Pointer, StackPopCleanup, ImmTy, }; use cranelift_module::*; @@ -337,10 +337,8 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for TransPlaceInterpreter { fn ptr_op( _: &EvalContext<'a, 'mir, 'tcx, Self>, _: mir::BinOp, - _: Scalar, - _: TyLayout<'tcx>, - _: Scalar, - _: TyLayout<'tcx>, + _: ImmTy<'tcx>, + _: ImmTy<'tcx>, ) -> EvalResult<'tcx, (Scalar, bool)> { panic!(); } diff --git a/src/link.rs b/src/link.rs index b600413fad23..ca349de4848d 100644 --- a/src/link.rs +++ b/src/link.rs @@ -291,7 +291,7 @@ fn link_args(cmd: &mut dyn Linker, codegen_results: &CodegenResults) { // Linker plugins should be specified early in the list of arguments - cmd.cross_lang_lto(); + cmd.linker_plugin_lto(); // The default library location, we need this to find the runtime. // The location of crates will be determined as needed. @@ -306,6 +306,13 @@ fn link_args(cmd: &mut dyn Linker, } cmd.output_filename(out_filename); + if crate_type == config::CrateType::Executable && + sess.target.target.options.is_like_windows { + if let Some(ref s) = codegen_results.windows_subsystem { + cmd.subsystem(s); + } + } + // If we're building a dynamic library then some platforms need to make sure // that all symbols are exported correctly from the dynamic library. if crate_type != config::CrateType::Executable || @@ -313,6 +320,16 @@ fn link_args(cmd: &mut dyn Linker, cmd.export_symbols(tmpdir, crate_type); } + // When linking a dynamic library, we put the metadata into a section of the + // executable. This metadata is in a separate object file from the main + // object file, so we link that in here. + if crate_type == config::CrateType::Dylib || + crate_type == config::CrateType::ProcMacro { + if let Some(obj) = codegen_results.metadata_module.object.as_ref() { + cmd.add_object(obj); + } + } + let obj = codegen_results.allocator_module .as_ref() .and_then(|m| m.object.as_ref()); @@ -409,7 +426,7 @@ fn link_args(cmd: &mut dyn Linker, // // The rationale behind this ordering is that those items lower down in the // list can't depend on items higher up in the list. For example nothing can - // depend on what we just generated (e.g. that'd be a circular dependency). + // depend on what we just generated (e.g., that'd be a circular dependency). // Upstream rust libraries are not allowed to depend on our local native // libraries as that would violate the structure of the DAG, in that // scenario they are required to link to them as well in a shared fashion. @@ -418,7 +435,7 @@ fn link_args(cmd: &mut dyn Linker, // well, but they also can't depend on what we just started to add to the // link line. And finally upstream native libraries can't depend on anything // in this DAG so far because they're only dylibs and dylibs can only depend - // on other dylibs (e.g. other native deps). + // on other dylibs (e.g., other native deps). add_local_native_libraries(cmd, sess, codegen_results); add_upstream_rust_crates(cmd, sess, codegen_results, crate_type, tmpdir); add_upstream_native_libraries(cmd, sess, codegen_results, crate_type); diff --git a/src/link_copied.rs b/src/link_copied.rs index c19a6eec7391..517455e92752 100644 --- a/src/link_copied.rs +++ b/src/link_copied.rs @@ -177,8 +177,7 @@ pub fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdi // ensure the line is interpreted as one whole argument. for c in self.arg.chars() { match c { - '\\' | - ' ' => write!(f, "\\{}", c)?, + '\\' | ' ' => write!(f, "\\{}", c)?, c => write!(f, "{}", c)?, } } @@ -298,7 +297,7 @@ pub fn add_upstream_rust_crates(cmd: &mut dyn Linker, // compiler-builtins are always placed last to ensure that they're // linked correctly. // We must always link the `compiler_builtins` crate statically. Even if it - // was already "included" in a dylib (e.g. `libstd` when `-C prefer-dynamic` + // was already "included" in a dylib (e.g., `libstd` when `-C prefer-dynamic` // is used) if let Some(cnum) = compiler_builtins { add_static_crate(cmd, sess, codegen_results, tmpdir, crate_type, cnum); @@ -345,7 +344,6 @@ pub fn add_upstream_rust_crates(cmd: &mut dyn Linker, for f in archive.src_files() { if f.ends_with(RLIB_BYTECODE_EXTENSION) || f == METADATA_FILENAME { archive.remove_file(&f); - continue } } @@ -479,7 +477,7 @@ pub fn add_upstream_rust_crates(cmd: &mut dyn Linker, // because a `dylib` can be reused as an intermediate artifact. // // Note, though, that we don't want to include the whole of a - // compiler-builtins crate (e.g. compiler-rt) because it'll get + // compiler-builtins crate (e.g., compiler-rt) because it'll get // repeatedly linked anyway. if crate_type == config::CrateType::Dylib && codegen_results.crate_info.compiler_builtins != Some(cnum) { @@ -628,7 +626,7 @@ fn are_upstream_rust_objects_already_included(sess: &Session) -> bool { Lto::Thin => { // If we defer LTO to the linker, we haven't run LTO ourselves, so // any upstream object files have not been copied yet. - !sess.opts.debugging_opts.cross_lang_lto.enabled() + !sess.opts.cg.linker_plugin_lto.enabled() } Lto::No | Lto::ThinLocal => false,