Tweak a few mir-opt tests instead of using -Clink-dead-code

This commit is contained in:
Ben Kimock 2024-01-30 22:28:28 -05:00
parent 4451bf4d67
commit 2116ed723d
6 changed files with 7 additions and 7 deletions

View File

@ -1470,7 +1470,6 @@ fn run(self, builder: &Builder<'_>) {
};
if builder.config.cmd.bless() {
crate::utils::cc_detect::find_target(builder, self.compiler.host);
// All that we really need to do is cover all combinations of 32/64-bit and unwind/abort,
// but while we're at it we might as well flex our cross-compilation support. This
// selection covers all our tier 1 operating systems and architectures using only tier

View File

@ -2468,7 +2468,6 @@ fn make_compile_args(
"-Zlint-mir",
"-Zdump-mir-exclude-pass-number",
"--crate-type=rlib",
"-Clink-dead-code",
]);
if let Some(pass) = &self.props.mir_unit_test {
rustc.args(&["-Zmir-opt-level=0", &format!("-Zmir-enable-passes=+{}", pass)]);

View File

@ -5,7 +5,7 @@
// (as only `FnDef` and `FnPtr` callees are allowed in MIR).
// EMIT_MIR core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
fn main() {
pub fn main() {
call(noop as fn());
}

View File

@ -28,7 +28,7 @@ fn drop(&mut self) {}
// EMIT_MIR retag.main.SimplifyCfg-elaborate-drops.after.mir
// EMIT_MIR retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir
fn main() {
pub fn main() {
let mut x = 0;
{
let v = Test(0).foo(&mut x); // just making sure we do not panic when there is a tuple struct ctor

View File

@ -1,6 +1,8 @@
// skip-filecheck
// compile-flags: -Zmir-opt-level=0
// compile-flags: -Zmir-opt-level=0 -Clink-dead-code
// mir-opt tests are always built as rlibs so that they seamlessly cross-compile,
// so this test only produces MIR for the drop_in_place we're looking for
// if we use -Clink-dead-code.
// EMIT_MIR core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir
fn main() {

View File

@ -23,7 +23,7 @@ enum E {
V = 5,
}
fn main() {
pub fn main() {
let f = Test::X as fn(usize) -> Test;
// EMIT_MIR core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir
let v = Vec::<i32>::new();