-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86d69c7
commit 78a2f9d
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ compile-flags: -C no-prepopulate-passes -C opt-level=0 | ||
|
||
#![crate_type = "lib"] | ||
|
||
// String formating macros without any arguments should compile | ||
// to a `memcpy` followed by a call to `std::io::stdio::_print`. | ||
|
||
#[no_mangle] | ||
pub fn code() { | ||
// CHECK-LABEL: @code | ||
// CHECK-NOT: getelementptr | ||
// CHECK-NOT: store | ||
// CHECK-NOT: ; call core::fmt::Arguments::new_const | ||
// CHECK: call void @llvm.memcpy | ||
// CHECK-NEXT: ; call std::io::stdio::_print | ||
println!("hello world"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
pub fn main() { | ||
const A: std::fmt::Arguments = std::fmt::Arguments::new_const(&[&"hola"]); | ||
//~^ use of unstable library feature | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0658]: use of unstable library feature 'fmt_internals' | ||
--> $DIR/const-format-arguments.rs:3:36 | ||
| | ||
LL | const A: std::fmt::Arguments = std::fmt::Arguments::new_const(&[&"hola"]); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add `#![feature(fmt_internals)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error: `Arguments::<'a>::new_const` is not yet stable as a const fn | ||
--> $DIR/const-format-arguments.rs:3:36 | ||
| | ||
LL | const A: std::fmt::Arguments = std::fmt::Arguments::new_const(&[&"hola"]); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |