mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
More precise highlighting rules for constant modifier
This commit is contained in:
parent
640c8b722e
commit
77607ab99a
22 changed files with 87 additions and 6 deletions
|
@ -629,6 +629,52 @@ fn main() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_highlighting() {
|
||||
check_highlighting(
|
||||
r#"
|
||||
macro_rules! id {
|
||||
($($tt:tt)*) => {
|
||||
$($tt)*
|
||||
};
|
||||
}
|
||||
const CONST_ITEM: *const () = &raw const ();
|
||||
const fn const_fn<const CONST_PARAM: ()>(const {}: const fn()) where (): const ConstTrait {
|
||||
CONST_ITEM;
|
||||
CONST_PARAM;
|
||||
const {
|
||||
const || {}
|
||||
}
|
||||
id!(
|
||||
CONST_ITEM;
|
||||
CONST_PARAM;
|
||||
const {
|
||||
const || {}
|
||||
};
|
||||
&raw const ();
|
||||
const
|
||||
);
|
||||
}
|
||||
trait ConstTrait {
|
||||
const ASSOC_CONST: () = ();
|
||||
const fn assoc_const_fn() {}
|
||||
}
|
||||
impl const ConstTrait for () {
|
||||
const ASSOC_CONST: () = ();
|
||||
const fn assoc_const_fn() {}
|
||||
}
|
||||
|
||||
macro_rules! unsafe_deref {
|
||||
() => {
|
||||
*(&() as *const ())
|
||||
};
|
||||
}
|
||||
"#,
|
||||
expect_file!["./test_data/highlight_const.html"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_highlight_doc_comment() {
|
||||
check_highlighting(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue