mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Add const_format_args!
builtin macro, fix highlighting
This commit is contained in:
parent
12fe0e4ffe
commit
b994469a13
5 changed files with 35 additions and 10 deletions
|
@ -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"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue