Skip to content

Commit e1f45a1

Browse files
committed
Auto merge of #127538 - Oneirical:the-sacred-tests, r=jieyouxu
Migrate `issue-83112-incr-test-moved-file`, `type-mismatch-same-crate-name` and `issue-109934-lto-debuginfo` `run-make` tests to rmake or ui Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). I have noticed that the new UI test `debuginfo-lto-alloc` is outputting artifacts that aren't getting cleaned up because of its `-C incremental`. That might be the justification needed to keep it as a run-make test? Try it on: // try-job: test-various // previously passed try-job: armhf-gnu try-job: aarch64-apple try-job: x86_64-msvc
2 parents 3ad5f45 + 2adfa14 commit e1f45a1

File tree

9 files changed

+78
-68
lines changed

9 files changed

+78
-68
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ run-make/incr-add-rust-src-component/Makefile
4646
run-make/incr-foreign-head-span/Makefile
4747
run-make/interdependent-c-libraries/Makefile
4848
run-make/issue-107094/Makefile
49-
run-make/issue-109934-lto-debuginfo/Makefile
5049
run-make/issue-14698/Makefile
5150
run-make/issue-15460/Makefile
5251
run-make/issue-18943/Makefile
@@ -60,7 +59,6 @@ run-make/issue-36710/Makefile
6059
run-make/issue-47551/Makefile
6160
run-make/issue-69368/Makefile
6261
run-make/issue-83045/Makefile
63-
run-make/issue-83112-incr-test-moved-file/Makefile
6462
run-make/issue-84395-lto-embed-bitcode/Makefile
6563
run-make/issue-85019-moved-src-dir/Makefile
6664
run-make/issue-85401-static-mir/Makefile
@@ -138,6 +136,5 @@ run-make/test-benches/Makefile
138136
run-make/thumb-none-cortex-m/Makefile
139137
run-make/thumb-none-qemu/Makefile
140138
run-make/translation/Makefile
141-
run-make/type-mismatch-same-crate-name/Makefile
142139
run-make/unstable-flag-required/Makefile
143140
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// The generated test harness code contains spans with a dummy location,
2+
// but a non-dummy SyntaxContext. Previously, the incremental cache was encoding
3+
// these spans as a full span (with a source file index), instead of skipping
4+
// the encoding of the location information. If the file gest moved, the hash
5+
// of the span will be unchanged (since it has a dummy location), so the incr
6+
// cache would end up try to load a non-existent file using the previously
7+
// enccoded source file id.
8+
// This test reproduces the steps that used to trigger this bug, and checks
9+
// for successful compilation.
10+
// See https://github.com/rust-lang/rust/issues/83112
11+
12+
//@ ignore-none
13+
// Reason: no-std is not supported
14+
//@ ignore-nvptx64-nvidia-cuda
15+
// FIXME: can't find crate for 'std'
16+
17+
use run_make_support::{fs_wrapper, rust_lib_name, rustc};
18+
19+
fn main() {
20+
fs_wrapper::create_dir("incr");
21+
fs_wrapper::create_dir("src");
22+
fs_wrapper::create_dir("src/mydir");
23+
fs_wrapper::copy("main.rs", "src/main.rs");
24+
rustc().input("src/main.rs").incremental("incr").arg("--test").run();
25+
fs_wrapper::rename("src/main.rs", "src/mydir/main.rs");
26+
rustc().input("src/mydir/main.rs").incremental("incr").arg("--test").run();
27+
}

tests/run-make/issue-109934-lto-debuginfo/Makefile

-12
This file was deleted.

tests/run-make/issue-109934-lto-debuginfo/lib.rs

-9
This file was deleted.

tests/run-make/issue-83112-incr-test-moved-file/Makefile

-25
This file was deleted.

tests/run-make/type-mismatch-same-crate-name/Makefile

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// When a compilation failure deals with seemingly identical types, some helpful
2+
// errors should be printed.
3+
// The main use case of this error is when there are two crates
4+
// (generally different versions of the same crate) with the same name
5+
// causing a type mismatch. In this test, one of the crates
6+
// is only introduced as an indirect dependency and the type is accessed via a reexport.
7+
// See https://github.com/rust-lang/rust/pull/42826
8+
9+
use run_make_support::{rust_lib_name, rustc};
10+
11+
fn main() {
12+
rustc().crate_type("rlib").input("crateA.rs").metadata("-1").extra_filename("-1").run();
13+
rustc().crate_type("rlib").input("crateA.rs").metadata("-2").extra_filename("-2").run();
14+
rustc()
15+
.crate_type("rlib")
16+
.input("crateB.rs")
17+
.extern_("crateA", rust_lib_name("crateA-1"))
18+
.run();
19+
rustc()
20+
.input("crateC.rs")
21+
.extern_("crateA", rust_lib_name("crateA-2"))
22+
.run_fail()
23+
.assert_stderr_contains("mismatched types")
24+
.assert_stderr_contains("crateB::try_foo(foo2);")
25+
.assert_stderr_contains("different versions of crate `crateA`")
26+
.assert_stderr_contains("crateB::try_bar(bar2);")
27+
.assert_stderr_contains("expected trait `crateA::bar::Bar`, found trait `Bar`")
28+
.assert_stderr_contains("different versions of crate `crateA`");
29+
}

tests/ui/lto/debuginfo-lto-alloc.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// With the upgrade to LLVM 16, the following error appeared when using
2+
// link-time-optimization (LTO) alloc and debug compilation mode simultaneously:
3+
//
4+
// error: Cannot represent a difference across sections
5+
//
6+
// The error stemmed from DI function definitions under type scopes, fixed by
7+
// only declaring in type scope and defining the subprogram elsewhere.
8+
// This test reproduces the circumstances that caused the error to appear, and checks
9+
// that compilation is successful.
10+
11+
//@ check-pass
12+
//@ compile-flags: --test -C debuginfo=2 -C lto=fat -C incremental=inc-fat
13+
14+
extern crate alloc;
15+
16+
#[cfg(test)]
17+
mod tests {
18+
#[test]
19+
fn something_alloc() {
20+
assert_eq!(Vec::<u32>::new(), Vec::<u32>::new());
21+
}
22+
}

0 commit comments

Comments
 (0)