aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 6b7874460..0cab684eb 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -565,6 +565,30 @@ fn highlight_element(
565 _ => h, 565 _ => h,
566 } 566 }
567 } 567 }
568 REF_EXPR => {
569 let ref_expr = element.into_node().and_then(ast::RefExpr::cast)?;
570 let expr = ref_expr.expr()?;
571 let field_expr = match expr {
572 ast::Expr::FieldExpr(fe) => fe,
573 _ => return None,
574 };
575
576 let expr = field_expr.expr()?;
577 let ty = match sema.type_of_expr(&expr) {
578 Some(ty) => ty,
579 None => {
580 println!("No type :(");
581 return None;
582 }
583 };
584 if !ty.is_packed(db) {
585 return None;
586 }
587
588 // FIXME account for alignment... somehow
589
590 Highlight::new(HighlightTag::Operator) | HighlightModifier::Unsafe
591 }
568 p if p.is_punct() => match p { 592 p if p.is_punct() => match p {
569 T![::] | T![->] | T![=>] | T![&] | T![..] | T![=] | T![@] => { 593 T![::] | T![->] | T![=>] | T![&] | T![..] | T![=] | T![@] => {
570 HighlightTag::Operator.into() 594 HighlightTag::Operator.into()