Skip to content

Commit 9b882b3

Browse files
Update Tests
1 parent e7c0d27 commit 9b882b3

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ compile-flags: -C no-prepopulate-passes -C opt-level=0
2+
3+
#![crate_type = "lib"]
4+
5+
// String formating macros without any arguments should compile
6+
// to a `memcpy` followed by a call to `std::io::stdio::_print`.
7+
8+
#[no_mangle]
9+
pub fn code() {
10+
// CHECK-LABEL: @code
11+
// CHECK-NOT: getelementptr
12+
// CHECK-NOT: store
13+
// CHECK-NOT: ; call core::fmt::Arguments::new_const
14+
// CHECK: call void @llvm.memcpy
15+
// CHECK-NEXT: ; call std::io::stdio::_print
16+
println!("hello world");
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
pub fn main() {
3+
const A: std::fmt::Arguments = std::fmt::Arguments::new_const(&[&"hola"]);
4+
//~^ use of unstable library feature
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0658]: use of unstable library feature 'fmt_internals'
2+
--> $DIR/const-format-arguments.rs:3:36
3+
|
4+
LL | const A: std::fmt::Arguments = std::fmt::Arguments::new_const(&[&"hola"]);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add `#![feature(fmt_internals)]` to the crate attributes to enable
8+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9+
10+
error: `Arguments::<'a>::new_const` is not yet stable as a const fn
11+
--> $DIR/const-format-arguments.rs:3:36
12+
|
13+
LL | const A: std::fmt::Arguments = std::fmt::Arguments::new_const(&[&"hola"]);
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)