| author | bors <bors@rust-lang.org> 2024-06-20 18:21:01 UTC |
| committer | bors <bors@rust-lang.org> 2024-06-20 18:21:01 UTC |
| log | 433355166d769afc9c19f761cc7efc4d152e9a2c |
| tree | 2412ee497bc589da0ba13b9f3ccc3ec166d745bb |
| parent | cb8a7ea0ed866295e0f65725cea6662bea51971a |
| parent | 7b5ed5a66c7e1ec0d2d8ba3657a4048ceea36988 |
Rollup of 6 pull requests
Successful merges:
- #126095 (Migrate `link-args-order`, `ls-metadata` and `lto-readonly-lib` `run-make` tests to `rmake`)
- #126629 (Migrate `run-make/compressed-debuginfo` to `rmake.rs`)
- #126644 (Rewrite `extern-flag-rename-transitive`. `debugger-visualizer-dep-info`, `metadata-flag-frobs-symbols`, `extern-overrides-distribution` and `forced-unwind-terminate-pof` `run-make` tests to rmake)
- #126735 (collect attrs in const block expr)
- #126737 (Remove `feature(const_closures)` from libcore)
- #126740 (add `needs-unwind` to UI test)
r? `@ghost`
`@rustbot` modify labels: rollup25 files changed, 216 insertions(+), 97 deletions(-)
compiler/rustc_resolve/src/def_collector.rs+3| ... | @@ -343,6 +343,9 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> { | ... | @@ -343,6 +343,9 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> { |
| 343 | self.create_def(expr.id, kw::Empty, DefKind::Closure, expr.span) | 343 | self.create_def(expr.id, kw::Empty, DefKind::Closure, expr.span) |
| 344 | } | 344 | } |
| 345 | ExprKind::ConstBlock(ref constant) => { | 345 | ExprKind::ConstBlock(ref constant) => { |
| 346 | for attr in &expr.attrs { | ||
| 347 | visit::walk_attribute(self, attr); | ||
| 348 | } | ||
| 346 | let def = self.create_def( | 349 | let def = self.create_def( |
| 347 | constant.id, | 350 | constant.id, |
| 348 | kw::Empty, | 351 | kw::Empty, |
library/core/src/lib.rs-1| ... | @@ -209,7 +209,6 @@ | ... | @@ -209,7 +209,6 @@ |
| 209 | #![feature(cfg_sanitize)] | 209 | #![feature(cfg_sanitize)] |
| 210 | #![feature(cfg_target_has_atomic)] | 210 | #![feature(cfg_target_has_atomic)] |
| 211 | #![feature(cfg_target_has_atomic_equal_alignment)] | 211 | #![feature(cfg_target_has_atomic_equal_alignment)] |
| 212 | #![feature(const_closures)] | ||
| 213 | #![feature(const_fn_floating_point_arithmetic)] | 212 | #![feature(const_fn_floating_point_arithmetic)] |
| 214 | #![feature(const_for)] | 213 | #![feature(const_for)] |
| 215 | #![feature(const_mut_refs)] | 214 | #![feature(const_mut_refs)] |
src/tools/run-make-support/src/rustc.rs+18| ... | @@ -73,6 +73,12 @@ impl Rustc { | ... | @@ -73,6 +73,12 @@ impl Rustc { |
| 73 | self | 73 | self |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | /// Incorporate a hashed string to mangled symbols. | ||
| 77 | pub fn metadata(&mut self, meta: &str) -> &mut Self { | ||
| 78 | self.cmd.arg(format!("-Cmetadata={meta}")); | ||
| 79 | self | ||
| 80 | } | ||
| 81 | |||
| 76 | /// Add a suffix in each output filename. | 82 | /// Add a suffix in each output filename. |
| 77 | pub fn extra_filename(&mut self, suffix: &str) -> &mut Self { | 83 | pub fn extra_filename(&mut self, suffix: &str) -> &mut Self { |
| 78 | self.cmd.arg(format!("-Cextra-filename={suffix}")); | 84 | self.cmd.arg(format!("-Cextra-filename={suffix}")); |
| ... | @@ -230,6 +236,12 @@ impl Rustc { | ... | @@ -230,6 +236,12 @@ impl Rustc { |
| 230 | self | 236 | self |
| 231 | } | 237 | } |
| 232 | 238 | ||
| 239 | /// Add multiple extra arguments to the linker invocation, via `-Clink-args`. | ||
| 240 | pub fn link_args(&mut self, link_args: &str) -> &mut Self { | ||
| 241 | self.cmd.arg(format!("-Clink-args={link_args}")); | ||
| 242 | self | ||
| 243 | } | ||
| 244 | |||
| 233 | /// Specify a stdin input | 245 | /// Specify a stdin input |
| 234 | pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self { | 246 | pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self { |
| 235 | self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); | 247 | self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); |
| ... | @@ -248,4 +260,10 @@ impl Rustc { | ... | @@ -248,4 +260,10 @@ impl Rustc { |
| 248 | self.cmd.arg(format!("-Clinker={linker}")); | 260 | self.cmd.arg(format!("-Clinker={linker}")); |
| 249 | self | 261 | self |
| 250 | } | 262 | } |
| 263 | |||
| 264 | /// Specify the linker flavor | ||
| 265 | pub fn linker_flavor(&mut self, linker_flavor: &str) -> &mut Self { | ||
| 266 | self.cmd.arg(format!("-Clinker-flavor={linker_flavor}")); | ||
| 267 | self | ||
| 268 | } | ||
| 251 | } | 269 | } |
src/tools/tidy/src/allowed_run_make_makefiles.txt-9| ... | @@ -13,7 +13,6 @@ run-make/cdylib-fewer-symbols/Makefile | ... | @@ -13,7 +13,6 @@ run-make/cdylib-fewer-symbols/Makefile |
| 13 | run-make/compiler-lookup-paths-2/Makefile | 13 | run-make/compiler-lookup-paths-2/Makefile |
| 14 | run-make/compiler-lookup-paths/Makefile | 14 | run-make/compiler-lookup-paths/Makefile |
| 15 | run-make/compiler-rt-works-on-mingw/Makefile | 15 | run-make/compiler-rt-works-on-mingw/Makefile |
| 16 | run-make/compressed-debuginfo/Makefile | ||
| 17 | run-make/crate-hash-rustc-version/Makefile | 16 | run-make/crate-hash-rustc-version/Makefile |
| 18 | run-make/crate-name-priority/Makefile | 17 | run-make/crate-name-priority/Makefile |
| 19 | run-make/cross-lang-lto-clang/Makefile | 18 | run-make/cross-lang-lto-clang/Makefile |
| ... | @@ -21,7 +20,6 @@ run-make/cross-lang-lto-pgo-smoketest/Makefile | ... | @@ -21,7 +20,6 @@ run-make/cross-lang-lto-pgo-smoketest/Makefile |
| 21 | run-make/cross-lang-lto-upstream-rlibs/Makefile | 20 | run-make/cross-lang-lto-upstream-rlibs/Makefile |
| 22 | run-make/cross-lang-lto/Makefile | 21 | run-make/cross-lang-lto/Makefile |
| 23 | run-make/debug-assertions/Makefile | 22 | run-make/debug-assertions/Makefile |
| 24 | run-make/debugger-visualizer-dep-info/Makefile | ||
| 25 | run-make/dep-info-doesnt-run-much/Makefile | 23 | run-make/dep-info-doesnt-run-much/Makefile |
| 26 | run-make/dep-info-spaces/Makefile | 24 | run-make/dep-info-spaces/Makefile |
| 27 | run-make/dep-info/Makefile | 25 | run-make/dep-info/Makefile |
| ... | @@ -38,7 +36,6 @@ run-make/export-executable-symbols/Makefile | ... | @@ -38,7 +36,6 @@ run-make/export-executable-symbols/Makefile |
| 38 | run-make/extern-diff-internal-name/Makefile | 36 | run-make/extern-diff-internal-name/Makefile |
| 39 | run-make/extern-flag-disambiguates/Makefile | 37 | run-make/extern-flag-disambiguates/Makefile |
| 40 | run-make/extern-flag-pathless/Makefile | 38 | run-make/extern-flag-pathless/Makefile |
| 41 | run-make/extern-flag-rename-transitive/Makefile | ||
| 42 | run-make/extern-fn-explicit-align/Makefile | 39 | run-make/extern-fn-explicit-align/Makefile |
| 43 | run-make/extern-fn-generic/Makefile | 40 | run-make/extern-fn-generic/Makefile |
| 44 | run-make/extern-fn-mangle/Makefile | 41 | run-make/extern-fn-mangle/Makefile |
| ... | @@ -49,10 +46,8 @@ run-make/extern-fn-with-packed-struct/Makefile | ... | @@ -49,10 +46,8 @@ run-make/extern-fn-with-packed-struct/Makefile |
| 49 | run-make/extern-fn-with-union/Makefile | 46 | run-make/extern-fn-with-union/Makefile |
| 50 | run-make/extern-multiple-copies/Makefile | 47 | run-make/extern-multiple-copies/Makefile |
| 51 | run-make/extern-multiple-copies2/Makefile | 48 | run-make/extern-multiple-copies2/Makefile |
| 52 | run-make/extern-overrides-distribution/Makefile | ||
| 53 | run-make/extra-filename-with-temp-outputs/Makefile | 49 | run-make/extra-filename-with-temp-outputs/Makefile |
| 54 | run-make/fmt-write-bloat/Makefile | 50 | run-make/fmt-write-bloat/Makefile |
| 55 | run-make/forced-unwind-terminate-pof/Makefile | ||
| 56 | run-make/foreign-double-unwind/Makefile | 51 | run-make/foreign-double-unwind/Makefile |
| 57 | run-make/foreign-exceptions/Makefile | 52 | run-make/foreign-exceptions/Makefile |
| 58 | run-make/foreign-rust-exceptions/Makefile | 53 | run-make/foreign-rust-exceptions/Makefile |
| ... | @@ -96,7 +91,6 @@ run-make/libtest-json/Makefile | ... | @@ -96,7 +91,6 @@ run-make/libtest-json/Makefile |
| 96 | run-make/libtest-junit/Makefile | 91 | run-make/libtest-junit/Makefile |
| 97 | run-make/libtest-padding/Makefile | 92 | run-make/libtest-padding/Makefile |
| 98 | run-make/libtest-thread-limit/Makefile | 93 | run-make/libtest-thread-limit/Makefile |
| 99 | run-make/link-args-order/Makefile | ||
| 100 | run-make/link-cfg/Makefile | 94 | run-make/link-cfg/Makefile |
| 101 | run-make/link-framework/Makefile | 95 | run-make/link-framework/Makefile |
| 102 | run-make/link-path-order/Makefile | 96 | run-make/link-path-order/Makefile |
| ... | @@ -105,19 +99,16 @@ run-make/llvm-ident/Makefile | ... | @@ -105,19 +99,16 @@ run-make/llvm-ident/Makefile |
| 105 | run-make/long-linker-command-lines-cmd-exe/Makefile | 99 | run-make/long-linker-command-lines-cmd-exe/Makefile |
| 106 | run-make/long-linker-command-lines/Makefile | 100 | run-make/long-linker-command-lines/Makefile |
| 107 | run-make/longjmp-across-rust/Makefile | 101 | run-make/longjmp-across-rust/Makefile |
| 108 | run-make/ls-metadata/Makefile | ||
| 109 | run-make/lto-dylib-dep/Makefile | 102 | run-make/lto-dylib-dep/Makefile |
| 110 | run-make/lto-empty/Makefile | 103 | run-make/lto-empty/Makefile |
| 111 | run-make/lto-linkage-used-attr/Makefile | 104 | run-make/lto-linkage-used-attr/Makefile |
| 112 | run-make/lto-no-link-whole-rlib/Makefile | 105 | run-make/lto-no-link-whole-rlib/Makefile |
| 113 | run-make/lto-readonly-lib/Makefile | ||
| 114 | run-make/lto-smoke-c/Makefile | 106 | run-make/lto-smoke-c/Makefile |
| 115 | run-make/macos-deployment-target/Makefile | 107 | run-make/macos-deployment-target/Makefile |
| 116 | run-make/macos-fat-archive/Makefile | 108 | run-make/macos-fat-archive/Makefile |
| 117 | run-make/manual-link/Makefile | 109 | run-make/manual-link/Makefile |
| 118 | run-make/many-crates-but-no-match/Makefile | 110 | run-make/many-crates-but-no-match/Makefile |
| 119 | run-make/metadata-dep-info/Makefile | 111 | run-make/metadata-dep-info/Makefile |
| 120 | run-make/metadata-flag-frobs-symbols/Makefile | ||
| 121 | run-make/min-global-align/Makefile | 112 | run-make/min-global-align/Makefile |
| 122 | run-make/mingw-export-call-convention/Makefile | 113 | run-make/mingw-export-call-convention/Makefile |
| 123 | run-make/mismatching-target-triples/Makefile | 114 | run-make/mismatching-target-triples/Makefile |
tests/run-make/compressed-debuginfo/Makefile deleted-14| ... | @@ -1,14 +0,0 @@ | ||
| 1 | # ignore-cross-compile | ||
| 2 | include ../tools.mk | ||
| 3 | |||
| 4 | # only-linux | ||
| 5 | # | ||
| 6 | # This tests debuginfo-compression. | ||
| 7 | |||
| 8 | all: zlib zstandard | ||
| 9 | |||
| 10 | zlib: | ||
| 11 | 	test "`$(RUSTC) --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zlib foo.rs 2>&1 | sed 's/.*unknown.*zlib.*/missing/' | head -n 1`" = missing || readelf -t $(TMPDIR)/foo.o | grep -q ZLIB | ||
| 12 | |||
| 13 | zstandard: | ||
| 14 | 	test "`$(RUSTC) --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zstd foo.rs 2>&1 | sed 's/.*unknown.*zstd.*/missing/' | head -n 1`" = missing || readelf -t $(TMPDIR)/foo.o | grep -q ZST | ||
tests/run-make/compressed-debuginfo/rmake.rs created+36| ... | @@ -0,0 +1,36 @@ | ||
| 1 | // Checks the `debuginfo-compression` option. | ||
| 2 | |||
| 3 | //@ only-linux | ||
| 4 | //@ ignore-cross-compile | ||
| 5 | |||
| 6 | // FIXME: This test isn't comprehensive and isn't covering all possible combinations. | ||
| 7 | |||
| 8 | use run_make_support::{assert_contains, cmd, run_in_tmpdir, rustc}; | ||
| 9 | |||
| 10 | fn check_compression(compression: &str, to_find: &str) { | ||
| 11 | run_in_tmpdir(|| { | ||
| 12 | let out = rustc() | ||
| 13 | .crate_name("foo") | ||
| 14 | .crate_type("lib") | ||
| 15 | .emit("obj") | ||
| 16 | .arg("-Cdebuginfo=full") | ||
| 17 | .arg(&format!("-Zdebuginfo-compression={compression}")) | ||
| 18 | .input("foo.rs") | ||
| 19 | .run(); | ||
| 20 | let stderr = out.stderr_utf8(); | ||
| 21 | if stderr.is_empty() { | ||
| 22 | // FIXME: `readelf` might need to be replaced with `llvm-readelf`. | ||
| 23 | cmd("readelf").arg("-t").arg("foo.o").run().assert_stdout_contains(to_find); | ||
| 24 | } else { | ||
| 25 | assert_contains( | ||
| 26 | &stderr, | ||
| 27 | &format!("unknown debuginfo compression algorithm {compression}"), | ||
| 28 | ); | ||
| 29 | } | ||
| 30 | }); | ||
| 31 | } | ||
| 32 | |||
| 33 | fn main() { | ||
| 34 | check_compression("zlib", "ZLIB"); | ||
| 35 | check_compression("zstd", "ZSTD"); | ||
| 36 | } | ||
tests/run-make/debugger-visualizer-dep-info/Makefile deleted-9| ... | @@ -1,9 +0,0 @@ | ||
| 1 | include ../tools.mk | ||
| 2 | |||
| 3 | # This test makes sure that files referenced via #[debugger_visualizer] are | ||
| 4 | # included in `--emit dep-info` output. | ||
| 5 | |||
| 6 | all: | ||
| 7 | 	$(RUSTC) --emit dep-info main.rs | ||
| 8 | 	$(CGREP) "foo.py" < $(TMPDIR)/main.d | ||
| 9 | 	$(CGREP) "my_visualizers/bar.natvis" < $(TMPDIR)/main.d | ||
tests/run-make/debugger-visualizer-dep-info/rmake.rs created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | // This test checks that files referenced via #[debugger_visualizer] are | ||
| 2 | // included in `--emit dep-info` output. | ||
| 3 | // See https://github.com/rust-lang/rust/pull/111641 | ||
| 4 | |||
| 5 | use run_make_support::{invalid_utf8_contains, rustc}; | ||
| 6 | |||
| 7 | fn main() { | ||
| 8 | rustc().emit("dep-info").input("main.rs").run(); | ||
| 9 | invalid_utf8_contains("main.d", "foo.py"); | ||
| 10 | invalid_utf8_contains("main.d", "my_visualizers/bar.natvis"); | ||
| 11 | } | ||
tests/run-make/extern-flag-rename-transitive/Makefile deleted-7| ... | @@ -1,7 +0,0 @@ | ||
| 1 | include ../tools.mk | ||
| 2 | |||
| 3 | all: | ||
| 4 | 	$(RUSTC) foo.rs | ||
| 5 | 	$(RUSTC) bar.rs | ||
| 6 | 	$(RUSTC) baz.rs --extern a=$(TMPDIR)/libfoo.rlib | ||
| 7 | |||
tests/run-make/extern-flag-rename-transitive/rmake.rs created+14| ... | @@ -0,0 +1,14 @@ | ||
| 1 | // In this test, baz.rs is looking for an extern crate "a" which | ||
| 2 | // does not exist, and can only run through the --extern rustc flag | ||
| 3 | // defining that the "a" crate is in fact just "foo". This test | ||
| 4 | // checks that the --extern flag takes precedence over the extern | ||
| 5 | // crate statement in the code. | ||
| 6 | // See https://github.com/rust-lang/rust/pull/52723 | ||
| 7 | |||
| 8 | use run_make_support::{rust_lib_name, rustc}; | ||
| 9 | |||
| 10 | fn main() { | ||
| 11 | rustc().input("foo.rs").run(); | ||
| 12 | rustc().input("bar.rs").run(); | ||
| 13 | rustc().input("baz.rs").extern_("a", rust_lib_name("foo")).run(); | ||
| 14 | } | ||
tests/run-make/extern-overrides-distribution/Makefile deleted-6| ... | @@ -1,6 +0,0 @@ | ||
| 1 | # ignore-cross-compile | ||
| 2 | include ../tools.mk | ||
| 3 | |||
| 4 | all: | ||
| 5 | 	$(RUSTC) libc.rs -Cmetadata=foo | ||
| 6 | 	$(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib | ||
tests/run-make/extern-overrides-distribution/rmake.rs created+14| ... | @@ -0,0 +1,14 @@ | ||
| 1 | // The --extern flag should override any "crate_type" declarations in the | ||
| 2 | // Rust files themselves. In this test, libc is compiled as "lib", but | ||
| 3 | // main.rs will only run with an rlib, which checks if the --extern flag | ||
| 4 | // is successfully overriding the default behaviour. | ||
| 5 | // See https://github.com/rust-lang/rust/pull/21782 | ||
| 6 | |||
| 7 | //@ ignore-cross-compile | ||
| 8 | |||
| 9 | use run_make_support::{rust_lib_name, rustc}; | ||
| 10 | |||
| 11 | fn main() { | ||
| 12 | rustc().input("libc.rs").metadata("foo").run(); | ||
| 13 | rustc().input("main.rs").extern_("libc", rust_lib_name("libc")).run(); | ||
| 14 | } | ||
tests/run-make/forced-unwind-terminate-pof/Makefile deleted-9| ... | @@ -1,9 +0,0 @@ | ||
| 1 | # ignore-cross-compile | ||
| 2 | # only-linux | ||
| 3 | include ../tools.mk | ||
| 4 | |||
| 5 | all: foo | ||
| 6 | 	$(call RUN,foo) | $(CGREP) -v "cannot unwind" | ||
| 7 | |||
| 8 | foo: foo.rs | ||
| 9 | 	$(RUSTC) $< | ||
tests/run-make/forced-unwind-terminate-pof/rmake.rs created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | // During a forced unwind, crossing the non-Plain Old Frame | ||
| 2 | // would define the forced unwind as undefined behaviour, and | ||
| 3 | // immediately abort the unwinding process. This test checks | ||
| 4 | // that the forced unwinding takes precedence. | ||
| 5 | // See https://github.com/rust-lang/rust/issues/101469 | ||
| 6 | |||
| 7 | //@ ignore-cross-compile | ||
| 8 | //@ ignore-windows | ||
| 9 | //Reason: pthread (POSIX threads) is not available on Windows | ||
| 10 | |||
| 11 | use run_make_support::{run, rustc}; | ||
| 12 | |||
| 13 | fn main() { | ||
| 14 | rustc().input("foo.rs").run(); | ||
| 15 | run("foo").assert_stdout_not_contains("cannot unwind"); | ||
| 16 | } | ||
tests/run-make/link-args-order/Makefile deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | # ignore-msvc | ||
| 2 | |||
| 3 | include ../tools.mk | ||
| 4 | |||
| 5 | RUSTC_FLAGS = -C linker-flavor=ld -C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f | ||
| 6 | RUSTC_FLAGS_PRE = -C linker-flavor=ld -Z pre-link-arg=a -Z pre-link-args="b c" -Z pre-link-args="d e" -Z pre-link-arg=f | ||
| 7 | |||
| 8 | all: | ||
| 9 | 	$(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' | ||
| 10 | 	$(RUSTC) $(RUSTC_FLAGS_PRE) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' | ||
tests/run-make/link-args-order/rmake.rs created+30| ... | @@ -0,0 +1,30 @@ | ||
| 1 | // Passing linker arguments to the compiler used to be lost or reordered in a messy way | ||
| 2 | // as they were passed further to the linker. This was fixed in #70665, and this test | ||
| 3 | // checks that linker arguments remain intact and in the order they were originally passed in. | ||
| 4 | // See https://github.com/rust-lang/rust/pull/70665 | ||
| 5 | |||
| 6 | //@ ignore-msvc | ||
| 7 | // Reason: the ld linker does not exist on Windows. | ||
| 8 | |||
| 9 | use run_make_support::rustc; | ||
| 10 | |||
| 11 | fn main() { | ||
| 12 | rustc() | ||
| 13 | .input("empty.rs") | ||
| 14 | .linker_flavor("ld") | ||
| 15 | .link_arg("a") | ||
| 16 | .link_args("b c") | ||
| 17 | .link_args("d e") | ||
| 18 | .link_arg("f") | ||
| 19 | .run_fail() | ||
| 20 | .assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#); | ||
| 21 | rustc() | ||
| 22 | .input("empty.rs") | ||
| 23 | .linker_flavor("ld") | ||
| 24 | .arg("-Zpre-link-arg=a") | ||
| 25 | .arg("-Zpre-link-args=b c") | ||
| 26 | .arg("-Zpre-link-args=d e") | ||
| 27 | .arg("-Zpre-link-arg=f") | ||
| 28 | .run_fail() | ||
| 29 | .assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#); | ||
| 30 | } | ||
tests/run-make/ls-metadata/Makefile deleted-8| ... | @@ -1,8 +0,0 @@ | ||
| 1 | # ignore-cross-compile | ||
| 2 | include ../tools.mk | ||
| 3 | |||
| 4 | all: | ||
| 5 | 	$(RUSTC) foo.rs | ||
| 6 | 	$(RUSTC) -Z ls=root $(TMPDIR)/foo | ||
| 7 | 	touch $(TMPDIR)/bar | ||
| 8 | 	$(RUSTC) -Z ls=root $(TMPDIR)/bar | ||
tests/run-make/ls-metadata/rmake.rs created+17| ... | @@ -0,0 +1,17 @@ | ||
| 1 | // Passing invalid files to -Z ls (which lists the symbols | ||
| 2 | // defined by a library crate) used to cause a segmentation fault. | ||
| 3 | // As this was fixed in #11262, this test checks that no segfault | ||
| 4 | // occurs when passing the invalid file `bar` to -Z ls. | ||
| 5 | // See https://github.com/rust-lang/rust/issues/11259 | ||
| 6 | |||
| 7 | //@ ignore-cross-compile | ||
| 8 | |||
| 9 | use run_make_support::fs_wrapper; | ||
| 10 | use run_make_support::rustc; | ||
| 11 | |||
| 12 | fn main() { | ||
| 13 | rustc().input("foo.rs").run(); | ||
| 14 | rustc().arg("-Zls=root").input("foo").run(); | ||
| 15 | fs_wrapper::create_file("bar"); | ||
| 16 | rustc().arg("-Zls=root").input("bar").run(); | ||
| 17 | } | ||
tests/run-make/lto-readonly-lib/Makefile deleted-13| ... | @@ -1,13 +0,0 @@ | ||
| 1 | # ignore-cross-compile | ||
| 2 | include ../tools.mk | ||
| 3 | |||
| 4 | all: | ||
| 5 | 	$(RUSTC) lib.rs | ||
| 6 | |||
| 7 | 	# the compiler needs to copy and modify the rlib file when performing | ||
| 8 | 	# LTO, so we should ensure that it can cope with the original rlib | ||
| 9 | 	# being read-only. | ||
| 10 | 	chmod 444 $(TMPDIR)/*.rlib | ||
| 11 | |||
| 12 | 	$(RUSTC) main.rs -C lto | ||
| 13 | 	$(call RUN,main) | ||
tests/run-make/lto-readonly-lib/rmake.rs created+19| ... | @@ -0,0 +1,19 @@ | ||
| 1 | // When the compiler is performing link time optimization, it will | ||
| 2 | // need to copy the original rlib file, set the copy's permissions to read/write, | ||
| 3 | // and modify that copy - even if the original | ||
| 4 | // file is read-only. This test creates a read-only rlib, and checks that | ||
| 5 | // compilation with LTO succeeds. | ||
| 6 | // See https://github.com/rust-lang/rust/pull/17619 | ||
| 7 | |||
| 8 | //@ ignore-cross-compile | ||
| 9 | |||
| 10 | use run_make_support::fs_wrapper; | ||
| 11 | use run_make_support::{run, rust_lib_name, rustc, test_while_readonly}; | ||
| 12 | |||
| 13 | fn main() { | ||
| 14 | rustc().input("lib.rs").run(); | ||
| 15 | test_while_readonly(rust_lib_name("lib"), || { | ||
| 16 | rustc().input("main.rs").arg("-Clto").run(); | ||
| 17 | run("main"); | ||
| 18 | }); | ||
| 19 | } | ||
tests/run-make/metadata-flag-frobs-symbols/Makefile deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | # ignore-cross-compile | ||
| 2 | include ../tools.mk | ||
| 3 | |||
| 4 | all: | ||
| 5 | 	$(RUSTC) foo.rs -C metadata=a -C extra-filename=-a | ||
| 6 | 	$(RUSTC) foo.rs -C metadata=b -C extra-filename=-b | ||
| 7 | 	$(RUSTC) bar.rs \ | ||
| 8 | 		--extern foo1=$(TMPDIR)/libfoo-a.rlib \ | ||
| 9 | 		--extern foo2=$(TMPDIR)/libfoo-b.rlib \ | ||
| 10 | 		--print link-args | ||
| 11 | 	$(call RUN,bar) | ||
tests/run-make/metadata-flag-frobs-symbols/rmake.rs created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | // In this test, foo.rs is compiled twice with different hashes tied to its | ||
| 2 | // symbols thanks to the metadata flag. bar.rs then ensures that the memory locations | ||
| 3 | // of foo's symbols are different even though they came from the same original source code. | ||
| 4 | // This checks that the metadata flag is doing its job. | ||
| 5 | // See https://github.com/rust-lang/rust/issues/14471 | ||
| 6 | |||
| 7 | //@ ignore-cross-compile | ||
| 8 | |||
| 9 | use run_make_support::{run, rust_lib_name, rustc}; | ||
| 10 | |||
| 11 | fn main() { | ||
| 12 | rustc().input("foo.rs").metadata("a").extra_filename("-a").run(); | ||
| 13 | rustc().input("foo.rs").metadata("b").extra_filename("-b").run(); | ||
| 14 | rustc() | ||
| 15 | .input("bar.rs") | ||
| 16 | .extern_("foo1", rust_lib_name("foo-a")) | ||
| 17 | .extern_("foo2", rust_lib_name("foo-b")) | ||
| 18 | .run(); | ||
| 19 | run("bar"); | ||
| 20 | } | ||
tests/ui/lifetimes/tail-expr-lock-poisoning.rs+1| ... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
| 3 | //@ [edition2024] compile-flags: -Zunstable-options | 3 | //@ [edition2024] compile-flags: -Zunstable-options |
| 4 | //@ [edition2024] edition: 2024 | 4 | //@ [edition2024] edition: 2024 |
| 5 | //@ run-pass | 5 | //@ run-pass |
| 6 | //@ needs-unwind | ||
| 6 | #![cfg_attr(edition2024, feature(shorter_tail_lifetimes))] | 7 | #![cfg_attr(edition2024, feature(shorter_tail_lifetimes))] |
| 7 | 8 | ||
| 8 | use std::sync::Mutex; | 9 | use std::sync::Mutex; |
tests/ui/resolve/path-attr-in-const-block.rs created+9| ... | @@ -0,0 +1,9 @@ | ||
| 1 | // issue#126516 | ||
| 2 | // issue#126647 | ||
| 3 | |||
| 4 | fn main() { | ||
| 5 | const { | ||
| 6 | #![path = foo!()] | ||
| 7 | //~^ ERROR: cannot find macro `foo` in this scope | ||
| 8 | } | ||
| 9 | } | ||
tests/ui/resolve/path-attr-in-const-block.stderr created+8| ... | @@ -0,0 +1,8 @@ | ||
| 1 | error: cannot find macro `foo` in this scope | ||
| 2 | --> $DIR/path-attr-in-const-block.rs:6:19 | ||
| 3 | | | ||
| 4 | LL | #![path = foo!()] | ||
| 5 | | ^^^ | ||
| 6 | |||
| 7 | error: aborting due to 1 previous error | ||
| 8 | |||