Skip to content

Commit a174f2a

Browse files
committed
add more tests
1 parent da2ee5d commit a174f2a

File tree

6 files changed

+115
-0
lines changed

6 files changed

+115
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// no-prefer-dynamic
12+
13+
#![crate_type = "rlib"]
14+
#![feature(panic_implementation)]
15+
#![no_std]
16+
17+
use core::panic::PanicInfo;
18+
19+
#[panic_implementation]
20+
fn panic(info: &PanicInfo) -> ! {
21+
loop {}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: duplicate lang item found: `panic_impl`.
12+
13+
#![feature(panic_implementation)]
14+
15+
use std::panic::PanicInfo;
16+
17+
#[panic_implementation]
18+
fn panic(info: PanicInfo) -> ! {
19+
loop {}
20+
}
21+
22+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:some-panic-impl.rs
12+
13+
#![feature(panic_implementation)]
14+
#![feature(lang_items)]
15+
#![no_std]
16+
#![no_main]
17+
18+
extern crate some_panic_impl;
19+
20+
use core::panic::PanicInfo;
21+
22+
#[panic_implementation]
23+
fn panic(info: &PanicInfo) -> ! {
24+
//~^ error duplicate lang item found: `panic_impl`
25+
loop {}
26+
}
27+
28+
#[lang = "eh_personality"]
29+
fn eh() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-include ../../run-make-fulldeps/tools.mk
2+
3+
# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main
4+
# in this crate)
5+
all:
6+
$(RUSTC) panic-impl-provider.rs
7+
$(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![no_std]
12+
#![no_main]
13+
14+
// this crate provides the `panic_impl` lang item so we don't need to define it here
15+
extern crate panic_impl_provider;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type = "rlib"]
12+
#![feature(panic_implementation)]
13+
#![no_std]
14+
15+
use core::panic::PanicInfo;
16+
17+
#[panic_implementation]
18+
fn panic(info: &PanicInfo) -> ! {
19+
loop {}
20+
}

0 commit comments

Comments
 (0)