Skip to content

Commit e1e69c4

Browse files
committed
Add doc about eager expansion name resolution
1 parent 464adc5 commit e1e69c4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

crates/ra_hir_expand/src/eager.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
//! Eager expansion related utils
2+
//!
3+
//! Here is a dump of a discussion from Vadim Petrochenkov about Eager Expansion and
4+
//! Its name resolution :
5+
//!
6+
//! > Eagerly expanded macros (and also macros eagerly expanded by eagerly expanded macros,
7+
//! > which actually happens in practice too!) are resolved at the location of the "root" macro
8+
//! > that performs the eager expansion on its arguments.
9+
//! > If some name cannot be resolved at the eager expansion time it's considered unresolved,
10+
//! > even if becomes available later (e.g. from a glob import or other macro).
11+
//!
12+
//! > Eagerly expanded macros don't add anything to the module structure of the crate and
13+
//! > don't build any speculative module structures, i.e. they are expanded in a "flat"
14+
//! > way even if tokens in them look like modules.
15+
//!
16+
//! > In other words, it kinda works for simple cases for which it was originally intended,
17+
//! > and we need to live with it because it's available on stable and widely relied upon.
18+
//!
19+
//!
20+
//! See the full discussion : https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Eager.20expansion.20of.20built-in.20macros
221
322
use crate::{
423
ast::{self, AstNode},

0 commit comments

Comments
 (0)