Add eager-expand comment

This commit is contained in:
Lukas Wirth 2023-12-15 14:44:09 +01:00
parent c89fd01739
commit 874df3bffa
3 changed files with 13 additions and 4 deletions

View File

@ -776,7 +776,10 @@ fn quote_expand(
_db: &dyn ExpandDatabase, _db: &dyn ExpandDatabase,
_arg_id: MacroCallId, _arg_id: MacroCallId,
_tt: &tt::Subtree, _tt: &tt::Subtree,
_span: SpanData, span: SpanData,
) -> ExpandResult<tt::Subtree> { ) -> 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"),
)
} }

View File

@ -1165,7 +1165,8 @@ fn resolve_hir_path_qualifier(
(|| { (|| {
let (ty, unresolved) = match path.type_anchor() { let (ty, unresolved) = match path.type_anchor() {
Some(type_ref) => { Some(type_ref) => {
let (_, res) = TyLoweringContext::new(db, resolver, resolver.module().into()) let (_, res) =
TyLoweringContext::new_maybe_unowned(db, resolver, resolver.type_owner())
.lower_ty_ext(type_ref); .lower_ty_ext(type_ref);
res.map(|ty_ns| (ty_ns, path.segments().first())) res.map(|ty_ns| (ty_ns, path.segments().first()))
} }

View File

@ -143,6 +143,11 @@ impl server::TokenStream for RaSpanServer {
} }
fn expand_expr(&mut self, self_: &Self::TokenStream) -> Result<Self::TokenStream, ()> { 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()) Ok(self_.clone())
} }