rewrite and rename issue-85401-static-mir
This commit is contained in:
parent
f00f850919
commit
d83ada35ed
@ -54,7 +54,6 @@ run-make/issue-36710/Makefile
|
|||||||
run-make/issue-47551/Makefile
|
run-make/issue-47551/Makefile
|
||||||
run-make/issue-69368/Makefile
|
run-make/issue-69368/Makefile
|
||||||
run-make/issue-84395-lto-embed-bitcode/Makefile
|
run-make/issue-84395-lto-embed-bitcode/Makefile
|
||||||
run-make/issue-85401-static-mir/Makefile
|
|
||||||
run-make/issue-88756-default-output/Makefile
|
run-make/issue-88756-default-output/Makefile
|
||||||
run-make/issue-97463-abi-param-passing/Makefile
|
run-make/issue-97463-abi-param-passing/Makefile
|
||||||
run-make/jobserver-error/Makefile
|
run-make/jobserver-error/Makefile
|
||||||
|
42
tests/run-make/ice-static-mir/rmake.rs
Normal file
42
tests/run-make/ice-static-mir/rmake.rs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Trying to access mid-level internal representation (MIR) in statics
|
||||||
|
// used to cause an internal compiler error (ICE), now handled as a proper
|
||||||
|
// error since #100211. This test checks that the correct error is printed
|
||||||
|
// during the linking process, and not the ICE.
|
||||||
|
// See https://github.com/rust-lang/rust/issues/85401
|
||||||
|
|
||||||
|
use run_make_support::{bin_name, rust_lib_name, rustc};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
rustc()
|
||||||
|
.crate_type("rlib")
|
||||||
|
.crate_name("foo")
|
||||||
|
.arg("-Crelocation-model=pic")
|
||||||
|
.edition("2018")
|
||||||
|
.input("foo.rs")
|
||||||
|
.arg("-Zalways-encode-mir=yes")
|
||||||
|
.emit("metadata")
|
||||||
|
.output("libfoo.rmeta")
|
||||||
|
.run();
|
||||||
|
rustc()
|
||||||
|
.crate_type("rlib")
|
||||||
|
.crate_name("bar")
|
||||||
|
.arg("-Crelocation-model=pic")
|
||||||
|
.edition("2018")
|
||||||
|
.input("bar.rs")
|
||||||
|
.output(rust_lib_name("bar"))
|
||||||
|
.extern_("foo", "libfoo.rmeta")
|
||||||
|
.run();
|
||||||
|
rustc()
|
||||||
|
.crate_type("bin")
|
||||||
|
.crate_name("baz")
|
||||||
|
.arg("-Crelocation-model=pic")
|
||||||
|
.edition("2018")
|
||||||
|
.input("baz.rs")
|
||||||
|
.output(bin_name("baz"))
|
||||||
|
.extern_("bar", rust_lib_name("bar"))
|
||||||
|
.run_fail()
|
||||||
|
.assert_stderr_contains(
|
||||||
|
"crate `foo` required to be available in rlib format, but was not found in this form",
|
||||||
|
)
|
||||||
|
.assert_stdout_not_contains("internal compiler error");
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
include ../tools.mk
|
|
||||||
|
|
||||||
# Regression test for issue #85401
|
|
||||||
# Verify that we do not ICE when trying to access MIR for statics,
|
|
||||||
# but emit an error when linking.
|
|
||||||
|
|
||||||
OUTPUT_FILE := $(TMPDIR)/build-output
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(RUSTC) --crate-type rlib --crate-name foo -Crelocation-model=pic --edition=2018 foo.rs -Zalways-encode-mir=yes --emit metadata -o $(TMPDIR)/libfoo.rmeta
|
|
||||||
$(RUSTC) --crate-type rlib --crate-name bar -Crelocation-model=pic --edition=2018 bar.rs -o $(TMPDIR)/libbar.rlib --extern=foo=$(TMPDIR)/libfoo.rmeta
|
|
||||||
$(RUSTC) --crate-type bin --crate-name baz -Crelocation-model=pic --edition=2018 baz.rs -o $(TMPDIR)/baz -L $(TMPDIR) --extern=bar=$(TMPDIR)/libbar.rlib > $(OUTPUT_FILE) 2>&1; [ $$? -eq 1 ]
|
|
||||||
cat $(OUTPUT_FILE)
|
|
||||||
$(CGREP) 'crate `foo` required to be available in rlib format, but was not found in this form' < $(OUTPUT_FILE)
|
|
||||||
# -v tests are fragile, hopefully this text won't change
|
|
||||||
$(CGREP) -v "internal compiler error" < $(OUTPUT_FILE)
|
|
Loading…
Reference in New Issue
Block a user