diff --git a/patches/0022-core-Disable-not-compiling-tests.patch b/patches/0022-core-Disable-not-compiling-tests.patch index 009b2fed0f9..ee8548783de 100644 --- a/patches/0022-core-Disable-not-compiling-tests.patch +++ b/patches/0022-core-Disable-not-compiling-tests.patch @@ -112,7 +112,7 @@ index 6609bc3..241b497 100644 #[cfg(not(target_arch = "wasm32"))] fn sort_unstable() { @@ -1394,6 +1395,7 @@ fn partition_at_index() { - v.partition_at_index(0); + v.select_nth_unstable(0); assert!(v == [0xDEADBEEF]); } +*/ diff --git a/rust-toolchain b/rust-toolchain index d9e199b78ff..ab4c3c84c96 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-10-12 +nightly-2020-10-15 diff --git a/src/base.rs b/src/base.rs index 9f558bc7520..fa9b8853d39 100644 --- a/src/base.rs +++ b/src/base.rs @@ -299,19 +299,19 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) { TerminatorKind::SwitchInt { discr, switch_ty, - values, targets, } => { let discr = trans_operand(fx, discr).load_scalar(fx); if switch_ty.kind() == fx.tcx.types.bool.kind() { - assert_eq!(targets.len(), 2); - let then_block = fx.get_block(targets[0]); - let else_block = fx.get_block(targets[1]); - let test_zero = match **values { - [0] => true, - [1] => false, - _ => unreachable!("{:?}", values), + assert_eq!(targets.iter().count(), 1); + let (then_value, then_block) = targets.iter().next().unwrap(); + let then_block = fx.get_block(then_block); + let else_block = fx.get_block(targets.otherwise()); + let test_zero = match then_value { + 0 => true, + 1 => false, + _ => unreachable!("{:?}", targets), }; let discr = crate::optimize::peephole::maybe_unwrap_bint(&mut fx.bcx, discr); @@ -330,11 +330,11 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) { } } else { let mut switch = ::cranelift_frontend::Switch::new(); - for (i, value) in values.iter().enumerate() { - let block = fx.get_block(targets[i]); - switch.set_entry(*value, block); + for (value, block) in targets.iter() { + let block = fx.get_block(block); + switch.set_entry(value, block); } - let otherwise_block = fx.get_block(targets[targets.len() - 1]); + let otherwise_block = fx.get_block(targets.otherwise()); switch.emit(&mut fx.bcx, discr, otherwise_block); } } diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 2b3d1b7885d..e7595abe178 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -302,7 +302,6 @@ pub(super) fn run_aot( modules, allocator_module, metadata_module, - crate_hash: tcx.crate_hash(LOCAL_CRATE), metadata, windows_subsystem: None, // Windows is not yet supported linker_info: LinkerInfo::new(tcx), diff --git a/src/lib.rs b/src/lib.rs index 2fa4f9e0ead..af359456e69 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ use std::any::Any; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_codegen_ssa::CodegenResults; use rustc_errors::ErrorReported; -use rustc_middle::dep_graph::{DepGraph, WorkProduct, WorkProductId}; +use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_middle::middle::cstore::{EncodedMetadata, MetadataLoader}; use rustc_middle::ty::query::Providers; use rustc_session::config::OutputFilenames; @@ -190,23 +190,7 @@ impl CodegenBackend for CraneliftCodegenBackend { Box::new(crate::metadata::CraneliftMetadataLoader) } - fn provide(&self, providers: &mut Providers) { - providers.supported_target_features = |tcx, cnum| { - assert_eq!(cnum, LOCAL_CRATE); - if tcx.sess.opts.actually_rustdoc { - // rustdoc needs to be able to document functions that use all the features, so - // whitelist them all - rustc_codegen_ssa::target_features::all_known_features() - .map(|(a, b)| (a.to_string(), b)) - .collect() - } else { - rustc_codegen_ssa::target_features::supported_target_features(tcx.sess) - .iter() - .map(|&(a, b)| (a.to_string(), b)) - .collect() - } - }; - } + fn provide(&self, _providers: &mut Providers) {} fn provide_extern(&self, _providers: &mut Providers) {} fn target_features(&self, _sess: &Session) -> Vec { @@ -229,34 +213,21 @@ impl CodegenBackend for CraneliftCodegenBackend { fn join_codegen( &self, ongoing_codegen: Box, - sess: &Session, - dep_graph: &DepGraph, - ) -> Result, ErrorReported> { - let (codegen_results, work_products) = *ongoing_codegen + _sess: &Session, + ) -> Result<(CodegenResults, FxHashMap), ErrorReported> { + Ok(*ongoing_codegen .downcast::<(CodegenResults, FxHashMap)>() - .unwrap(); - - sess.time("serialize_work_products", move || { - rustc_incremental::save_work_product_index(sess, &dep_graph, work_products) - }); - - Ok(Box::new(codegen_results)) + .unwrap()) } fn link( &self, sess: &Session, - res: Box, + codegen_results: CodegenResults, outputs: &OutputFilenames, ) -> Result<(), ErrorReported> { use rustc_codegen_ssa::back::link::link_binary; - sess.abort_if_errors(); - - let codegen_results = *res - .downcast::() - .expect("Expected CraneliftCodegenBackend's CodegenResult, found Box"); - let _timer = sess.prof.generic_activity("link_crate"); sess.time("linking", || { @@ -270,8 +241,6 @@ impl CodegenBackend for CraneliftCodegenBackend { ); }); - rustc_incremental::finalize_session_directory(sess, codegen_results.crate_hash); - Ok(()) } }