Skip to content

Commit 874df3b

Browse files
committed
Add eager-expand comment
1 parent c89fd01 commit 874df3b

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

crates/hir-expand/src/builtin_fn_macro.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,10 @@ fn quote_expand(
776776
_db: &dyn ExpandDatabase,
777777
_arg_id: MacroCallId,
778778
_tt: &tt::Subtree,
779-
_span: SpanData,
779+
span: SpanData,
780780
) -> ExpandResult<tt::Subtree> {
781-
ExpandResult::only_err(ExpandError::other("quote! is not implemented"))
781+
ExpandResult::new(
782+
tt::Subtree::empty(tt::DelimSpan { open: span, close: span }),
783+
ExpandError::other("quote! is not implemented"),
784+
)
782785
}

crates/hir/src/source_analyzer.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,9 @@ fn resolve_hir_path_qualifier(
11651165
(|| {
11661166
let (ty, unresolved) = match path.type_anchor() {
11671167
Some(type_ref) => {
1168-
let (_, res) = TyLoweringContext::new(db, resolver, resolver.module().into())
1169-
.lower_ty_ext(type_ref);
1168+
let (_, res) =
1169+
TyLoweringContext::new_maybe_unowned(db, resolver, resolver.type_owner())
1170+
.lower_ty_ext(type_ref);
11701171
res.map(|ty_ns| (ty_ns, path.segments().first()))
11711172
}
11721173
None => {

crates/proc-macro-srv/src/server/rust_analyzer_span.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ impl server::TokenStream for RaSpanServer {
143143
}
144144

145145
fn expand_expr(&mut self, self_: &Self::TokenStream) -> Result<Self::TokenStream, ()> {
146+
// FIXME: requires db, more importantly this requires name resolution so we would need to
147+
// eagerly expand this proc-macro, but we can't know that this proc-macro is eager until we
148+
// expand it ...
149+
// This calls for some kind of marker that a proc-macro wants to access this eager API,
150+
// otherwise we need to treat every proc-macro eagerly / or not support this.
146151
Ok(self_.clone())
147152
}
148153

0 commit comments

Comments
 (0)