Rewrite rmeta-rpass test to work with the new check for all crate sources being in sync

This commit is contained in:
bjorn3 2023-07-15 17:35:36 +00:00
parent 52853c2694
commit aa98c5d14e
5 changed files with 21 additions and 23 deletions

View File

@ -0,0 +1,16 @@
# ignore-cross-compile
include ../tools.mk
# Test that using rlibs and rmeta dep crates work together. Specifically, that
# there can be both an rmeta and an rlib file and rustc will prefer the rmeta
# file.
#
# This behavior is simply making sure this doesn't accidentally change; in this
# case we want to make sure that the rlib isn't being used as that would cause
# bugs in -Zbinary-dep-depinfo (see #68298).
all:
$(RUSTC) rmeta_aux.rs --crate-type=rlib --emit link,metadata
$(RUSTC) lib.rs --crate-type=rlib --emit dep-info -Zbinary-dep-depinfo
$(CGREP) "librmeta_aux.rmeta" < $(TMPDIR)/lib.d
$(CGREP) -v "librmeta_aux.rlib" < $(TMPDIR)/lib.d

View File

@ -1,4 +1,3 @@
// run-pass
// Test that using rlibs and rmeta dep crates work together. Specifically, that
// there can be both an rmeta and an rlib file and rustc will prefer the rmeta
// file.
@ -7,12 +6,9 @@
// case we want to make sure that the rlib isn't being used as that would cause
// bugs in -Zbinary-dep-depinfo (see #68298).
// aux-build:rmeta-rmeta.rs
// aux-build:rmeta-rlib-rpass.rs
extern crate rmeta_aux;
use rmeta_aux::Foo;
pub fn main() {
let _ = Foo { field2: 42 };
pub fn foo() {
let _ = Foo { field: 42 };
}

View File

@ -0,0 +1,3 @@
pub struct Foo {
pub field: i32,
}

View File

@ -1,8 +0,0 @@
// no-prefer-dynamic
#![crate_type="rlib"]
#![crate_name="rmeta_aux"]
pub struct Foo {
pub field: i32,
}

View File

@ -1,9 +0,0 @@
// no-prefer-dynamic
// compile-flags: --emit=metadata
#![crate_type="rlib"]
#![crate_name="rmeta_aux"]
pub struct Foo {
pub field2: i32,
}