Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::{
use crate::compiler::analyses::user_components::{UserComponent, UserComponentId};
use crate::compiler::component::{DefaultStrategy, PrebuiltType};
use pavex_bp_schema::{CloningPolicy, Lint, LintSetting};
use rustdoc_resolver::{resolve_free_function, rustdoc_method2callable};
use rustdoc_resolver::{TypeAliasResolution, resolve_free_function, rustdoc_method2callable};

/// Resolve coordinates to the annotation they point to.
/// Then process the corresponding item.
Expand Down Expand Up @@ -212,9 +212,9 @@ pub(crate) fn resolve_annotation_coordinates(

let outcome = match annotation.impl_ {
Some(ImplInfo { attached_to, impl_ }) => {
rustdoc_method2callable(attached_to, impl_, &item, krate, krate_collection)
rustdoc_method2callable(attached_to, impl_, &item, krate, krate_collection, TypeAliasResolution::ResolveThrough)
}
None => resolve_free_function(&item, krate, krate_collection)
None => resolve_free_function(&item, krate, krate_collection, TypeAliasResolution::ResolveThrough)
.map(rustdoc_ir::Callable::FreeFunction),
};
let callable = match outcome {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ pub(super) fn register_imported_components(

let outcome = match annotation.impl_ {
Some(ImplInfo { attached_to, impl_ }) => {
rustdoc_method2callable(attached_to, impl_, &item, krate, krate_collection)
rustdoc_method2callable(attached_to, impl_, &item, krate, krate_collection, TypeAliasResolution::ResolveThrough)
}
None => resolve_free_function(&item, krate, krate_collection)
None => resolve_free_function(&item, krate, krate_collection, TypeAliasResolution::ResolveThrough)
.map(rustdoc_ir::Callable::FreeFunction),
};
let callable = match outcome {
Expand Down
3 changes: 2 additions & 1 deletion compiler/pavexc/src/compiler/framework_rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ pub(crate) fn resolve_framework_free_function(
.unwrap_or_else(|e| panic!("Unknown free function path {}: {e:?}", segments.join("::")));

let item = krate.get_item_by_local_type_id(&global_id.rustdoc_item_id);
let free_fn = rustdoc_resolver::resolve_free_function(&item, krate, krate_collection)
let free_fn = rustdoc_resolver::resolve_free_function(&item, krate, krate_collection, TypeAliasResolution::ResolveThrough)
.expect("Failed to resolve free function");
Callable::FreeFunction(free_fn)
}
Expand Down Expand Up @@ -250,6 +250,7 @@ pub(crate) fn resolve_framework_inherent_method(
&item,
krate,
krate_collection,
TypeAliasResolution::ResolveThrough,
)
.expect("Failed to resolve inherent method");
return callable;
Expand Down
5 changes: 3 additions & 2 deletions rustdoc/rustdoc_resolver/src/free_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub fn resolve_free_function<I: CrateIndexer>(
item: &Item,
krate: &Crate,
krate_collection: &CrateCollection<I>,
alias_resolution: TypeAliasResolution,
) -> Result<FreeFunction, CallableResolutionError> {
let ItemEnum::Function(inner) = &item.inner else {
unreachable!("Expected a function item");
Expand All @@ -35,7 +36,7 @@ pub fn resolve_free_function<I: CrateIndexer>(
&krate.core.package_id,
krate_collection,
&Default::default(),
TypeAliasResolution::ResolveThrough,
alias_resolution,
) {
Ok(t) => {
inputs.push(CallableInput {
Expand Down Expand Up @@ -63,7 +64,7 @@ pub fn resolve_free_function<I: CrateIndexer>(
&krate.core.package_id,
krate_collection,
&Default::default(),
TypeAliasResolution::ResolveThrough,
alias_resolution,
) {
Ok(t) => Some(t),
Err(e) => {
Expand Down
9 changes: 5 additions & 4 deletions rustdoc/rustdoc_resolver/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub fn rustdoc_method2callable<I: CrateIndexer>(
method_item: &Item,
krate: &Crate,
krate_collection: &CrateCollection<I>,
alias_resolution: TypeAliasResolution,
) -> Result<Callable, CallableResolutionError> {
let impl_item = krate.get_item_by_local_type_id(&impl_id);
let ItemEnum::Impl(impl_item) = &impl_item.inner else {
Expand All @@ -50,7 +51,7 @@ pub fn rustdoc_method2callable<I: CrateIndexer>(
&krate.core.package_id,
krate_collection,
&generic_bindings,
TypeAliasResolution::ResolveThrough,
alias_resolution,
) {
Ok(t) => t,
Err(e) => {
Expand Down Expand Up @@ -111,7 +112,7 @@ pub fn rustdoc_method2callable<I: CrateIndexer>(
&krate.core.package_id,
krate_collection,
&generic_bindings,
TypeAliasResolution::ResolveThrough,
alias_resolution,
) else {
todo!()
};
Expand Down Expand Up @@ -180,7 +181,7 @@ pub fn rustdoc_method2callable<I: CrateIndexer>(
&krate.core.package_id,
krate_collection,
&generic_bindings,
TypeAliasResolution::ResolveThrough,
alias_resolution,
) {
Ok(t) => {
inputs.push(CallableInput {
Expand Down Expand Up @@ -208,7 +209,7 @@ pub fn rustdoc_method2callable<I: CrateIndexer>(
&krate.core.package_id,
krate_collection,
&generic_bindings,
TypeAliasResolution::ResolveThrough,
alias_resolution,
) {
Ok(t) => Some(t),
Err(e) => {
Expand Down
1 change: 1 addition & 0 deletions rustdoc/rustdoc_resolver/src/resolve_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub enum TypeAliasResolution {
Preserve,
}


/// Convert a `rustdoc_types::Type` into a `rustdoc_ir::Type`, recursively resolving
/// through type aliases and substituting generic bindings.
pub fn resolve_type<I: CrateIndexer>(
Expand Down
Loading