]> git.lizzy.rs Git - rust.git/blob - src/test/ui/format-no-std.rs
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
[rust.git] / src / test / ui / format-no-std.rs
1 // run-pass
2 // ignore-emscripten no no_std executables
3
4 #![feature(lang_items, start)]
5 #![no_std]
6
7 extern crate std as other;
8
9 #[macro_use] extern crate alloc;
10
11 use alloc::string::ToString;
12
13 #[start]
14 fn start(_argc: isize, _argv: *const *const u8) -> isize {
15     let s = format!("{}", 1_isize);
16     assert_eq!(s, "1".to_string());
17
18     let s = format!("test");
19     assert_eq!(s, "test".to_string());
20
21     let s = format!("{test}", test=3_isize);
22     assert_eq!(s, "3".to_string());
23
24     let s = format!("hello {}", "world");
25     assert_eq!(s, "hello world".to_string());
26
27     0
28 }