summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2020-07-13Rollup merge of #74147 - dennis-hamester:fix/issue-74134, r=jyn514Manish Goregaokar-0/+1
rustdoc: Allow linking from private items to private types Fixes #74134 After PR #72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
2020-07-11rustdoc: insert newlines between attributesAndy Russell-8/+13
2020-07-10Rollup merge of #74127 - tamird:allowlist, r=oli-obkManish Goregaokar-15/+15
Avoid "whitelist" Other terms are more inclusive and precise.
2020-07-10Avoid "whitelist"Tamir Duberstein-15/+15
Other terms are more inclusive and precise.
2020-07-10Change some function names.Nicholas Nethercote-2/+5
A couple of these are quite long, but they do a much better job of explaining what they do, which was non-obvious before.
2020-07-10Eliminate `rust_input`.Nicholas Nethercote-31/+23
It has a single call site and having it as a separate (higher-order!) function makes the code harder to read.
2020-07-09Rollup merge of #74107 - nbdd0121:rustdoc, r=GuillaumeGomezManish Goregaokar-1/+7
Hide `&mut self` methods from Deref in sidebar if there are no `DerefMut` impl for the type. This partially addresses #74083.
2020-07-09Rollup merge of #74079 - nnethercote:session-globals, r=nikomatsakisManish Goregaokar-10/+9
Eliminate confusing "globals" terminology. There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs` r? @Aaron1011
2020-07-09Rollup merge of #74077 - sethp:docs/fix-intra-doc-primitive-link, r=jyn514Manish Goregaokar-4/+6
Use relative path for local links to primitives Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from #73804.
2020-07-09Allow for parentheses after macro intra-doc-linksManish Goregaokar-0/+3
2020-07-09Auto merge of #74131 - ollie27:rustdoc_invalid_codeblock_attributes_name, ↵bors-4/+4
r=GuillaumeGomez rustdoc: Rename invalid_codeblock_attribute lint to be plural Lint names should be plural as per the lint naming conventions: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints r? @GuillaumeGomez
2020-07-09Eliminate confusing "globals" terminology.Nicholas Nethercote-10/+9
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
2020-07-08rustdoc: Allow linking from private items to private typesDennis Hamester-0/+1
Fixes #74134 After PR #72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
2020-07-07Revert "Add guard to check for local `core` crate"Seth Pellegrino-6/+4
This reverts commit ee3a0f867e938f469cbbb422a76ed5662be2ecc7.
2020-07-07rustdoc: Rename invalid_codeblock_attribute lint to be pluralOliver Middleton-4/+4
2020-07-07Auto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearthbors-113/+53
Rollup of 14 pull requests Successful merges: - #70563 ([rustdoc] Page hash handling) - #73856 (Edit librustc_lexer top-level docs) - #73870 (typeck: adding type information to projection) - #73953 (Audit hidden/short code suggestions) - #73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]) - #73969 (mir: mark mir construction temporaries as internal) - #73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)) - #74067 (rustdoc: Restore underline text decoration on hover for FQN in header) - #74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.) - #74078 (Always resolve type@primitive as a primitive, not a module) - #74089 (Add rust-analyzer to the build manifest) - #74090 (Remove unused RUSTC_DEBUG_ASSERTIONS) - #74102 (Fix const prop ICE) - #74112 (Expand abbreviation in core::ffi description) Failed merges: r? @ghost
2020-07-06Rollup merge of #74078 - jyn514:lut, r=ManishearthManish Goregaokar-5/+28
Always resolve type@primitive as a primitive, not a module Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with https://github.com/rust-lang/rust/issues/58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time. Closes https://github.com/rust-lang/rust/issues/74063 r? @Manishearth
2020-07-06Rollup merge of #74067 - rye:rustdoc-fqn-hover-underline, r=GuillaumeGomezManish Goregaokar-0/+3
rustdoc: Restore underline text decoration on hover for FQN in header This causes the components of FQN's (e.g. `std`, `net`, and `Ipv4Addr` of the FQN `std::net::Ipv4Addr`) to behave similarly to other links in the contents of rustdoc-styled pages. When the user hovers over them, more clearly indicating that they can be used for navigation. I (and I hope others at least in part) have found the prior design to be somewhat confusing, as it is not clear (upon hovering) that the various parts of the FQN are actually links that the user can navigate to. <details><summary>📸 Before, mouse hovered over "net" in the FQN</summary> <img alt="A rustdoc page with the mouse hovered over the fully-qualified name in the page header, producing no visual change" src="https://user-images.githubusercontent.com/1566689/86538363-4c827000-bebb-11ea-8291-5ea6b85d7e19.png" /> </details> <details><summary>📸 After, mouse hovered over "net" in the FQN</summary> <img alt="A rustdoc page with the mouse hovered over the fully-qualified name in the page header, now with an underline showing up under the word hovered over by the mouse" src="https://user-images.githubusercontent.com/1566689/86538471-d3374d00-bebb-11ea-9bb3-7aa2d7a4800b.png" /> </details>
2020-07-06Rollup merge of #70563 - GuillaumeGomez:page-hash-handling, r=ollie27,kinnisonManish Goregaokar-108/+22
[rustdoc] Page hash handling Fixes https://github.com/rust-lang/rust/issues/70476 A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3 After the change, it actually goes to the target element (and change the page hash to something more clear for the users). r? @kinnison cc @ollie27
2020-07-06Hide `&mut self` methods from Deref in sidebarGary Guo-1/+7
If there are no `DerefMut` impl for the type.
2020-07-06Add guard to check for local `core` crateSeth Pellegrino-4/+6
2020-07-05Always resolve type@primitive as a primitive, not a moduleJoshua Nelson-5/+28
Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with https://github.com/rust-lang/rust/issues/58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time.
2020-07-05Use relative path for local links to primitives in libcoreSeth Pellegrino-4/+6
Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from #73804.
2020-07-05rustdoc: Restore underline text decoration on hover for FQN in headerKristofer Rye-0/+3
This causes the components of FQN's to behave similarly to other links in the contents of rustdoc-styled pages. I (and I hope others at least in part) have found the prior design to be somewhat confusing, as it is not clear (upon hovering) that the various parts of the FQN are actually links that the user can navigate to. In short, this patch makes links in the FQN have an underline when the user hovers over them, more clearly indicating that they can be used for navigation. Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
2020-07-05Shrink ParamEnv to 16 bytesMark Rousskov-2/+2
2020-07-02Remove render-redirect-pages option in rustdocGuillaume Gomez-60/+0
2020-07-02Fix linksGuillaume Gomez-1/+1
2020-07-02Simplify DOM by removing IDs for code tagsGuillaume Gomez-52/+16
2020-07-02Expand sub code blocks block content when hidden when the page hash refers to itGuillaume Gomez-0/+8
2020-07-02Improve page hash handlingGuillaume Gomez-5/+7
2020-07-02No need to call getPageId a second timeGuillaume Gomez-1/+1
2020-06-30change `skip_binder` to use T by valueBastian Kauschke-4/+4
2020-06-27Rollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=estebankManish Goregaokar-2/+9
errors: use `-Z terminal-width` in JSON emitter This PR makes the JSON emitter use `-Z terminal-width` in the "rendered" field of the JSON output. r? @estebank
2020-06-26Rollup merge of #72771 - jyn514:rustdoc, r=ManishearthManish Goregaokar-23/+62
Warn if linking to a private item Closes https://github.com/rust-lang/rust/issues/72769 r? @GuillaumeGomez
2020-06-26errors: use `-Z terminal-width` in JSON emitterDavid Wood-2/+9
This commit makes the JSON emitter use `-Z terminal-width` in the "rendered" field of the JSON output. Signed-off-by: David Wood <david@davidtw.co>
2020-06-26Auto merge of #73513 - oli-obk:const_binop_overflow, r=estebankbors-2/+2
Show the values and computation that would overflow a const evaluation or propagation Fixes #71134 In contrast to the example in the issue it doesn't use individual spans for each operand. The effort required to implement that is quite high compared to the little (if at all) benefit it would bring to diagnostics. cc @shepmaster The way this is implemented it is also fairly easy to do the same for overflow panics at runtime, but that should be done in a separate PR since it may have runtime performance implications.
2020-06-26Fix debug messagesJoshua Nelson-3/+2
2020-06-26Generate docs for links to private items when passed --document-privateJoshua Nelson-27/+42
- Pass around document_private a lot more - Add tests + Add tests for intra-doc links to private items + Add ignored tests for warnings in reference links
2020-06-26Warn if linking to a private itemJoshua Nelson-3/+28
2020-06-26Show the values and computation that would overflow a const evaluation or ↵Oliver Scherer-2/+2
propagation
2020-06-26Rollup merge of #73297 - ehuss:tool-warnings, r=Mark-SimulacrumManish Goregaokar-30/+39
Support configurable deny-warnings for all in-tree crates. This removes the hard-coded `deny(warnings)` on all in-tree tools, and allows it to be configured from the config. This is just a personal preference, as I find `deny(warnings)` frustrating during development or doing small tests. This also fixes some regressions in terms of warning handling. Warnings used to be dependent on `SourceType`, but in #64316 it was changed to be based on `Mode`. This means tools like rustdoc no longer used the same settings as the rest of the tree. It also made `SourceType` useless since the only thing it was used for was warnings. I think it would be better for everything in the tree to use the same settings. Fixes #64523
2020-06-26Rollup merge of #72967 - integer32llc:prevent-default-arrows, r=kinnisonManish Goregaokar-0/+2
Don't move cursor in search box when using arrows to navigate results ## What happens - Go to https://doc.rust-lang.org/stable/std/index.html - Press 's' to focus the search box - Type a query like 'test' - Press the down arrow one or more times to change which search result is highlighted - Press the up arrow once to go up one search result - Notice the cursor in the search box is now at the beginning of your query, such that if you now typed 'a' the search box would contain 'atest', when it would be expected that the cursor would have remained where it was and if you typed 'a' at this point it would result in 'testa' - Press the down arrow once to go down one search result - Now notice the cursor is at the end of your query again ## What I expected I expected that changing which search result was highlighted using the up and down arrows would have no effect on where the cursor was in the search box. ## The fix This PR prevents the default action of the up and down arrows when the custom keydown events are happening during a search.
2020-06-25Support configurable deny-warnings for all in-tree crates.Eric Huss-30/+39
2020-06-23Auto merge of #73669 - Manishearth:rollup-0n4u7vq, r=Manishearthbors-0/+28
Rollup of 11 pull requests Successful merges: - #72780 (Enforce doc alias check) - #72876 (Mention that BTreeMap::new() doesn't allocate) - #73244 (Check for assignments between non-conflicting generator saved locals) - #73488 (code coverage foundation for hash and num_counters) - #73523 (Fix -Z unpretty=everybody_loops) - #73587 (Move remaining `NodeId` APIs from `Definitions` to `Resolver`) - #73601 (Point at the call span when overflow occurs during monomorphization) - #73613 (The const propagator cannot trace references.) - #73614 (fix `intrinsics::needs_drop` docs) - #73630 (Provide context on E0308 involving fn items) - #73665 (rustc: Modernize wasm checks for atomics) Failed merges: r? @ghost
2020-06-23Rollup merge of #72780 - GuillaumeGomez:enforce-doc-alias-check, r=ollie27Manish Goregaokar-0/+28
Enforce doc alias check Part of #50146. r? @ollie27
2020-06-23Auto merge of #73644 - ollie27:rustdoc_alias_filter, r=GuillaumeGomezbors-6/+7
rustdoc: Fix doc aliases with crate filtering Fix a crash when searching for an alias contained in the currently selected filter crate. Also remove alias search results for crates that should be filtered out. The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected. Needs to be backported to beta to fix the `std` docs. Fixes #73620 r? @GuillaumeGomez
2020-06-23rustdoc: Fix doc aliases with crate filteringOliver Middleton-6/+7
Fix a crash when searching for an alias contained in the currently selected filter crate. Also remove alias search results for crates that should be filtered out. The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.
2020-06-20Remove uses of `Vec::remove_item`Lukas Kalbertodt-1/+0
2020-06-18Rollup merge of #73476 - JakobDegen:should_panic_rustdoc, r=GuillaumeGomezManish Goregaokar-1/+41
Added tooltip for should_panic code examples This change adds a tooltip to the documentation for `should_panic` examples. It currently displays identically to `compile_fail` examples, save for the changed text. It may be helpful to change the color that this displays in to make it visually more clear what is going on, but I'm unsure if additional colors wouldn't just be distracting. I brought this [up on internals](https://internals.rust-lang.org/t/indicating-that-an-example-is-should-panic-in-docs/12544) a few days ago, and there seemed to be a mild positive response to it.
2020-06-18Rollup merge of #73315 - GuillaumeGomez:clean-up-config-strs, r=kinnisonManish Goregaokar-9/+7
Clean up some weird command strings r? @kinnison