diff options
author | Galilée 'Bill' Enguehard <[email protected]> | 2020-05-21 22:27:38 +0100 |
---|---|---|
committer | Galilée 'Bill' Enguehard <[email protected]> | 2020-05-21 22:27:38 +0100 |
commit | 7fece3bdd2450c0807f7dd742239cae95f0cc65e (patch) | |
tree | 866c4db826c959e79c63a6727bdb9f2c61e6fc4f /crates/ra_hir_expand/src/builtin_macro.rs | |
parent | db926218b2082077750291f8426ddd28b284cd08 (diff) | |
parent | 59732df8d40dfadc6dcf5951265416576399712a (diff) |
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into modname_spacing
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_macro.rs')
-rw-r--r-- | crates/ra_hir_expand/src/builtin_macro.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index e0fef613d..3bce8f673 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs | |||
@@ -73,11 +73,13 @@ pub fn find_builtin_macro( | |||
73 | krate: Some(krate), | 73 | krate: Some(krate), |
74 | ast_id: Some(ast_id), | 74 | ast_id: Some(ast_id), |
75 | kind: MacroDefKind::BuiltIn(kind), | 75 | kind: MacroDefKind::BuiltIn(kind), |
76 | local_inner: false, | ||
76 | }), | 77 | }), |
77 | Either::Right(kind) => Some(MacroDefId { | 78 | Either::Right(kind) => Some(MacroDefId { |
78 | krate: Some(krate), | 79 | krate: Some(krate), |
79 | ast_id: Some(ast_id), | 80 | ast_id: Some(ast_id), |
80 | kind: MacroDefKind::BuiltInEager(kind), | 81 | kind: MacroDefKind::BuiltInEager(kind), |
82 | local_inner: false, | ||
81 | }), | 83 | }), |
82 | } | 84 | } |
83 | } | 85 | } |
@@ -358,7 +360,7 @@ fn env_expand( | |||
358 | // However, we cannot use an empty string here, because for | 360 | // However, we cannot use an empty string here, because for |
359 | // `include!(concat!(env!("OUT_DIR"), "/foo.rs"))` will become | 361 | // `include!(concat!(env!("OUT_DIR"), "/foo.rs"))` will become |
360 | // `include!("foo.rs"), which might go to infinite loop | 362 | // `include!("foo.rs"), which might go to infinite loop |
361 | let s = get_env_inner(db, arg_id, &key).unwrap_or_else(|| "__RA_UNIMPLEMENTATED__".to_string()); | 363 | let s = get_env_inner(db, arg_id, &key).unwrap_or_else(|| "__RA_UNIMPLEMENTED__".to_string()); |
362 | let expanded = quote! { #s }; | 364 | let expanded = quote! { #s }; |
363 | 365 | ||
364 | Ok((expanded, FragmentKind::Expr)) | 366 | Ok((expanded, FragmentKind::Expr)) |
@@ -406,6 +408,7 @@ mod tests { | |||
406 | krate: Some(CrateId(0)), | 408 | krate: Some(CrateId(0)), |
407 | ast_id: Some(AstId::new(file_id.into(), ast_id_map.ast_id(¯o_calls[0]))), | 409 | ast_id: Some(AstId::new(file_id.into(), ast_id_map.ast_id(¯o_calls[0]))), |
408 | kind: MacroDefKind::BuiltIn(expander), | 410 | kind: MacroDefKind::BuiltIn(expander), |
411 | local_inner: false, | ||
409 | }; | 412 | }; |
410 | 413 | ||
411 | let loc = MacroCallLoc { | 414 | let loc = MacroCallLoc { |
@@ -425,6 +428,7 @@ mod tests { | |||
425 | krate: Some(CrateId(0)), | 428 | krate: Some(CrateId(0)), |
426 | ast_id: Some(AstId::new(file_id.into(), ast_id_map.ast_id(¯o_calls[0]))), | 429 | ast_id: Some(AstId::new(file_id.into(), ast_id_map.ast_id(¯o_calls[0]))), |
427 | kind: MacroDefKind::BuiltInEager(expander), | 430 | kind: MacroDefKind::BuiltInEager(expander), |
431 | local_inner: false, | ||
428 | }; | 432 | }; |
429 | 433 | ||
430 | let args = macro_calls[1].token_tree().unwrap(); | 434 | let args = macro_calls[1].token_tree().unwrap(); |
@@ -504,7 +508,7 @@ mod tests { | |||
504 | "#, | 508 | "#, |
505 | ); | 509 | ); |
506 | 510 | ||
507 | assert_eq!(expanded, "\"__RA_UNIMPLEMENTATED__\""); | 511 | assert_eq!(expanded, "\"__RA_UNIMPLEMENTED__\""); |
508 | } | 512 | } |
509 | 513 | ||
510 | #[test] | 514 | #[test] |