Rollup merge of #91197 - camelid:rename-resolvedpath, r=GuillaumeGomez,jyn514
rustdoc: Rename `Type::ResolvedPath` to `Type::Path` and don't re-export it The new name is shorter, simpler, and consistent with `hir::Ty`. It can't be re-exported since the name would conflict with the `clean::Path` struct. But usually enum variants are referred to using their qualified names in Rust anyway (and parts of rustdoc already do that with `clean::Type`), so this is also more consistent with the language. r? `@GuillaumeGomez` cc `@jyn514`
This commit is contained in:
commit
fcbbdaf209
9 changed files with 43 additions and 43 deletions
|
|
@ -607,8 +607,7 @@ crate fn href_relative_parts<'a>(fqp: &'a [String], relative_to_fqp: &'a [String
|
|||
}
|
||||
}
|
||||
|
||||
/// Used when rendering a `ResolvedPath` structure. This invokes the `path`
|
||||
/// rendering function with the necessary arguments for linking to a local path.
|
||||
/// Used to render a [`clean::Path`].
|
||||
fn resolved_path<'cx>(
|
||||
w: &mut fmt::Formatter<'_>,
|
||||
did: DefId,
|
||||
|
|
@ -762,7 +761,7 @@ fn fmt_type<'cx>(
|
|||
|
||||
match *t {
|
||||
clean::Generic(name) => write!(f, "{}", name),
|
||||
clean::ResolvedPath { ref path } => {
|
||||
clean::Type::Path { ref path } => {
|
||||
// Paths like `T::Output` and `Self::Output` should be rendered with all segments.
|
||||
let did = path.def_id();
|
||||
resolved_path(f, did, path, path.is_assoc_ty(), use_absolute, cx)
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ fn get_index_type(clean_type: &clean::Type, generics: Vec<TypeWithKind>) -> Rend
|
|||
|
||||
fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option<Symbol> {
|
||||
match *clean_type {
|
||||
clean::ResolvedPath { ref path, .. } => {
|
||||
clean::Type::Path { ref path, .. } => {
|
||||
let path_segment = path.segments.last().unwrap();
|
||||
Some(path_segment.name)
|
||||
}
|
||||
|
|
@ -371,7 +371,7 @@ crate fn get_real_types<'tcx>(
|
|||
let mut ty_generics = Vec::new();
|
||||
for bound in bound.get_bounds().unwrap_or(&[]) {
|
||||
if let Some(path) = bound.get_trait_path() {
|
||||
let ty = Type::ResolvedPath { path };
|
||||
let ty = Type::Path { path };
|
||||
get_real_types(generics, &ty, tcx, recurse + 1, &mut ty_generics, cache);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1227,7 +1227,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
|
|||
| SelfTy::SelfExplicit(clean::BorrowedRef { mutability, .. }) => {
|
||||
(mutability == Mutability::Mut, false, false)
|
||||
}
|
||||
SelfTy::SelfExplicit(clean::ResolvedPath { path }) => {
|
||||
SelfTy::SelfExplicit(clean::Type::Path { path }) => {
|
||||
(false, Some(path.def_id()) == tcx.lang_items().owned_box(), false)
|
||||
}
|
||||
SelfTy::SelfValue => (false, false, true),
|
||||
|
|
@ -2520,7 +2520,7 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
|
|||
}
|
||||
|
||||
match ty {
|
||||
clean::Type::ResolvedPath { path } => process_path(path.def_id()),
|
||||
clean::Type::Path { path } => process_path(path.def_id()),
|
||||
clean::Type::Tuple(tys) => {
|
||||
work.extend(tys.into_iter());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -727,8 +727,8 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
|||
let mut implementor_dups: FxHashMap<Symbol, (DefId, bool)> = FxHashMap::default();
|
||||
for implementor in implementors {
|
||||
match implementor.inner_impl().for_ {
|
||||
clean::ResolvedPath { ref path }
|
||||
| clean::BorrowedRef { type_: box clean::ResolvedPath { ref path }, .. }
|
||||
clean::Type::Path { ref path }
|
||||
| clean::BorrowedRef { type_: box clean::Type::Path { ref path }, .. }
|
||||
if !path.is_assoc_ty() =>
|
||||
{
|
||||
let did = path.def_id();
|
||||
|
|
@ -1453,8 +1453,8 @@ fn render_implementor(
|
|||
// If there's already another implementor that has the same abridged name, use the
|
||||
// full path, for example in `std::iter::ExactSizeIterator`
|
||||
let use_absolute = match implementor.inner_impl().for_ {
|
||||
clean::ResolvedPath { ref path, .. }
|
||||
| clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, .. }, .. }
|
||||
clean::Type::Path { ref path, .. }
|
||||
| clean::BorrowedRef { type_: box clean::Type::Path { ref path, .. }, .. }
|
||||
if !path.is_assoc_ty() =>
|
||||
{
|
||||
implementor_dups[&path.last()].1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue