summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-02-04Rollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514Jonas Schievink-2/+19
rustdoc: Fix visibility of trait and impl items Fixes #81274. r? `@jyn514`
2021-01-20Add FIXME for visibility of a moduleCamelid-0/+3
2021-01-20Add note on panic behaviorCamelid-0/+2
2021-01-20Small refactorCamelid-4/+3
2021-01-20Remove FIXMECamelid-1/+0
Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2021-01-20Update `find_nearest_parent_module`Camelid-12/+15
2021-01-20Extract local variableCamelid-8/+4
2021-01-20Simplify loop and remove old debugging codeCamelid-14/+5
Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2021-01-20Add missing code to `find_closest_parent_module`Camelid-25/+25
2021-01-20Prefer `pub(crate)` over no modifierCamelid-3/+3
2021-01-20Handle `pub(super)`Camelid-1/+9
2021-01-20Fix bugs; fix and add testsCamelid-70/+80
2021-01-20rustdoc: Render visibilities succinctlyCamelid-22/+38
2020-12-25Auto merge of #80226 - ThePuzzlemaker:issue-80004-fix, r=jyn514,petrochenkovbors-12/+24
Highlight edition-specific keywords correctly in code blocks, accounting for code block edition modifiers Previously, edition-specific keywords (such as `async` and `await`) were not highlighted in code blocks, regardless of what edition was set. With this PR, this issue is fixed. Now, the following behavior happens: - When a code block is explicitly set to edition X, keywords from edition X are highlighted - When a code block is explicitly set to a version that does not contain those keywords from edition X (e.g. edition Y), keywords from edition X are **not** highlighted - When a code block has no explicit edition, keywords from the edition passed via `--edition` to rustdoc are highlighted For example, a project set with `edition = "2015"` in its `Cargo.toml` would not highlight `async`/`await` unless the code block was set to `edition2018`. Additionally, a project set with `edition = "2018"` in its `Cargo.toml` *would* highlight `async`/`await` unless the code block was set to a version that did not contain those keywords (e.g. `edition2015`). This PR fixes #80004. r? `@jyn514`
2020-12-25Auto merge of #80364 - Dylan-DPC:rollup-0y96okz, r=Dylan-DPCbors-20/+30
Rollup of 11 pull requests Successful merges: - #79213 (Stabilize `core::slice::fill`) - #79999 (Refactored verbose print into a function) - #80160 (Implemented a compiler diagnostic for move async mistake) - #80274 (Rename rustc_middle::lint::LintSource) - #80280 (Add installation commands to `x` tool README) - #80319 (Fix elided lifetimes shown as `'_` on async functions) - #80327 (Updated the match with the matches macro) - #80330 (Fix typo in simplify_try.rs) - #80340 (Don't unnecessarily override attrs for Module) - #80342 (Fix typo) - #80352 (BTreeMap: make test cases more explicit on failure) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-12-25Rollup merge of #80340 - jyn514:less-modules-attrs, r=GuillaumeGomezDylan DPC-14/+3
Don't unnecessarily override attrs for Module They were never changed from the default, which you can get with `tcx.get_attrs()`.
2020-12-25Rollup merge of #80319 - jyn514:async-lifetimes, r=tmandryDylan DPC-2/+23
Fix elided lifetimes shown as `'_` on async functions Closes https://github.com/rust-lang/rust/issues/63037. r? `@tmandry` on the implementation, `@Darksonn` on the test cases.
2020-12-25Rollup merge of #80274 - pierwill:lintlevelsource, r=petrochenkovDylan DPC-4/+4
Rename rustc_middle::lint::LintSource Rename [`rustc_middle::lint::LintSource`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html) to `rustc_middle::lint::LintLevelSource`. This enum represents the source of a *lint level*, not a lint. This should improve code readability. Update: Also documents `rustc_middle::lint::LevelSource` to clarify.
2020-12-25Auto merge of #79762 - Swatinem:remap-doctest-coverage, r=Swatinembors-44/+103
Remap instrument-coverage line numbers in doctests This uses the `SourceMap::doctest_offset_line` method to re-map line numbers from doctests. Remapping columns is not yet done, and rustdoc still does not output the correct filename when running doctests in a workspace. Part of #79417 although I dont consider that fixed until both filenames and columns are mapped correctly. r? `@richkadel` I might jump on zulip the comming days. Still need to figure out how to properly write tests for this, and deal with other doctest issues in the meantime.
2020-12-24rustdoc: Highlight edition-specific keywords correctly in code blocks, ↵ThePuzzlemaker-12/+24
accounting for code block edition modifiers This is a squash of these commits: - Highlight edition-specific keywords correctly in code blocks, accounting for code block edition modifiers - Fix unit tests - Revert changes to rustc_span::symbol to prepare for merge of #80272 - Use new Symbol::is_reserved API from #80272 - Remove unused import added by accident when merging
2020-12-24Auto merge of #79742 - GuillaumeGomez:move-tooltips-messages-out-of-html, ↵bors-65/+47
r=Nemo157 Move tooltips messages out of html First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have `ignore`, `compile_fail`, `should_panic` and `edition`. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up. So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (`::before` and `::after`). The message is now inside `::after` and we use the `::before` to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice. So now, back to the `edition` change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip called `edition` which contains this information. Then, the `::after` uses it inside its `content` (you can get the content of an element's attribute by using `attr` and concat different strings by simply having them after the other). Don't hesitate if a part of my explanations isn't clear. r? `@jyn514`
2020-12-24Auto merge of #80295 - GuillaumeGomez:beautify-rework, r=petrochenkovbors-1/+1
Rework beautify_doc_string so that it returns a Symbol instead of a String This commit comes from https://github.com/rust-lang/rust/pull/80261, the goal here is to inspect the impact on performance of this change on its own. The idea of rewriting `beautify_doc_string` is to not go through `String` if we don't need to update the doc comment to be able to keep the original `Symbol` and also to have better performance. r? `@jyn514`
2020-12-23Don't unnecessarily override attrs for ModuleJoshua Nelson-14/+3
They were never changed from the default, which you can get with `tcx.get_attrs()`.
2020-12-23Update HTML DOM attribute "edition" to "data-edition"Guillaume Gomez-2/+2
2020-12-23Add more testsJoshua Nelson-1/+1
2020-12-23Auto merge of #80099 - jyn514:visibility-on-demand, r=GuillaumeGomezbors-60/+70
Remove `DefPath` from `Visibility` and calculate it on demand Depends on #80090 and should not be merged before. Helps with https://github.com/rust-lang/rust/issues/79103 and https://github.com/rust-lang/rust/issues/76382. cc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284 - `@nnethercote` I figured it out! It was simpler than I expected :) This brings the size of `clean::Visibility` down from 40 bytes to 8. Note that this does *not* remove `clean::Visibility`, even though it's now basically the same as `ty::Visibility`, because the `Invsible` variant means something different from `Inherited` and I thought it would be be confusing to merge the two. See the new comments on `impl Clean for ty::Visibility` for details.
2020-12-23Auto merge of #80095 - jyn514:stability-on-demand, r=GuillaumeGomezbors-80/+75
[rustdoc] Calculate stability, const_stability, and deprecation on-demand Previously, they would always be calculated ahead of time, which bloated the size of `clean::Item`. Builds on https://github.com/rust-lang/rust/pull/80090 and should not be merged before. Helps with https://github.com/rust-lang/rust/issues/79103 and https://github.com/rust-lang/rust/issues/76382. cc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284 This brings `Item` down to 568 bytes, down from 616.
2020-12-22Fix elided lifetimes shown as `'_` on async functionsJoshua Nelson-2/+23
2020-12-22Auto merge of #80071 - jyn514:timings, r=Mark-Simulacrumbors-19/+26
Add more timing info to rustdoc This helped me confirm in https://github.com/rust-lang/rust/issues/79103#issuecomment-745737864 that get_blanket_impls is indeed what's taking all the time on stm32. r? `@Mark-Simulacrum`
2020-12-22Rework beautify_doc_string so that it returns a Symbol instead of a StringGuillaume Gomez-1/+1
2020-12-21Rename rustc_middle::lint::LintSourcepierwill-4/+4
Rename rustc_middle::lint::LintSource to rustc_middle::lint::LintLevelSource.
2020-12-21Auto merge of #80206 - poliorcetics:rustdoc-default-langstring, ↵bors-39/+29
r=GuillaumeGomez,jyn514 impl Default for LangString, replacing all_false by default Fix #80015 `@rustbot` label C-cleanup T-rustdoc A-markdown-parsing
2020-12-21Rollup merge of #80244 - jyn514:spans, r=bugadaniDylan DPC-103/+94
Cleanup markdown span handling 1. Get rid of `locate()` in markdown handling This function was unfortunate for several reasons: - It used `unsafe` because it wanted to tell whether a string came from the same *allocation* as another, not just whether it was a textual match. - It recalculated spans even though they were already available from pulldown - It sometimes *failed* to calculate the span, which meant it was always possible for the span to be `None`, even though in practice that should never happen. This has several cleanups: - Make the span required - Pass through the span from pulldown in the `HeadingLinks` and `Footnotes` iterators - Only add iterator bounds on the `impl Iterator`, not on `new` and the struct itself. 2. Remove unnecessary scope in `markdown_links` I recommend reading a single commit at a time. cc ``@bugadani`` - this will conflict with https://github.com/rust-lang/rust/pull/77859, I'll try to make sure that gets merged first.
2020-12-20Fix incorrect logic when merging matchesJoshua Nelson-2/+3
2020-12-20Remove unnecessary scopeJoshua Nelson-0/+2
2020-12-20Get rid of `locate()` in markdown handlingJoshua Nelson-102/+90
This function was unfortunate for several reasons: - It used `unsafe` because it wanted to tell whether a string came from the same *allocation* as another, not just whether it was a textual match. - It recalculated spans even though they were already available from pulldown - It sometimes *failed* to calculate the span, which meant it was always possible for the span to be `None`, even though in practice that should never happen. This commit has several cleanups: - Make the span required - Pass through the span from pulldown in the `HeadingLinks` and `Footnotes` iterators - Only add iterator bounds on the `impl Iterator`, not on `new` and the struct itself.
2020-12-20add an attribute to inner doctest fnArpad Borsos-6/+7
2020-12-20Auto merge of #80163 - jackh726:binder-refactor-part-3, r=lcnrbors-2/+6
Make BoundRegion have a kind of BoungRegionKind Split from #76814 Also includes making `replace_escaping_bound_vars` only return `T` Going to r? `@lcnr` Feel free to reassign
2020-12-20impl Default for LangString, replacing all_false by defaultAlexis Bourget-39/+29
2020-12-19Remap instrument-coverage line numbers in doctestsArpad Borsos-44/+102
This uses the `SourceMap::doctest_offset_line` method to re-map line numbers from doctests. Remapping columns is not yet done. Part of issue #79417.
2020-12-19Auto merge of #80106 - jackh726:binder-refactor-part-2, r=lcnrbors-9/+9
A lot of refactoring to remove more `Binder::bind`s Split out from #76814
2020-12-19More rebindsJack Huey-9/+9
2020-12-18Auto merge of #80154 - GuillaumeGomez:str-to-symbol, r=jyn514bors-8/+11
Continue String to Symbol conversion in rustdoc (2) Follow-up of #80119. This is the last one (and I actually expected more conversions but seems like it was the last one remaining...). r? `@jyn514`
2020-12-18Make BoundRegion have a kind of BoungRegionKindJack Huey-2/+6
2020-12-18Remove `DefPath` from `Visibility` and calculate it on demandJoshua Nelson-61/+75
2020-12-18Calculate stability, const_stability, and deprecation on-demandJoshua Nelson-80/+75
Previously, they would always be calculated ahead of time, which bloated the size of `clean::Item`.
2020-12-18Continue String to Symbol conversion in rustdocGuillaume Gomez-8/+11
2020-12-18Auto merge of #80090 - jyn514:tcx-in-render, r=GuillaumeGomezbors-179/+226
Pass a `TyCtxt` through to `FormatRender` This is the next step after https://github.com/rust-lang/rust/pull/79957 for https://github.com/rust-lang/rust/issues/76382. Eventually I plan to use this to remove `stability`, `const_stability`, and `deprecation` from `Item`, but that needs more extensive changes (in particular, https://github.com/rust-lang/rust/pull/75355 or something like it). This has no actual changes to behavior, it's just moving types around. ccc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284
2020-12-18Auto merge of #80119 - GuillaumeGomez:str-to-symbol, r=jyn514bors-69/+74
Continue String to Symbol conversion in rustdoc Follow-up of https://github.com/rust-lang/rust/pull/80091. This PR is already big enough so I'll stop here before the next one. r? `@jyn514`
2020-12-17Continue String to Symbol conversion in rustdocGuillaume Gomez-69/+74