Rollup merge of #125146 - Oneirical:panic-impl, r=jieyouxu · rust-lang/rust@0915629

File tree

3 files changed

lines changed

  • tests/run-make/panic-impl-transitive

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -190,7 +190,6 @@ run-make/output-with-hyphens/Makefile

190190

run-make/override-aliased-flags/Makefile

191191

run-make/overwrite-input/Makefile

192192

run-make/panic-abort-eh_frame/Makefile

193-

run-make/panic-impl-transitive/Makefile

194193

run-make/pass-linker-flags-flavor/Makefile

195194

run-make/pass-linker-flags-from-dep/Makefile

196195

run-make/pass-linker-flags/Makefile

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,19 @@

1+

// In Rust programs where the standard library is unavailable (#![no_std]), we may be interested

2+

// in customizing how panics are handled. Here, the provider specifies that panics should be handled

3+

// by entering an infinite loop. This test checks that this panic implementation can be transitively

4+

// provided by an external crate.

5+

// --emit=llvm-ir is used to avoid running the linker, as linking will fail due to the lack of main

6+

// function in the crate.

7+

// See https://github.com/rust-lang/rust/pull/50338

8+
9+

use run_make_support::{rustc, tmp_dir};

10+
11+

fn main() {

12+

rustc().input("panic-impl-provider.rs").run();

13+

rustc()

14+

.input("panic-impl-consumer.rs")

15+

.panic("abort")

16+

.emit("llvm-ir")

17+

.library_search_path(tmp_dir())

18+

.run();

19+

}