-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathlib.rs
More file actions
49 lines (37 loc) · 1 KB
/
lib.rs
File metadata and controls
49 lines (37 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ensure_no_std/src/main.rs
#![no_std]
#![allow(unused_imports)]
extern crate alloc;
// Import the crates that we want to check if they are fully no-std compliance
use cometbft;
use cometbft_light_client_verifier;
use cometbft_proto;
#[cfg(feature = "sp-core")]
use sp_core;
#[cfg(feature = "sp-io")]
use sp_io;
#[cfg(feature = "sp-runtime")]
use sp_runtime;
#[cfg(feature = "sp-std")]
use sp_std;
use core::panic::PanicInfo;
/*
This function definition checks for the compliance of no-std in
dependencies by causing a compile error if this crate is
linked with `std`. When that happens, you should see error messages
such as follows:
```
error[E0152]: found duplicate lang item `panic_impl`
--> no-std-check/src/lib.rs
|
12 | fn panic(_info: &PanicInfo) -> ! {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the lang item is first defined in crate `std` (which `offending-crate` depends on)
```
*/
#[cfg(feature = "panic-handler")]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}