Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

Kivooeo
Copy link
Member

@Kivooeo Kivooeo commented Aug 2, 2025

This updates the documentation comment for Type::is_doc_subtype_of to more accurately describe its purpose as a subtyping check, rather than equality

fixes #138572

r? @tgross35

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 2, 2025
}

/// Check if two types are "the same" for documentation purposes.
/// Check if this type is a subtype of another type for documentation purposes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the current behavior of the function is closer to checking if another type is a subtype of this type (this was the argument flipping I mentioned in the original issue).

Maybe my intuition is backwards, so I would wait for a second opinion before renaming the function or anything, but at the very least it should at least have a not of how generics are handled.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that function is working exactly like self.is_doc_subtype_of(other) and example in doc comment showing it

let generic = Type::Generic(rustc_span::symbol::sym::Any);
let unit = Type::Primitive(PrimitiveType::Unit);
assert!(unit.is_doc_subtype_of(&generic, &cache));

it reads like "unit is subtype of generic" which is true, or am I missing something?

src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
@Kivooeo
Copy link
Member Author

Kivooeo commented Aug 4, 2025

Changed Placeholder with Infer in doc comment for now

@tgross35
Copy link
Contributor

tgross35 commented Aug 4, 2025

r? @tgross35

Why me? This is a rustdoc change

r? rustdoc

@rustbot rustbot assigned notriddle and unassigned tgross35 Aug 4, 2025
@Kivooeo
Copy link
Member Author

Kivooeo commented Aug 4, 2025

For some reasons I thought that you are in rustdoc and was like "I guess rustbot will assign Trevor anyway" 😅

@tgross35
Copy link
Contributor

tgross35 commented Aug 4, 2025

Even if I was, anybody on the relevant teams can do doc reviews :)

@notriddle
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 16, 2025

📌 Commit 970ac40 has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 16, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 16, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? `@tgross35`
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 16, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ``@tgross35``
bors added a commit that referenced this pull request Aug 16, 2025
Rollup of 11 pull requests

Successful merges:

 - #139345 (Extend `QueryStability` to handle `IntoIterator` implementations)
 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 17, 2025
Rollup of 11 pull requests

Successful merges:

 - #139345 (Extend `QueryStability` to handle `IntoIterator` implementations)
 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ```@tgross35```
bors added a commit that referenced this pull request Aug 17, 2025
Rollup of 10 pull requests

Successful merges:

 - #140794 (Add information about group a lint belongs to)
 - #144476 (rustdoc-search: search backend with partitioned suffix tree)
 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ````@tgross35````
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? `````@tgross35`````
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ``````@tgross35``````
bors added a commit that referenced this pull request Aug 17, 2025
Rollup of 10 pull requests

Successful merges:

 - #144476 (rustdoc-search: search backend with partitioned suffix tree)
 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)
 - #145489 (library: Migrate from `cfg_if` to `cfg_select`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 17, 2025
Rollup of 9 pull requests

Successful merges:

 - #144476 (rustdoc-search: search backend with partitioned suffix tree)
 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ```````@tgross35```````
bors added a commit that referenced this pull request Aug 17, 2025
Rollup of 10 pull requests

Successful merges:

 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ````````@tgross35````````
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? `````````@tgross35`````````
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ``````````@tgross35``````````
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 17, 2025
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ```````````@tgross35```````````
bors added a commit that referenced this pull request Aug 18, 2025
Rollup of 10 pull requests

Successful merges:

 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 18, 2025
Rollup of 10 pull requests

Successful merges:

 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 18, 2025
Rollup of 10 pull requests

Successful merges:

 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b94842d into rust-lang:master Aug 18, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 18, 2025
rust-timer added a commit that referenced this pull request Aug 18, 2025
Rollup merge of #144838 - Kivooeo:doc-subtype, r=notriddle

Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes #138572

r? ````````````@tgross35````````````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc::clean::types::Type::is_doc_subtype_of has outdated example, and arguments are flipped

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.