Skip to content

Rollup of 5 pull requests #73009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
@@ -963,29 +963,15 @@ impl Build {
return s;
}

let beta = output(
Command::new("git").arg("ls-remote").arg("origin").arg("beta").current_dir(&self.src),
);
let beta = beta.trim().split_whitespace().next().unwrap();
let master = output(
Command::new("git").arg("ls-remote").arg("origin").arg("master").current_dir(&self.src),
);
let master = master.trim().split_whitespace().next().unwrap();

// Figure out where the current beta branch started.
let base = output(
Command::new("git").arg("merge-base").arg(beta).arg(master).current_dir(&self.src),
);
let base = base.trim();

// Next figure out how many merge commits happened since we branched off
// beta. That's our beta number!
// Figure out how many merge commits happened since we branched off master.
// That's our beta number!
// (Note that we use a `..` range, not the `...` symmetric difference.)
let count = output(
Command::new("git")
.arg("rev-list")
.arg("--count")
.arg("--merges")
.arg(format!("{}...HEAD", base))
.arg("refs/remotes/origin/master..HEAD")
.current_dir(&self.src),
);
let n = count.trim().parse().unwrap();
6 changes: 6 additions & 0 deletions src/librustc_hir/definitions.rs
Original file line number Diff line number Diff line change
@@ -364,6 +364,12 @@ impl Definitions {
self.node_id_to_hir_id[node_id]
}

#[inline]
pub fn opt_hir_id_to_local_def_id(&self, hir_id: hir::HirId) -> Option<LocalDefId> {
let node_id = self.hir_id_to_node_id(hir_id);
self.opt_local_def_id(node_id)
}

/// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
#[inline]
pub fn opt_span(&self, def_id: DefId) -> Option<Span> {
37 changes: 2 additions & 35 deletions src/librustc_middle/hir/map/mod.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use self::collector::NodeCollector;
use crate::hir::{Owner, OwnerNodes};
use crate::ty::query::Providers;
use crate::ty::TyCtxt;
use rustc_ast::ast::{self, NodeId};
use rustc_ast::ast::{self};
use rustc_data_structures::svh::Svh;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
@@ -157,18 +157,6 @@ impl<'hir> Map<'hir> {
self.tcx.definitions.def_path(def_id)
}

#[inline]
pub fn local_def_id_from_node_id(&self, node: NodeId) -> LocalDefId {
self.opt_local_def_id_from_node_id(node).unwrap_or_else(|| {
let hir_id = self.node_id_to_hir_id(node);
bug!(
"local_def_id_from_node_id: no entry for `{}`, which has a map of `{:?}`",
node,
self.find_entry(hir_id)
)
})
}

#[inline]
pub fn local_def_id(&self, hir_id: HirId) -> LocalDefId {
self.opt_local_def_id(hir_id).unwrap_or_else(|| {
@@ -182,35 +170,14 @@ impl<'hir> Map<'hir> {

#[inline]
pub fn opt_local_def_id(&self, hir_id: HirId) -> Option<LocalDefId> {
let node_id = self.hir_id_to_node_id(hir_id);
self.opt_local_def_id_from_node_id(node_id)
}

#[inline]
pub fn opt_local_def_id_from_node_id(&self, node: NodeId) -> Option<LocalDefId> {
self.tcx.definitions.opt_local_def_id(node)
self.tcx.definitions.opt_hir_id_to_local_def_id(hir_id)
}

#[inline]
pub fn as_local_hir_id(&self, def_id: LocalDefId) -> HirId {
self.tcx.definitions.as_local_hir_id(def_id)
}

#[inline]
pub fn hir_id_to_node_id(&self, hir_id: HirId) -> NodeId {
self.tcx.definitions.hir_id_to_node_id(hir_id)
}

#[inline]
pub fn node_id_to_hir_id(&self, node_id: NodeId) -> HirId {
self.tcx.definitions.node_id_to_hir_id(node_id)
}

#[inline]
pub fn opt_node_id_to_hir_id(&self, node_id: NodeId) -> Option<HirId> {
self.tcx.definitions.opt_node_id_to_hir_id(node_id)
}

#[inline]
pub fn local_def_id_to_hir_id(&self, def_id: LocalDefId) -> HirId {
self.tcx.definitions.local_def_id_to_hir_id(def_id)
69 changes: 43 additions & 26 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
@@ -669,40 +669,33 @@ fn compute_storage_conflicts(
storage_conflicts
}

fn compute_layout<'tcx>(
/// Validates the typeck view of the generator against the actual set of types retained between
/// yield points.
fn sanitize_witness<'tcx>(
tcx: TyCtxt<'tcx>,
source: MirSource<'tcx>,
body: &Body<'tcx>,
did: DefId,
witness: Ty<'tcx>,
upvars: &Vec<Ty<'tcx>>,
interior: Ty<'tcx>,
always_live_locals: &storage::AlwaysLiveLocals,
movable: bool,
body: &mut Body<'tcx>,
) -> (
FxHashMap<Local, (Ty<'tcx>, VariantIdx, usize)>,
GeneratorLayout<'tcx>,
IndexVec<BasicBlock, Option<BitSet<Local>>>,
retained: &BitSet<Local>,
) {
// Use a liveness analysis to compute locals which are live across a suspension point
let LivenessInfo {
live_locals,
live_locals_at_suspension_points,
storage_conflicts,
storage_liveness,
} = locals_live_across_suspend_points(tcx, body, source, always_live_locals, movable);

// Erase regions from the types passed in from typeck so we can compare them with
// MIR types
let allowed_upvars = tcx.erase_regions(upvars);
let allowed = match interior.kind {
let allowed = match witness.kind {
ty::GeneratorWitness(s) => tcx.erase_late_bound_regions(&s),
_ => bug!(),
_ => {
tcx.sess.delay_span_bug(
body.span,
&format!("unexpected generator witness type {:?}", witness.kind),
);
return;
}
};

let param_env = tcx.param_env(source.def_id());
let param_env = tcx.param_env(did);

for (local, decl) in body.local_decls.iter_enumerated() {
// Ignore locals which are internal or not live
if !live_locals.contains(local) || decl.internal {
// Ignore locals which are internal or not retained between yields.
if !retained.contains(local) || decl.internal {
continue;
}
let decl_ty = tcx.normalize_erasing_regions(param_env, decl.ty);
@@ -715,10 +708,34 @@ fn compute_layout<'tcx>(
"Broken MIR: generator contains type {} in MIR, \
but typeck only knows about {}",
decl.ty,
interior
witness,
);
}
}
}

fn compute_layout<'tcx>(
tcx: TyCtxt<'tcx>,
source: MirSource<'tcx>,
upvars: &Vec<Ty<'tcx>>,
interior: Ty<'tcx>,
always_live_locals: &storage::AlwaysLiveLocals,
movable: bool,
body: &mut Body<'tcx>,
) -> (
FxHashMap<Local, (Ty<'tcx>, VariantIdx, usize)>,
GeneratorLayout<'tcx>,
IndexVec<BasicBlock, Option<BitSet<Local>>>,
) {
// Use a liveness analysis to compute locals which are live across a suspension point
let LivenessInfo {
live_locals,
live_locals_at_suspension_points,
storage_conflicts,
storage_liveness,
} = locals_live_across_suspend_points(tcx, body, source, always_live_locals, movable);

sanitize_witness(tcx, body, source.def_id(), interior, upvars, &live_locals);

// Gather live local types and their indices.
let mut locals = IndexVec::<GeneratorSavedLocal, _>::new();
10 changes: 8 additions & 2 deletions src/librustc_ty/needs_drop.rs
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ where
}
}

ty::Generator(_, substs, _) => {
ty::Generator(def_id, substs, _) => {
let substs = substs.as_generator();
for upvar_ty in substs.upvar_tys() {
queue_type(self, upvar_ty);
@@ -108,7 +108,13 @@ where
let witness = substs.witness();
let interior_tys = match &witness.kind {
ty::GeneratorWitness(tys) => tcx.erase_late_bound_regions(tys),
_ => bug!(),
_ => {
tcx.sess.delay_span_bug(
tcx.hir().span_if_local(def_id).unwrap_or(DUMMY_SP),
&format!("unexpected generator witness type {:?}", witness),
);
return Some(Err(AlwaysRequiresDrop));
}
};

for interior_ty in interior_tys {
1 change: 1 addition & 0 deletions src/test/codegen/abi-main-signature-16bit-c-int.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
// ignore-mips64
// ignore-powerpc
// ignore-powerpc64
// ignore-riscv64
// ignore-s390x
// ignore-sparc
// ignore-sparc64
1 change: 1 addition & 0 deletions src/test/codegen/abi-sysv64.rs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

// ignore-arm
// ignore-aarch64
// ignore-riscv64 sysv64 not supported

// compile-flags: -C no-prepopulate-passes

1 change: 1 addition & 0 deletions src/test/codegen/abi-x86-interrupt.rs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

// ignore-arm
// ignore-aarch64
// ignore-riscv64 x86-interrupt is not supported

// compile-flags: -C no-prepopulate-passes

2 changes: 2 additions & 0 deletions src/test/codegen/call-llvm-intrinsics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// compile-flags: -C no-prepopulate-passes

// ignore-riscv64

#![feature(link_llvm_intrinsics)]
#![crate_type = "lib"]

9 changes: 9 additions & 0 deletions src/test/codegen/catch-unwind.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// compile-flags: -O

// On x86 the closure is inlined in foo() producting something like
// define i32 @foo() [...] {
// tail call void @bar() [...]
// ret i32 0
// }
// On riscv the closure is another function, placed before fn foo so CHECK can't
// find it
// ignore-riscv64 FIXME

#![crate_type = "lib"]

extern "C" {
1 change: 1 addition & 0 deletions src/test/codegen/fastcall-inreg.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
// ignore-powerpc64le
// ignore-powerpc
// ignore-r600
// ignore-riscv64
// ignore-amdgcn
// ignore-sparc
// ignore-sparc64
1 change: 1 addition & 0 deletions src/test/codegen/repr-transparent-aggregates-1.rs
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
// ignore-mips64
// ignore-powerpc
// ignore-powerpc64
// ignore-riscv64 see codegen/riscv-abi
// ignore-windows
// See repr-transparent.rs

1 change: 1 addition & 0 deletions src/test/codegen/repr-transparent-aggregates-2.rs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
// ignore-powerpc
// ignore-powerpc64
// ignore-powerpc64le
// ignore-riscv64 see codegen/riscv-abi
// ignore-s390x
// ignore-sparc
// ignore-sparc64
3 changes: 3 additions & 0 deletions src/test/codegen/repr-transparent.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// compile-flags: -C no-prepopulate-passes

// ignore-riscv64 riscv64 has an i128 type used with test_Vector
// see codegen/riscv-abi for riscv functiona call tests

#![crate_type="lib"]
#![feature(repr_simd, transparent_unions)]

30 changes: 30 additions & 0 deletions src/test/codegen/riscv-abi/call-llvm-intrinsics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// compile-flags: -C no-prepopulate-passes

// only-riscv64

#![feature(link_llvm_intrinsics)]
#![crate_type = "lib"]

struct A;

impl Drop for A {
fn drop(&mut self) {
println!("A");
}
}

extern {
#[link_name = "llvm.sqrt.f32"]
fn sqrt(x: f32) -> f32;
}

pub fn do_call() {
let _a = A;

unsafe {
// Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them
// CHECK: store float 4.000000e+00, float* %{{.}}, align 4
// CHECK: call float @llvm.sqrt.f32(float %{{.}}
sqrt(4.0);
}
}
14 changes: 7 additions & 7 deletions src/test/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs
Original file line number Diff line number Diff line change
@@ -39,12 +39,12 @@ pub extern "C" fn f_scalar_4(x: i64) -> i64 {
x
}

// CHECK: define float @f_fp_scalar_1(float)
// CHECK: define float @f_fp_scalar_1(float %0)
#[no_mangle]
pub extern "C" fn f_fp_scalar_1(x: f32) -> f32 {
x
}
// CHECK: define double @f_fp_scalar_2(double)
// CHECK: define double @f_fp_scalar_2(double %0)
#[no_mangle]
pub extern "C" fn f_fp_scalar_2(x: f64) -> f64 {
x
@@ -67,7 +67,7 @@ pub struct Tiny {
d: u16,
}

// CHECK: define void @f_agg_tiny(i64)
// CHECK: define void @f_agg_tiny(i64 %0)
#[no_mangle]
pub extern "C" fn f_agg_tiny(mut e: Tiny) {
e.a += e.b;
@@ -86,7 +86,7 @@ pub struct Small {
b: *mut i64,
}

// CHECK: define void @f_agg_small([2 x i64])
// CHECK: define void @f_agg_small([2 x i64] %0)
#[no_mangle]
pub extern "C" fn f_agg_small(mut x: Small) {
x.a += unsafe { *x.b };
@@ -104,7 +104,7 @@ pub struct SmallAligned {
a: i128,
}

// CHECK: define void @f_agg_small_aligned(i128)
// CHECK: define void @f_agg_small_aligned(i128 %0)
#[no_mangle]
pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) {
x.a += x.a;
@@ -130,7 +130,7 @@ pub extern "C" fn f_agg_large_ret(i: i32, j: i8) -> Large {
Large { a: 1, b: 2, c: 3, d: 4 }
}

// CHECK: define void @f_scalar_stack_1(i64, [2 x i64], i128, %Large* {{.*}}%d, i8 zeroext %e, i8 signext %f, i8 %g, i8 %h)
// CHECK: define void @f_scalar_stack_1(i64 %0, [2 x i64] %1, i128 %2, %Large* {{.*}}%d, i8 zeroext %e, i8 signext %f, i8 %g, i8 %h)
#[no_mangle]
pub extern "C" fn f_scalar_stack_1(
a: Tiny,
@@ -144,7 +144,7 @@ pub extern "C" fn f_scalar_stack_1(
) {
}

// CHECK: define void @f_scalar_stack_2(%Large* {{.*}}sret{{.*}}, i64 %a, i128, i128, i64 %d, i8 zeroext %e, i8 %f, i8 %g)
// CHECK: define void @f_scalar_stack_2(%Large* {{.*}}sret{{.*}} %0, i64 %a, i128 %1, i128 %2, i64 %d, i8 zeroext %e, i8 %f, i8 %g)
#[no_mangle]
pub extern "C" fn f_scalar_stack_2(
a: u64,
34 changes: 17 additions & 17 deletions src/test/codegen/riscv-abi/riscv64-lp64d-abi.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
// only-linux
#![crate_type = "lib"]

// CHECK: define void @f_fpr_tracking(double, double, double, double, double, double, double, double, i8 zeroext %i)
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 zeroext %i)
#[no_mangle]
pub extern "C" fn f_fpr_tracking(
a: f64,
@@ -36,7 +36,7 @@ pub struct DoubleFloat {
g: f32,
}

// CHECK: define void @f_double_s_arg(double)
// CHECK: define void @f_double_s_arg(double %0)
#[no_mangle]
pub extern "C" fn f_double_s_arg(a: Double) {}

@@ -46,7 +46,7 @@ pub extern "C" fn f_ret_double_s() -> Double {
Double { f: 1. }
}

// CHECK: define void @f_double_double_s_arg({ double, double })
// CHECK: define void @f_double_double_s_arg({ double, double } %0)
#[no_mangle]
pub extern "C" fn f_double_double_s_arg(a: DoubleDouble) {}

@@ -56,7 +56,7 @@ pub extern "C" fn f_ret_double_double_s() -> DoubleDouble {
DoubleDouble { f: 1., g: 2. }
}

// CHECK: define void @f_double_float_s_arg({ double, float })
// CHECK: define void @f_double_float_s_arg({ double, float } %0)
#[no_mangle]
pub extern "C" fn f_double_float_s_arg(a: DoubleFloat) {}

@@ -66,7 +66,7 @@ pub extern "C" fn f_ret_double_float_s() -> DoubleFloat {
DoubleFloat { f: 1., g: 2. }
}

// CHECK: define void @f_double_double_s_arg_insufficient_fprs(double, double, double, double, double, double, double, [2 x i64])
// CHECK: define void @f_double_double_s_arg_insufficient_fprs(double %0, double %1, double %2, double %3, double %4, double %5, double %6, [2 x i64] %7)
#[no_mangle]
pub extern "C" fn f_double_double_s_arg_insufficient_fprs(
a: f64,
@@ -104,7 +104,7 @@ pub struct DoubleInt64 {
i: i64,
}

// CHECK: define void @f_double_int8_s_arg({ double, i8 })
// CHECK: define void @f_double_int8_s_arg({ double, i8 } %0)
#[no_mangle]
pub extern "C" fn f_double_int8_s_arg(a: DoubleInt8) {}

@@ -114,7 +114,7 @@ pub extern "C" fn f_ret_double_int8_s() -> DoubleInt8 {
DoubleInt8 { f: 1., i: 2 }
}

// CHECK: define void @f_double_int32_s_arg({ double, i32 })
// CHECK: define void @f_double_int32_s_arg({ double, i32 } %0)
#[no_mangle]
pub extern "C" fn f_double_int32_s_arg(a: DoubleInt32) {}

@@ -124,7 +124,7 @@ pub extern "C" fn f_ret_double_int32_s() -> DoubleInt32 {
DoubleInt32 { f: 1., i: 2 }
}

// CHECK: define void @f_double_uint8_s_arg({ double, i8 })
// CHECK: define void @f_double_uint8_s_arg({ double, i8 } %0)
#[no_mangle]
pub extern "C" fn f_double_uint8_s_arg(a: DoubleUInt8) {}

@@ -134,7 +134,7 @@ pub extern "C" fn f_ret_double_uint8_s() -> DoubleUInt8 {
DoubleUInt8 { f: 1., i: 2 }
}

// CHECK: define void @f_double_int64_s_arg({ double, i64 })
// CHECK: define void @f_double_int64_s_arg({ double, i64 } %0)
#[no_mangle]
pub extern "C" fn f_double_int64_s_arg(a: DoubleInt64) {}

@@ -144,7 +144,7 @@ pub extern "C" fn f_ret_double_int64_s() -> DoubleInt64 {
DoubleInt64 { f: 1., i: 2 }
}

// CHECK: define void @f_double_int8_s_arg_insufficient_gprs(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e, i32 signext %f, i32 signext %g, i32 signext %h, [2 x i64])
// CHECK: define void @f_double_int8_s_arg_insufficient_gprs(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e, i32 signext %f, i32 signext %g, i32 signext %h, [2 x i64] %0)
#[no_mangle]
pub extern "C" fn f_double_int8_s_arg_insufficient_gprs(
a: i32,
@@ -159,7 +159,7 @@ pub extern "C" fn f_double_int8_s_arg_insufficient_gprs(
) {
}

// CHECK: define void @f_struct_double_int8_insufficient_fprs(float, double, double, double, double, double, double, double, [2 x i64])
// CHECK: define void @f_struct_double_int8_insufficient_fprs(float %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, [2 x i64] %8)
#[no_mangle]
pub extern "C" fn f_struct_double_int8_insufficient_fprs(
a: f32,
@@ -179,7 +179,7 @@ pub struct DoubleArr1 {
a: [f64; 1],
}

// CHECK: define void @f_doublearr1_s_arg(double)
// CHECK: define void @f_doublearr1_s_arg(double %0)
#[no_mangle]
pub extern "C" fn f_doublearr1_s_arg(a: DoubleArr1) {}

@@ -194,7 +194,7 @@ pub struct DoubleArr2 {
a: [f64; 2],
}

// CHECK: define void @f_doublearr2_s_arg({ double, double })
// CHECK: define void @f_doublearr2_s_arg({ double, double } %0)
#[no_mangle]
pub extern "C" fn f_doublearr2_s_arg(a: DoubleArr2) {}

@@ -214,7 +214,7 @@ pub struct DoubleArr2Tricky1 {
g: [Tricky1; 2],
}

// CHECK: define void @f_doublearr2_tricky1_s_arg({ double, double })
// CHECK: define void @f_doublearr2_tricky1_s_arg({ double, double } %0)
#[no_mangle]
pub extern "C" fn f_doublearr2_tricky1_s_arg(a: DoubleArr2Tricky1) {}

@@ -233,7 +233,7 @@ pub struct DoubleArr2Tricky2 {
g: [Tricky1; 2],
}

// CHECK: define void @f_doublearr2_tricky2_s_arg({ double, double })
// CHECK: define void @f_doublearr2_tricky2_s_arg({ double, double } %0)
#[no_mangle]
pub extern "C" fn f_doublearr2_tricky2_s_arg(a: DoubleArr2Tricky2) {}

@@ -267,7 +267,7 @@ pub struct CharCharDouble {
c: f64,
}

// CHECK: define void @f_char_char_double_s_arg([2 x i64])
// CHECK: define void @f_char_char_double_s_arg([2 x i64] %0)
#[no_mangle]
pub extern "C" fn f_char_char_double_s_arg(a: CharCharDouble) {}

@@ -282,7 +282,7 @@ pub union DoubleU {
a: f64,
}

// CHECK: define void @f_double_u_arg(i64)
// CHECK: define void @f_double_u_arg(i64 %0)
#[no_mangle]
pub extern "C" fn f_double_u_arg(a: DoubleU) {}

34 changes: 17 additions & 17 deletions src/test/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
// only-linux
#![crate_type = "lib"]

// CHECK: define void @f_fpr_tracking(float, float, float, float, float, float, float, float, i8 zeroext %i)
// CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 zeroext %i)
#[no_mangle]
pub extern "C" fn f_fpr_tracking(
a: f32,
@@ -30,7 +30,7 @@ pub struct FloatFloat {
g: f32,
}

// CHECK: define void @f_float_s_arg(float)
// CHECK: define void @f_float_s_arg(float %0)
#[no_mangle]
pub extern "C" fn f_float_s_arg(a: Float) {}

@@ -40,7 +40,7 @@ pub extern "C" fn f_ret_float_s() -> Float {
Float { f: 1. }
}

// CHECK: define void @f_float_float_s_arg({ float, float })
// CHECK: define void @f_float_float_s_arg({ float, float } %0)
#[no_mangle]
pub extern "C" fn f_float_float_s_arg(a: FloatFloat) {}

@@ -50,7 +50,7 @@ pub extern "C" fn f_ret_float_float_s() -> FloatFloat {
FloatFloat { f: 1., g: 2. }
}

// CHECK: define void @f_float_float_s_arg_insufficient_fprs(float, float, float, float, float, float, float, i64)
// CHECK: define void @f_float_float_s_arg_insufficient_fprs(float %0, float %1, float %2, float %3, float %4, float %5, float %6, i64 %7)
#[no_mangle]
pub extern "C" fn f_float_float_s_arg_insufficient_fprs(
a: f32,
@@ -88,7 +88,7 @@ pub struct FloatInt64 {
i: i64,
}

// CHECK: define void @f_float_int8_s_arg({ float, i8 })
// CHECK: define void @f_float_int8_s_arg({ float, i8 } %0)
#[no_mangle]
pub extern "C" fn f_float_int8_s_arg(a: FloatInt8) {}

@@ -98,7 +98,7 @@ pub extern "C" fn f_ret_float_int8_s() -> FloatInt8 {
FloatInt8 { f: 1., i: 2 }
}

// CHECK: define void @f_float_int32_s_arg({ float, i32 })
// CHECK: define void @f_float_int32_s_arg({ float, i32 } %0)
#[no_mangle]
pub extern "C" fn f_float_int32_s_arg(a: FloatInt32) {}

@@ -108,7 +108,7 @@ pub extern "C" fn f_ret_float_int32_s() -> FloatInt32 {
FloatInt32 { f: 1., i: 2 }
}

// CHECK: define void @f_float_uint8_s_arg({ float, i8 })
// CHECK: define void @f_float_uint8_s_arg({ float, i8 } %0)
#[no_mangle]
pub extern "C" fn f_float_uint8_s_arg(a: FloatUInt8) {}

@@ -118,7 +118,7 @@ pub extern "C" fn f_ret_float_uint8_s() -> FloatUInt8 {
FloatUInt8 { f: 1., i: 2 }
}

// CHECK: define void @f_float_int64_s_arg({ float, i64 })
// CHECK: define void @f_float_int64_s_arg({ float, i64 } %0)
#[no_mangle]
pub extern "C" fn f_float_int64_s_arg(a: FloatInt64) {}

@@ -128,7 +128,7 @@ pub extern "C" fn f_ret_float_int64_s() -> FloatInt64 {
FloatInt64 { f: 1., i: 2 }
}

// CHECK: define void @f_float_int8_s_arg_insufficient_gprs(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e, i32 signext %f, i32 signext %g, i32 signext %h, i64)
// CHECK: define void @f_float_int8_s_arg_insufficient_gprs(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e, i32 signext %f, i32 signext %g, i32 signext %h, i64 %0)
#[no_mangle]
pub extern "C" fn f_float_int8_s_arg_insufficient_gprs(
a: i32,
@@ -143,7 +143,7 @@ pub extern "C" fn f_float_int8_s_arg_insufficient_gprs(
) {
}

// CHECK: define void @f_struct_float_int8_insufficient_fprs(float, float, float, float, float, float, float, float, i64)
// CHECK: define void @f_struct_float_int8_insufficient_fprs(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i64 %8)
#[no_mangle]
pub extern "C" fn f_struct_float_int8_insufficient_fprs(
a: f32,
@@ -163,7 +163,7 @@ pub struct FloatArr1 {
a: [f32; 1],
}

// CHECK: define void @f_floatarr1_s_arg(float)
// CHECK: define void @f_floatarr1_s_arg(float %0)
#[no_mangle]
pub extern "C" fn f_floatarr1_s_arg(a: FloatArr1) {}

@@ -178,7 +178,7 @@ pub struct FloatArr2 {
a: [f32; 2],
}

// CHECK: define void @f_floatarr2_s_arg({ float, float })
// CHECK: define void @f_floatarr2_s_arg({ float, float } %0)
#[no_mangle]
pub extern "C" fn f_floatarr2_s_arg(a: FloatArr2) {}

@@ -198,7 +198,7 @@ pub struct FloatArr2Tricky1 {
g: [Tricky1; 2],
}

// CHECK: define void @f_floatarr2_tricky1_s_arg({ float, float })
// CHECK: define void @f_floatarr2_tricky1_s_arg({ float, float } %0)
#[no_mangle]
pub extern "C" fn f_floatarr2_tricky1_s_arg(a: FloatArr2Tricky1) {}

@@ -217,7 +217,7 @@ pub struct FloatArr2Tricky2 {
g: [Tricky1; 2],
}

// CHECK: define void @f_floatarr2_tricky2_s_arg({ float, float })
// CHECK: define void @f_floatarr2_tricky2_s_arg({ float, float } %0)
#[no_mangle]
pub extern "C" fn f_floatarr2_tricky2_s_arg(a: FloatArr2Tricky2) {}

@@ -234,7 +234,7 @@ pub struct IntFloatInt {
c: i32,
}

// CHECK: define void @f_int_float_int_s_arg([2 x i64])
// CHECK: define void @f_int_float_int_s_arg([2 x i64] %0)
#[no_mangle]
pub extern "C" fn f_int_float_int_s_arg(a: IntFloatInt) {}

@@ -251,7 +251,7 @@ pub struct CharCharFloat {
c: f32,
}

// CHECK: define void @f_char_char_float_s_arg(i64)
// CHECK: define void @f_char_char_float_s_arg(i64 %0)
#[no_mangle]
pub extern "C" fn f_char_char_float_s_arg(a: CharCharFloat) {}

@@ -266,7 +266,7 @@ pub union FloatU {
a: f32,
}

// CHECK: define void @f_float_u_arg(i64)
// CHECK: define void @f_float_u_arg(i64 %0)
#[no_mangle]
pub extern "C" fn f_float_u_arg(a: FloatU) {}

1 change: 1 addition & 0 deletions src/test/codegen/stack-probes.rs
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
// ignore-powerpc
// ignore-powerpc64
// ignore-powerpc64le
// ignore-riscv64
// ignore-s390x
// ignore-sparc
// ignore-sparc64
1 change: 1 addition & 0 deletions src/test/codegen/x86_mmx.rs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
// ignore-powerpc
// ignore-powerpc64
// ignore-powerpc64le
// ignore-riscv64
// ignore-sparc
// ignore-sparc64
// ignore-s390x
39 changes: 39 additions & 0 deletions src/test/run-make-fulldeps/incr-add-rust-src-component/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-include ../tools.mk

# rust-lang/rust#70924: Test that if we add rust-src component in between two
# incremetnal compiles, the compiler does not ICE on the second.

SYSROOT:=$(shell $(RUSTC) --print sysroot)
FAKEROOT=$(TMPDIR)/fakeroot
INCR=$(TMPDIR)/incr

# Make a local copy of the sysroot; then remove the rust-src part of it, if
# present, for the *first* build. Then put in a facsimile of the rust-src
# component for the second build, in order to expose the ICE from issue #70924.
#
# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a
# first step, but I am concerned that would be too expensive in a unit test
# compared to making symbolic links.
#
# Anyway, the pattern you'll see here is: For every prefix in
# root/lib/rustlib/src, link all of prefix parent content, then remove the
# prefix, then loop on the next prefix. This way, we basically create a copy of
# the context around root/lib/rustlib/src, and can freely add/remove the src
# component itself.
all:
mkdir $(FAKEROOT)
ln -s $(SYSROOT)/* $(FAKEROOT)
rm -f $(FAKEROOT)/lib
mkdir $(FAKEROOT)/lib
ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib
rm -f $(FAKEROOT)/lib/rustlib
mkdir $(FAKEROOT)/lib/rustlib
ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib
rm -f $(FAKEROOT)/lib/rustlib/src
mkdir $(FAKEROOT)/lib/rustlib/src
ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src
rm -f $(FAKEROOT)/lib/rustlib/src/rust
$(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs
mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd
touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs
$(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello World");
}