From de792ad690a1a72d3c29dbfdc159128b004a8b9c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 15 Apr 2019 16:34:16 +0200 Subject: [PATCH] Rustup to rustc 1.35.0-nightly (aa99abeb2 2019-04-14) --- ...002-Disable-u128-and-i128-in-libcore.patch | 3 +++ .../0015-Remove-usage-of-unsized-locals.patch | 4 ++-- src/base.rs | 23 +++++++++++++------ src/lib.rs | 2 +- src/link.rs | 2 +- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/patches/0002-Disable-u128-and-i128-in-libcore.patch b/patches/0002-Disable-u128-and-i128-in-libcore.patch index 69f82eb9ac2..97ed483f7d7 100644 --- a/patches/0002-Disable-u128-and-i128-in-libcore.patch +++ b/patches/0002-Disable-u128-and-i128-in-libcore.patch @@ -281,6 +281,9 @@ index 828d572..bc04fb1 100644 #[stable(feature = "nonzero", since = "1.28.0")] -pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize}; +pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroUsize}; + #[stable(feature = "signed_nonzero", since = "1.34.0")] +-pub use core::num::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize}; ++pub use core::num::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroIsize}; #[cfg(test)] use crate::fmt; #[cfg(test)] use crate::ops::{Add, Sub, Mul, Div, Rem}; diff --git a/patches/0015-Remove-usage-of-unsized-locals.patch b/patches/0015-Remove-usage-of-unsized-locals.patch index 277d44ebfa4..2f104ad5b25 100644 --- a/patches/0015-Remove-usage-of-unsized-locals.patch +++ b/patches/0015-Remove-usage-of-unsized-locals.patch @@ -62,7 +62,7 @@ index 1181b86..20f9251 100644 } +*/ - pub fn push(f: Box) -> bool { + pub fn push(f: Box) -> bool { unsafe { diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 6260c3b..611ed7e 100644 @@ -89,7 +89,7 @@ index b2142e7..718bb1c 100644 - let _handler = stack_overflow::Handler::new(); - - // Finally, let's run some code. -- Box::from_raw(main as *mut Box)() +- Box::from_raw(main as *mut Box)() + panic!("Threads are not yet supported, because cranelift doesn't support atomics."); } diff --git a/src/base.rs b/src/base.rs index 3f9fef329c3..0fb69e2a1e3 100644 --- a/src/base.rs +++ b/src/base.rs @@ -410,8 +410,13 @@ fn trans_stmt<'a, 'tcx: 'a>( layout::Variants::Single { index } => { assert_eq!(index, *variant_index); } - layout::Variants::Multiple { discr_kind: layout::DiscriminantKind::Tag, .. } => { - let ptr = place.place_field(fx, mir::Field::new(0)); + layout::Variants::Multiple { + discr: _, + discr_index, + discr_kind: layout::DiscriminantKind::Tag, + variants: _, + } => { + let ptr = place.place_field(fx, mir::Field::new(discr_index)); let to = layout .ty .ty_adt_def() @@ -422,15 +427,17 @@ fn trans_stmt<'a, 'tcx: 'a>( ptr.write_cvalue(fx, discr); } layout::Variants::Multiple { + discr: _, + discr_index, discr_kind: layout::DiscriminantKind::Niche { dataful_variant, ref niche_variants, niche_start, }, - .. + variants: _, } => { if *variant_index != dataful_variant { - let niche = place.place_field(fx, mir::Field::new(0)); + let niche = place.place_field(fx, mir::Field::new(discr_index)); //let niche_llty = niche.layout.immediate_llvm_type(bx.cx); let niche_value = ((variant_index.as_u32() - niche_variants.start().as_u32()) as u128) @@ -767,7 +774,7 @@ pub fn trans_get_discriminant<'a, 'tcx: 'a>( return trap_unreachable_ret_value(fx, dest_layout, "[panic] Tried to get discriminant for uninhabited type."); } - let (discr_scalar, discr_kind) = match &layout.variants { + let (discr_scalar, discr_index, discr_kind) = match &layout.variants { layout::Variants::Single { index } => { let discr_val = layout .ty @@ -777,10 +784,12 @@ pub fn trans_get_discriminant<'a, 'tcx: 'a>( }); return CValue::const_val(fx, dest_layout.ty, discr_val as u64 as i64); } - layout::Variants::Multiple { discr, discr_kind, variants: _ } => (discr, discr_kind), + layout::Variants::Multiple { discr, discr_index, discr_kind, variants: _ } => { + (discr, *discr_index, discr_kind) + } }; - let discr = place.place_field(fx, mir::Field::new(0)).to_cvalue(fx); + let discr = place.place_field(fx, mir::Field::new(discr_index)).to_cvalue(fx); let discr_ty = discr.layout().ty; let lldiscr = discr.load_scalar(fx); match discr_kind { diff --git a/src/lib.rs b/src/lib.rs index f9f899a8575..8fb35c6e342 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -173,7 +173,7 @@ impl CodegenBackend for CraneliftCodegenBackend { if sess.opts.cg.rpath { sess.err("rpath is not yet supported"); } - if sess.opts.debugging_opts.pgo_gen.is_some() { + if sess.opts.debugging_opts.pgo_gen.enabled() { sess.err("pgo is not supported"); } } diff --git a/src/link.rs b/src/link.rs index ca349de4848..4f0a15cdf00 100644 --- a/src/link.rs +++ b/src/link.rs @@ -448,7 +448,7 @@ fn link_args(cmd: &mut dyn Linker, cmd.build_static_executable(); } - if sess.opts.debugging_opts.pgo_gen.is_some() { + if sess.opts.debugging_opts.pgo_gen.enabled() { cmd.pgo_gen(); }