Skip to content

Commit 3fc673d

Browse files
committed
Rustup to rustc 1.49.0-nightly (beb5ae474 2020-10-04)
1 parent ab92638 commit 3fc673d

File tree

5 files changed

+53
-165
lines changed

5 files changed

+53
-165
lines changed

build_sysroot/build_sysroot.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort"
2424
if [[ "$1" == "--release" ]]; then
2525
sysroot_channel='release'
2626
# FIXME Enable incremental again once rust-lang/rust#74946 is fixed
27-
CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=2" cargo build --target $TARGET_TRIPLE --release
27+
# FIXME Enable -Zmir-opt-level=2 again once it doesn't ice anymore
28+
CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS" cargo build --target $TARGET_TRIPLE --release
2829
else
2930
sysroot_channel='debug'
3031
cargo build --target $TARGET_TRIPLE

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2020-10-02
1+
nightly-2020-10-05

src/allocator.rs

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use crate::prelude::*;
55

66
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
7+
use rustc_span::symbol::sym;
78

89
/// Returns whether an allocator shim was created
910
pub(crate) fn codegen(
@@ -87,10 +88,9 @@ fn codegen_inner(
8788
.collect::<Vec<Value>>();
8889

8990
let callee_func_ref = module.declare_func_in_func(callee_func_id, &mut bcx.func);
90-
9191
let call_inst = bcx.ins().call(callee_func_ref, &args);
92-
9392
let results = bcx.inst_results(call_inst).to_vec(); // Clone to prevent borrow error
93+
9494
bcx.ins().return_(&results);
9595
bcx.seal_all_blocks();
9696
bcx.finalize();
@@ -104,4 +104,50 @@ fn codegen_inner(
104104
.unwrap();
105105
unwind_context.add_function(func_id, &ctx, module.isa());
106106
}
107+
108+
let sig = Signature {
109+
call_conv: CallConv::triple_default(module.isa().triple()),
110+
params: vec![AbiParam::new(usize_ty), AbiParam::new(usize_ty)],
111+
returns: vec![],
112+
};
113+
114+
let callee_name = kind.fn_name(sym::oom);
115+
//eprintln!("Codegen allocator shim {} -> {} ({:?} -> {:?})", caller_name, callee_name, sig.params, sig.returns);
116+
117+
let func_id = module
118+
.declare_function("__rust_alloc_error_handler", Linkage::Export, &sig)
119+
.unwrap();
120+
121+
let callee_func_id = module
122+
.declare_function(&callee_name, Linkage::Import, &sig)
123+
.unwrap();
124+
125+
let mut ctx = Context::new();
126+
ctx.func = Function::with_name_signature(ExternalName::user(0, 0), sig.clone());
127+
{
128+
let mut func_ctx = FunctionBuilderContext::new();
129+
let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
130+
131+
let block = bcx.create_block();
132+
bcx.switch_to_block(block);
133+
let args = (&[usize_ty, usize_ty])
134+
.into_iter()
135+
.map(|&ty| bcx.append_block_param(block, ty))
136+
.collect::<Vec<Value>>();
137+
138+
let callee_func_ref = module.declare_func_in_func(callee_func_id, &mut bcx.func);
139+
bcx.ins().call(callee_func_ref, &args);
140+
141+
bcx.ins().trap(TrapCode::UnreachableCodeReached);
142+
bcx.seal_all_blocks();
143+
bcx.finalize();
144+
}
145+
module
146+
.define_function(
147+
func_id,
148+
&mut ctx,
149+
&mut cranelift_codegen::binemit::NullTrapSink {},
150+
)
151+
.unwrap();
152+
unwind_context.add_function(func_id, &ctx, module.isa());
107153
}

src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ mod num;
7272
mod optimize;
7373
mod pointer;
7474
mod pretty_clif;
75-
mod target_features_whitelist;
7675
mod toolchain;
7776
mod trap;
7877
mod unsize;
@@ -207,11 +206,11 @@ impl CodegenBackend for CraneliftCodegenBackend {
207206
if tcx.sess.opts.actually_rustdoc {
208207
// rustdoc needs to be able to document functions that use all the features, so
209208
// whitelist them all
210-
target_features_whitelist::all_known_features()
209+
rustc_codegen_ssa::target_features::all_known_features()
211210
.map(|(a, b)| (a.to_string(), b))
212211
.collect()
213212
} else {
214-
target_features_whitelist::supported_target_features(tcx.sess)
213+
rustc_codegen_ssa::target_features::supported_target_features(tcx.sess)
215214
.iter()
216215
.map(|&(a, b)| (a.to_string(), b))
217216
.collect()

src/target_features_whitelist.rs

Lines changed: 0 additions & 158 deletions
This file was deleted.

0 commit comments

Comments
 (0)