Skip to content

Commit b9a764b

Browse files
refactor: Move CallablePath closer to rustdoc_ir by using PathType directly
1 parent a9e64d7 commit b9a764b

File tree

18 files changed

+337
-248
lines changed

18 files changed

+337
-248
lines changed

compiler/pavexc/src/compiler/analyses/user_components/annotations/coordinates.rs

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ use crate::{
66
use pavexc_attr_parser::AnnotationProperties;
77

88
use super::{
9-
AuxiliaryData, ConfigType, FQPath, FQPathSegment, ImplInfo, annotated_item2type,
10-
cannot_resolve_callable_path, invalid_config_type, rustdoc_free_fn2callable,
11-
rustdoc_method2callable, validate_route_path,
9+
AuxiliaryData, ConfigType, ImplInfo, annotated_item2type, cannot_resolve_callable_path,
10+
invalid_config_type, rustdoc_free_fn2callable, rustdoc_method2callable, validate_route_path,
1211
};
1312
use crate::compiler::analyses::user_components::{UserComponent, UserComponentId};
1413
use crate::compiler::component::{DefaultStrategy, PrebuiltType};
@@ -113,17 +112,13 @@ pub(crate) fn resolve_annotation_coordinates(
113112
aux.config_id2type.insert(component_id, config);
114113
}
115114
Err(e) => {
116-
let path = FQPath {
117-
segments: krate.import_index.items[&item.id]
118-
.canonical_path()
119-
.iter()
120-
.cloned()
121-
.map(FQPathSegment::new)
122-
.collect(),
123-
qualified_self: None,
124-
package_id: krate.core.package_id.clone(),
125-
};
126-
invalid_config_type(e, &path, component_id, aux, diagnostics)
115+
let path_display = krate.import_index.items[&item.id]
116+
.canonical_path()
117+
.iter()
118+
.cloned()
119+
.collect::<Vec<_>>()
120+
.join("::");
121+
invalid_config_type(e, &path_display, component_id, aux, diagnostics)
127122
}
128123
};
129124
}
@@ -159,17 +154,13 @@ pub(crate) fn resolve_annotation_coordinates(
159154
prebuilt_type_db.get_or_intern(prebuilt, component_id);
160155
}
161156
Err(e) => {
162-
let path = FQPath {
163-
segments: krate.import_index.items[&item.id]
164-
.canonical_path()
165-
.iter()
166-
.cloned()
167-
.map(FQPathSegment::new)
168-
.collect(),
169-
qualified_self: None,
170-
package_id: krate.core.package_id.clone(),
171-
};
172-
invalid_prebuilt_type(e, &path, component_id, aux, diagnostics)
157+
let path_display = krate.import_index.items[&item.id]
158+
.canonical_path()
159+
.iter()
160+
.cloned()
161+
.collect::<Vec<_>>()
162+
.join("::");
163+
invalid_prebuilt_type(e, &path_display, component_id, aux, diagnostics)
173164
}
174165
};
175166
}

compiler/pavexc/src/compiler/analyses/user_components/annotations/diagnostic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use guppy::graph::PackageGraph;
1414
use pavex_cli_diagnostic::CompilerDiagnostic;
1515
use rustdoc_types::Item;
1616

17-
use super::{AuxiliaryData, CallableResolutionError, FQPath};
17+
use super::{AuxiliaryData, CallableResolutionError};
1818

1919
pub(super) fn const_generics_are_not_supported(
2020
e: UnsupportedConstGeneric,
@@ -149,7 +149,7 @@ pub(super) fn not_a_module(
149149

150150
pub(super) fn invalid_prebuilt_type(
151151
e: PrebuiltTypeValidationError,
152-
resolved_path: &FQPath,
152+
resolved_path: &str,
153153
id: UserComponentId,
154154
db: &AuxiliaryData,
155155
diagnostics: &crate::diagnostic::DiagnosticSink,
@@ -238,7 +238,7 @@ pub(super) fn invalid_prebuilt_type(
238238

239239
pub(super) fn invalid_config_type(
240240
e: ConfigTypeValidationError,
241-
resolved_path: &FQPath,
241+
resolved_path: &str,
242242
id: UserComponentId,
243243
db: &AuxiliaryData,
244244
diagnostics: &crate::diagnostic::DiagnosticSink,

0 commit comments

Comments
 (0)