Add const_format_args! builtin macro, fix highlighting

This commit is contained in:
Jonas Schievink 2021-09-30 17:16:39 +02:00
parent 12fe0e4ffe
commit b994469a13
5 changed files with 35 additions and 10 deletions

View file

@ -441,10 +441,14 @@ macro_rules! println {
})
}
#[rustc_builtin_macro]
macro_rules! format_args_nl {
($fmt:expr) => {{ /* compiler built-in */ }};
($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
}
#[macro_export]
macro_rules! format_args {}
#[rustc_builtin_macro]
#[macro_export]
macro_rules! const_format_args {}
#[rustc_builtin_macro]
#[macro_export]
macro_rules! format_args_nl {}
mod panic {
pub macro panic_2015 {
@ -474,6 +478,11 @@ macro_rules! panic {}
#[rustc_builtin_macro]
macro_rules! assert {}
macro_rules! todo {
() => ($crate::panic!("not yet implemented"));
($($arg:tt)+) => ($crate::panic!("not yet implemented: {}", $crate::format_args!($($arg)+)));
}
fn main() {
// from https://doc.rust-lang.org/std/fmt/index.html
println!("Hello"); // => "Hello"
@ -527,6 +536,7 @@ fn main() {
panic!("more {}", 1);
assert!(true, "{}", 1);
assert!(true, "{} asdasd", 1);
todo!("{}fmt", 0);
}"#
.trim(),
expect_file!["./test_data/highlight_strings.html"],