aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs19
2 files changed, 20 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index b82b51efd..c5098189b 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -565,7 +565,7 @@ fn highlight_element(
565 _ => h, 565 _ => h,
566 } 566 }
567 } 567 }
568 REF_EXPR => { 568 T![&] => {
569 let ref_expr = element.into_node().and_then(ast::RefExpr::cast)?; 569 let ref_expr = element.into_node().and_then(ast::RefExpr::cast)?;
570 let expr = ref_expr.expr()?; 570 let expr = ref_expr.expr()?;
571 let field_expr = match expr { 571 let field_expr = match expr {
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index f2c078d34..c40805850 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -299,6 +299,23 @@ struct Packed {
299 c: u32, 299 c: u32,
300} 300}
301 301
302trait DoTheAutoref {
303 fn calls_autoref(&self);
304}
305
306struct NeedsAlign {
307 a: u16
308}
309
310#[repr(packed)]
311struct HasAligned {
312 a: NeedsAlign
313}
314
315impl DoTheAutoref for NeedsAlign {
316 fn calls_autored(&self) {}
317}
318
302fn main() { 319fn main() {
303 let x = &5 as *const usize; 320 let x = &5 as *const usize;
304 let u = Union { b: 0 }; 321 let u = Union { b: 0 };
@@ -317,6 +334,8 @@ fn main() {
317 let a = &packed.a; 334 let a = &packed.a;
318 let b = &packed.b; 335 let b = &packed.b;
319 let c = &packed.c; 336 let c = &packed.c;
337 let h = HasAligned{ a: NeedsAlign { a: 1 } };
338 h.a.calls_autoref();
320 } 339 }
321} 340}
322"# 341"#