Rustup to rustc 1.45.0-nightly (56daaf669 2020-06-03)

This commit is contained in:
bjorn3 2020-06-04 19:57:12 +02:00
parent 1e70c51f60
commit 648b634e21
9 changed files with 35 additions and 32 deletions

View File

@ -67,9 +67,9 @@ dependencies = [
[[package]]
name = "compiler_builtins"
version = "0.1.28"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439a6fab343b1dab347823537734a5cd4ae6ae2000b465ab886f64cdb723bd14"
checksum = "7bc4ac2c824d2bfc612cba57708198547e9a26943af0632aff033e0693074d5c"
dependencies = [
"rustc-std-workspace-core",
]

View File

@ -401,7 +401,7 @@ pub trait FnMut<Args>: FnOnce<Args> {
#[lang = "panic"]
#[track_caller]
pub fn panic(msg: &str) -> ! {
pub fn panic(_msg: &str) -> ! {
unsafe {
libc::puts("Panicking\n\0" as *const str as *const u8);
intrinsics::abort();

View File

@ -414,10 +414,10 @@ pub enum E2<X> {
fn check_niche_behavior () {
if let E1::V2 { .. } = (E1::V1 { f: true }) {
unsafe { intrinsics::abort(); }
intrinsics::abort();
}
if let E2::V1 { .. } = E2::V3::<Infallible> {
unsafe { intrinsics::abort(); }
intrinsics::abort();
}
}

View File

@ -6,9 +6,7 @@ extern {}
#[panic_handler]
fn panic_handler(_: &core::panic::PanicInfo) -> ! {
unsafe {
core::intrinsics::abort();
}
core::intrinsics::abort();
}
#[lang="eh_personality"]
@ -32,6 +30,6 @@ fn main(_argc: isize, _argv: *const *const u8) -> isize {
#[inline(never)]
fn black_box(i: u32) {
if i != 1 {
unsafe { core::intrinsics::abort(); }
core::intrinsics::abort();
}
}

View File

@ -1 +1 @@
nightly-2020-05-25
nightly-2020-06-04

View File

@ -309,6 +309,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
operands,
options: _,
destination,
line_spans: _,
} => {
match template {
&[] => {
@ -396,6 +397,10 @@ fn trans_stmt<'tcx>(
let place = trans_place(fx, *place);
place.write_place_ref(fx, lval);
}
Rvalue::ThreadLocalRef(def_id) => {
let val = crate::constant::codegen_tls_ref(fx, *def_id, lval.layout());
lval.write_cvalue(fx, val);
}
Rvalue::BinaryOp(bin_op, lhs, rhs) => {
let lhs = trans_operand(fx, lhs);
let rhs = trans_operand(fx, rhs);
@ -708,7 +713,7 @@ pub(crate) fn trans_place<'tcx>(
let mut cplace = fx.get_local_place(place.local);
for elem in place.projection {
match *elem {
match elem {
PlaceElem::Deref => {
cplace = cplace.place_deref(fx);
}

View File

@ -8,7 +8,7 @@ use rustc_middle::ty::{Const, ConstKind};
use rustc_target::abi::Align;
use rustc_data_structures::fx::FxHashSet;
use cranelift_codegen::ir::GlobalValue;
use cranelift_codegen::ir::GlobalValueData;
use cranelift_module::*;
use crate::prelude::*;
@ -38,6 +38,20 @@ pub(crate) fn codegen_static(constants_cx: &mut ConstantCx, def_id: DefId) {
constants_cx.todo.push(TodoItem::Static(def_id));
}
pub(crate) fn codegen_tls_ref<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
def_id: DefId,
layout: TyAndLayout<'tcx>,
) -> CValue<'tcx> {
let linkage = crate::linkage::get_static_ref_linkage(fx.tcx, def_id);
let data_id = data_id_for_static(fx.tcx, fx.module, def_id, linkage);
let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
#[cfg(debug_assertions)]
fx.add_comment(local_data_id, format!("tls {:?}", def_id));
let tls_ptr = fx.bcx.ins().tls_value(fx.pointer_type, local_data_id);
CValue::by_val(tls_ptr, layout)
}
fn codegen_static_ref<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
def_id: DefId,
@ -48,7 +62,10 @@ fn codegen_static_ref<'tcx>(
let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
#[cfg(debug_assertions)]
fx.add_comment(local_data_id, format!("{:?}", def_id));
cplace_for_dataid(fx, layout, local_data_id)
let global_ptr = fx.bcx.ins().global_value(fx.pointer_type, local_data_id);
assert!(!layout.is_unsized(), "unsized statics aren't supported");
assert!(matches!(fx.bcx.func.global_values[local_data_id], GlobalValueData::Symbol { tls: false, ..}), "tls static referenced without Rvalue::ThreadLocalRef");
CPlace::for_ptr(crate::pointer::Pointer::new(global_ptr), layout)
}
pub(crate) fn trans_constant<'tcx>(
@ -245,16 +262,6 @@ fn data_id_for_static(
data_id
}
fn cplace_for_dataid<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
layout: TyAndLayout<'tcx>,
local_data_id: GlobalValue,
) -> CPlace<'tcx> {
let global_ptr = fx.bcx.ins().global_value(fx.pointer_type, local_data_id);
assert!(!layout.is_unsized(), "unsized statics aren't supported");
CPlace::for_ptr(crate::pointer::Pointer::new(global_ptr), layout)
}
fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mut ConstantCx) {
while let Some(todo_item) = cx.todo.pop() {
let (data_id, alloc) = match todo_item {

View File

@ -59,7 +59,7 @@ fn line_program_add_file(
) -> FileId {
match &file.name {
FileName::Real(path) => {
let (dir_path, file_name) = split_path_dir_and_file(path);
let (dir_path, file_name) = split_path_dir_and_file(path.stable_name());
let dir_name = osstr_as_utf8_bytes(dir_path.as_os_str());
let file_name = osstr_as_utf8_bytes(file_name);

View File

@ -4,8 +4,6 @@ mod unwind;
use crate::prelude::*;
use rustc_span::FileName;
use cranelift_codegen::ir::{StackSlots, ValueLabel, ValueLoc};
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::ValueLocRange;
@ -66,12 +64,7 @@ impl<'tcx> DebugContext<'tcx> {
let (name, file_info) = match tcx.sess.local_crate_source_file.clone() {
Some(path) => {
let name = path.to_string_lossy().into_owned();
let info = tcx.sess
.source_map()
.get_source_file(&FileName::Real(path))
.map(|f| f.src_hash)
.and_then(line_info::make_file_info);
(name, info)
(name, None)
},
None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),
};