diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2023-12-15 14:44:09 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2023-12-21 17:23:36 +0100 |
| commit | 874df3bffa76a22e92840eb60aa4018c7152512e (patch) | |
| tree | e5c3c123fce92d9282fa1c04f1540ba30ac54d60 | |
| parent | c89fd01739c760379e01f91f49b26d1148d7d00e (diff) | |
| download | rust-874df3bffa76a22e92840eb60aa4018c7152512e.tar.gz rust-874df3bffa76a22e92840eb60aa4018c7152512e.zip | |
Add eager-expand comment
| -rw-r--r-- | crates/hir-expand/src/builtin_fn_macro.rs | 7 | ||||
| -rw-r--r-- | crates/hir/src/source_analyzer.rs | 5 | ||||
| -rw-r--r-- | crates/proc-macro-srv/src/server/rust_analyzer_span.rs | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/crates/hir-expand/src/builtin_fn_macro.rs b/crates/hir-expand/src/builtin_fn_macro.rs index 6f5f0295e2f..2d8202b8c65 100644 --- a/crates/hir-expand/src/builtin_fn_macro.rs +++ b/crates/hir-expand/src/builtin_fn_macro.rs @@ -776,7 +776,10 @@ fn quote_expand( _db: &dyn ExpandDatabase, _arg_id: MacroCallId, _tt: &tt::Subtree, - _span: SpanData, + span: SpanData, ) -> ExpandResult<tt::Subtree> { - ExpandResult::only_err(ExpandError::other("quote! is not implemented")) + ExpandResult::new( + tt::Subtree::empty(tt::DelimSpan { open: span, close: span }), + ExpandError::other("quote! is not implemented"), + ) } diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index e48f911f22b..0961a713761 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs @@ -1165,8 +1165,9 @@ fn resolve_hir_path_qualifier( (|| { let (ty, unresolved) = match path.type_anchor() { Some(type_ref) => { - let (_, res) = TyLoweringContext::new(db, resolver, resolver.module().into()) - .lower_ty_ext(type_ref); + let (_, res) = + TyLoweringContext::new_maybe_unowned(db, resolver, resolver.type_owner()) + .lower_ty_ext(type_ref); res.map(|ty_ns| (ty_ns, path.segments().first())) } None => { diff --git a/crates/proc-macro-srv/src/server/rust_analyzer_span.rs b/crates/proc-macro-srv/src/server/rust_analyzer_span.rs index adb7ff1bdfa..37b68bba7d4 100644 --- a/crates/proc-macro-srv/src/server/rust_analyzer_span.rs +++ b/crates/proc-macro-srv/src/server/rust_analyzer_span.rs @@ -143,6 +143,11 @@ impl server::TokenStream for RaSpanServer { } fn expand_expr(&mut self, self_: &Self::TokenStream) -> Result<Self::TokenStream, ()> { + // FIXME: requires db, more importantly this requires name resolution so we would need to + // eagerly expand this proc-macro, but we can't know that this proc-macro is eager until we + // expand it ... + // This calls for some kind of marker that a proc-macro wants to access this eager API, + // otherwise we need to treat every proc-macro eagerly / or not support this. Ok(self_.clone()) } |
