Add future-incompat lint for doc(primitive) by jyn514 · Pull Request #87050 · rust-lang/rust (original) (raw)

jyn514

@jyn514 jyn514 added T-rustdoc

Relevant to the rustdoc team, which will review and decide on the PR/issue.

S-experimental

Status: Ongoing experiment that does not require reviewing and won't be merged in its current state.

labels

Jul 11, 2021

@bors bors added the S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

label

Jul 11, 2021

@craterbot craterbot added S-waiting-on-crater

Status: Waiting on a crater run to be completed.

and removed S-experimental

Status: Ongoing experiment that does not require reviewing and won't be merged in its current state.

S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Jul 11, 2021

@jyn514 jyn514 marked this pull request as draft

July 11, 2021 06:19

@jyn514

@bors bors mentioned this pull request

Aug 16, 2021

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request

Aug 26, 2021

@GuillaumeGomez

…omez

Fix rustdoc handling of primitive items

This is a complicated PR and does a lot of things. I'm willing to split it up a little more if it would help reviewing, but it would be tricky and I'd rather not unless it's necessary.

What does this do?

Why are these changes interconnected?

`@@` -385,7 +381,7 `@@` fn resolve_primitive_associated_item(
                         ty::AssocKind::Const => "associatedconstant",
                         ty::AssocKind::Type => "associatedtype",
                     };
-                    let fragment = format!("{}#{}.{}", prim_ty.as_sym(), out, item_name);
+                    let fragment = format!("{}.{}", out, item_name);
                     (Res::Primitive(prim_ty), fragment, Some((kind.as_def_kind(), item.def_id)))
                 })
         })

Add primitive documentation to libcore

This works by reusing the same include!("primitive_docs.rs") file in both core and std, and then special-casing links in core to use relative links instead of intra-doc links. This doesn't use purely intra-doc links because some of the primitive docs links to items only in std; this doesn't use purely relative links because that introduces new broken links when the docs are re-exported (e.g. String's &str deref impl, or Vec's slice deref impl).

Fix inconsistent online/offline primitive docs

This does four things:

Breaking changes to doc(primitive)

"Breaking" is a little misleading here - these are changes in behavior, none of them will cause code to fail to compile.

Let me preface this by saying I think stabilizing doc(primitive) was a uniquely terrible idea. As far as I can tell, it was stabilized by oversight; it's been stable since 1.0. No one should have need to use it except the standard library, and a crater run shows that in fact no one is using it: rust-lang#87050 (comment). I hope to actually make doc(primitive) a no-op unless you opt-in with a nightly feature, which will keep crates compiling without forcing rustdoc into trying to keep somewhat arbitrary behavior guarantees; but for now, this just subtly changes some of the behavior if you use doc(primitive) in a dependency.

That said, here are the changes:

cc @rust-lang/rustdoc cc @rust-lang/libs for the addition to core (the commit you're interested in is rust-lang@36729b0)

@jyn514 jyn514 deleted the no-doc-primitive branch

September 9, 2021 02:05

bors added a commit to rust-lang-ci/rust that referenced this pull request

Sep 12, 2021

@bors

…ez,jyn514

Fix rustdoc handling of primitive items

This is a complicated PR and does a lot of things. I'm willing to split it up a little more if it would help reviewing, but it would be tricky and I'd rather not unless it's necessary.

What does this do?

Why are these changes interconnected?

`@@` -385,7 +381,7 `@@` fn resolve_primitive_associated_item(
                         ty::AssocKind::Const => "associatedconstant",
                         ty::AssocKind::Type => "associatedtype",
                     };
-                    let fragment = format!("{}#{}.{}", prim_ty.as_sym(), out, item_name);
+                    let fragment = format!("{}.{}", out, item_name);
                     (Res::Primitive(prim_ty), fragment, Some((kind.as_def_kind(), item.def_id)))
                 })
         })

Add primitive documentation to libcore

This works by reusing the same include!("primitive_docs.rs") file in both core and std, and then special-casing links in core to use relative links instead of intra-doc links. This doesn't use purely intra-doc links because some of the primitive docs links to items only in std; this doesn't use purely relative links because that introduces new broken links when the docs are re-exported (e.g. String's &str deref impl, or Vec's slice deref impl).

Note that this copies the whole file to core, to avoid anyone compiling core to have to set CARGO_PKG_NAME. See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Who.20should.20review.20changes.20to.20linkchecker.3F/near/249939598 for more context. It also adds a tidy check to make sure the two files are kept in sync.

Fix inconsistent online/offline primitive docs

This does four things:

Breaking changes to doc(primitive)

"Breaking" is a little misleading here - these are changes in behavior, none of them will cause code to fail to compile.

Let me preface this by saying I think stabilizing doc(primitive) was a uniquely terrible idea. As far as I can tell, it was stabilized by oversight; it's been stable since 1.0. No one should have need to use it except the standard library, and a crater run shows that in fact no one is using it: rust-lang#87050 (comment). I hope to actually make doc(primitive) a no-op unless you opt-in with a nightly feature, which will keep crates compiling without forcing rustdoc into trying to keep somewhat arbitrary behavior guarantees; but for now, this just subtly changes some of the behavior if you use doc(primitive) in a dependency.

That said, here are the changes:

cc @rust-lang/rustdoc cc @rust-lang/libs for the addition to core (the commit you're interested in is rust-lang@91346c8)

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request

Oct 22, 2021

@he32

Pkgsrc changes:

Upstream changes:

Version 1.56.0 (2021-10-21)

Language

Compiler

* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilised APIs

These APIs are now usable in const contexts:

Cargo

Compatibility notes

Internal changes

These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.

[rust#85769]: rust-lang/rust#85769 (comment) [rust#88490]: rust-lang/rust#88490 [rust#88269]: rust-lang/rust#88269 [rust#84176]: rust-lang/rust#84176 [rust#88399]: rust-lang/rust#88399 [rust#88227]: rust-lang/rust#88227 [rust#88200]: rust-lang/rust#88200 [rust#82776]: rust-lang/rust#82776 [rust#88077]: rust-lang/rust#88077 [rust#87728]: rust-lang/rust#87728 [rust#87050]: rust-lang/rust#87050 [rust#87619]: rust-lang/rust#87619 [rust#81825]: rust-lang/rust#81825 (comment) [rust#88019]: rust-lang/rust#88019 [rust#87666]: rust-lang/rust#87666

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request

Nov 20, 2021

@he32

Pkgsrc changes:

Upstream changes:

Version 1.56.1 (2021-11-01)

Version 1.56.0 (2021-10-21)

Language

Compiler

* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilised APIs

These APIs are now usable in const contexts:

Cargo

Compatibility notes

Internal changes

These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.

[rust#85769]: rust-lang/rust#85769 (comment) [rust#88490]: rust-lang/rust#88490 [rust#88269]: rust-lang/rust#88269 [rust#84176]: rust-lang/rust#84176 [rust#88399]: rust-lang/rust#88399 [rust#88227]: rust-lang/rust#88227 [rust#88200]: rust-lang/rust#88200 [rust#82776]: rust-lang/rust#82776 [rust#88077]: rust-lang/rust#88077 [rust#87728]: rust-lang/rust#87728 [rust#87050]: rust-lang/rust#87050 [rust#87619]: rust-lang/rust#87619 [rust#81825]: rust-lang/rust#81825 (comment) [rust#88019]: rust-lang/rust#88019 [rust#87666]: rust-lang/rust#87666

Version 1.55.0 (2021-09-09)

Language

Compiler

* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilised APIs

The following previously stable functions are now const.

Cargo

Rustdoc

Compatibility Notes