about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2022-08-02Remove Clean trait implementation for hir::LifetimeGuillaume Gomez-20/+20
2022-08-02Remove Clean trait implementation for ty::TraitRefGuillaume Gomez-14/+8
2022-08-02Rollup merge of #99779 - GuillaumeGomez:fix-item-info-pos-and-height, ↵Matthias Krüger-1/+9
r=notriddle Fix item info pos and height Fixes https://github.com/rust-lang/rust/issues/98266. Fixes https://github.com/rust-lang/rust/issues/98343. You can test it [here](https://rustdoc.crud.net/imperio/fix-item-info-pos-and-height/lib2/trait.Trait.html). Here is a screenshot of the result: ![Screenshot from 2022-07-26 21-55-53](https://user-images.githubusercontent.com/3050060/181100624-18b8b045-5c25-4c7c-9c44-97d55d29b675.png) r? `@jsha`
2022-08-01Remove DefId from AssocItemContainer.Camille GILLOT-11/+11
2022-08-01Remove visibility from AssocItem.Camille GILLOT-1/+1
2022-08-01Store associated item defaultness in impl_defaultness.Camille GILLOT-6/+6
2022-08-01Auto merge of #100024 - matthiaskrgr:rollup-36ab4wx, r=matthiaskrgrbors-39/+22
Rollup of 8 pull requests Successful merges: - #99340 (Fix ICE in Definitions::create_def) - #99629 (Improve `cannot move out of` error message) - #99864 (bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty) - #99911 (Remove some uses of `guess_head_span`) - #99976 (Make Rustdoc exit with correct error code when scraping examples from invalid files) - #100003 (Improve size assertions.) - #100012 (Avoid `Ty` to `String` conversions) - #100020 (better error when python is not found in x - issue #99648) Failed merges: - #99994 (Replace `guess_head_span` with `opt_span`) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-01Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqdMatthias Krüger-39/+16
Improve size assertions. - For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order. r? `@lqd`
2022-08-01Rollup merge of #99976 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-0/+6
Make Rustdoc exit with correct error code when scraping examples from invalid files This PR fixes a small issue with the new Rustdoc scrape-examples feature. If a file that is being scraped has a type error, then currently that error is printed out, but the rustdoc process exits as if it succeeded. This is a problem for Cargo, which needs to track whether scraping succeeded (see rust-lang/cargo#10343). This PR fixes the issue by checking whether an error is emitted, and aborting if so.
2022-08-01Auto merge of #99884 - nnethercote:lexer-improvements, r=matkladbors-1/+1
Lexer improvements Some cleanups and small speed improvements. r? `@matklad`
2022-08-01Make Rustdoc exit with correct error code when scrape examples from invalid ↵Will Crichton-0/+6
files
2022-08-01Improve size assertions.Nicholas Nethercote-39/+16
- For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order.
2022-08-01Shrink `Token`.Nicholas Nethercote-1/+1
From 72 bytes to 12 bytes (on x86-64). There are two parts to this: - Changing various source code offsets from 64-bit to 32-bit. This is not a problem because the rest of rustc also uses 32-bit source code offsets. This means `Token` is no longer `Copy` but this causes no problems. - Removing the `RawStrError` from `LiteralKind`. Raw string literal invalidity is now indicated by a `None` value within `RawStr`/`RawByteStr`, and the new `validate_raw_str` function can be used to re-lex an invalid raw string literal to get the `RawStrError`. There is one very small change in behaviour. Previously, if a raw string literal matched both the `InvalidStarter` and `TooManyHashes` cases, the latter would override the former. This has now changed, because `raw_double_quoted_string` now uses `?` and so returns immediately upon detecting the `InvalidStarter` case. I think this is a slight improvement to report the earlier-detected error, and it explains the change in the `test_too_many_hashes` test. The commit also removes a couple of comments that refer to #77629 and say that the size of these types don't affect performance. These comments are wrong, though the performance effect is small.
2022-07-31Remove Clean trait implementation for hir::TypeBindingKindGuillaume Gomez-8/+2
2022-07-31Remove Clean trait implementation for hir::TypeBindingGuillaume Gomez-7/+9
2022-07-31Remove Clean trait implementation for hir::PathGuillaume Gomez-8/+6
2022-07-30Rollup merge of #99950 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPCMatthias Krüger-38/+30
Remove more Clean trait implementations This time it even allowed to remove a function. Follow-up of https://github.com/rust-lang/rust/pull/99638. r? `@notriddle`
2022-07-30Rollup merge of #99873 - ↵Matthias Krüger-1/+9
notriddle:notriddle/invalid-html-tags-webcomponents, r=GuillaumeGomezp rustdoc: align invalid-html-tags lint with commonmark spec
2022-07-30Auto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPCbors-5/+3
Rollup of 5 pull requests Successful merges: - #99311 (change maybe_body_owned_by to take local def id) - #99862 (Improve type mismatch w/ function signatures) - #99895 (don't call type ascription "cast") - #99900 (remove some manual hash stable impls) - #99903 (Add diagnostic when using public instead of pub) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-30Update src/librustdoc/passes/html_tags.rsMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-07-30Remove Clean trait implementation for hir::VariantDataGuillaume Gomez-19/+13
2022-07-30Remove Clean trait implementation for ty::VariantDefGuillaume Gomez-20/+18
2022-07-30Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillotDylan DPC-5/+3
change maybe_body_owned_by to take local def id Issue https://github.com/rust-lang/rust/issues/96341 r? `@cjgillot`
2022-07-30Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkovbors-3/+3
Remove `TreeAndSpacing`. A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is not quite right. `Spacing` makes sense for `TokenTree::Token`, but does not make sense for `TokenTree::Delimited`, because a `TokenTree::Delimited` cannot be joined with another `TokenTree`. This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`, changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the `TreeAndSpacing` typedef. The commit removes these two impls: - `impl From<TokenTree> for TokenStream` - `impl From<TokenTree> for TreeAndSpacing` These were useful, but also resulted in code with many `.into()` calls that was hard to read, particularly for anyone not highly familiar with the relevant types. This commit makes some other changes to compensate: - `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`. - `TokenStream::token_{alone,joint}()` are added. - `TokenStream::delimited` is added. This results in things like this: ```rust TokenTree::token(token::Semi, stmt.span).into() ``` changing to this: ```rust TokenStream::token_alone(token::Semi, stmt.span) ``` This makes the type of the result, and its spacing, clearer. These changes also simplifies `Cursor` and `CursorRef`, because they no longer need to distinguish between `next` and `next_with_spacing`. r? `@petrochenkov`
2022-07-30Rollup merge of #99904 - GuillaumeGomez:cleanup-html-whitespace, r=notriddleYuki Okushi-19/+21
Cleanup html whitespace I realized while looking at the raw HTML that we generated some unwanted white space characters. This PR cleans up the one coming directly from rustdoc. I'll check from `pulldown-cmark` for the remaining ones. Some numbers now: the difference is small, it goes from `63009` to `62859`. But multiplied by the number of files, it becomes quite interesting overall. r? `@notriddle`
2022-07-29Change maybe_body_owned_by to take local def idMiguel Guarniz-5/+3
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29Statically ensure the size of ItemKindest31-0/+4
2022-07-29Box FunctionItem, TyMethodItem, MethodItem, ForeignFunctionItemest31-16/+16
This reduces ItemKind size from 160 bytes to 112 bytes
2022-07-29Box TypedefItem, ImplItem, AssocTypeItem variants of ItemKindest31-37/+37
This reduces ItemKind size from 224 bytes to 160 bytes.
2022-07-29Remove box_syntax feature gate from librustdocest31-1/+0
2022-07-29Remove box syntax from doctest.rsest31-2/+2
2022-07-29Remove box syntax from Box<rustdoc::clean::types::ItemKind> constructionest31-8/+8
The type has 240 bytes according to compiler internal rustdoc.
2022-07-29Remove unwanted extra white space characters from HTMLGuillaume Gomez-19/+21
2022-07-29Rollup merge of #99850 - GuillaumeGomez:clean-more-items, r=notriddleYuki Okushi-32/+28
rustdoc: Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? `@notriddle`
2022-07-29Remove `TreeAndSpacing`.Nicholas Nethercote-3/+3
A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is not quite right. `Spacing` makes sense for `TokenTree::Token`, but does not make sense for `TokenTree::Delimited`, because a `TokenTree::Delimited` cannot be joined with another `TokenTree`. This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`, changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the `TreeAndSpacing` typedef. The commit removes these two impls: - `impl From<TokenTree> for TokenStream` - `impl From<TokenTree> for TreeAndSpacing` These were useful, but also resulted in code with many `.into()` calls that was hard to read, particularly for anyone not highly familiar with the relevant types. This commit makes some other changes to compensate: - `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`. - `TokenStream::token_{alone,joint}()` are added. - `TokenStream::delimited` is added. This results in things like this: ```rust TokenTree::token(token::Semi, stmt.span).into() ``` changing to this: ```rust TokenStream::token_alone(token::Semi, stmt.span) ``` This makes the type of the result, and its spacing, clearer. These changes also simplifies `Cursor` and `CursorRef`, because they no longer need to distinguish between `next` and `next_with_spacing`.
2022-07-28rustdoc: align invalid-html-tags lint with commonmark specMichael Howell-1/+9
2022-07-28Rollup merge of #99817 - notriddle:notriddle/clean-trait-removal, ↵Dylan DPC-60/+55
r=GuillaumeGomez rustdoc: remove Clean trait impls for more items Follow up to https://github.com/rust-lang/rust/pull/99638 and https://github.com/rust-lang/rust/pull/99672
2022-07-28Rollup merge of #99810 - GuillaumeGomez:fix-settings-slider-small-width, ↵Dylan DPC-2/+1
r=notriddle Fix settings slider on small width screens Fixes #99794. Screenshot of the fix: ![Screenshot from 2022-07-27 14-17-08](https://user-images.githubusercontent.com/3050060/181250007-55f982d1-89db-45b7-a4f1-0d1729e6a3e3.png) cc `````@jsha````` r? `````@notriddle`````
2022-07-28Remove Clean trait implementation for VariantData fieldsGuillaume Gomez-7/+3
2022-07-28Remove Clean trait implementation for VariantStructGuillaume Gomez-7/+8
2022-07-28Remove Clean trait implementation for ty::VisibilityGuillaume Gomez-18/+17
2022-07-27rustdoc: remove Clean trait impl for ty::GenericParamDefMichael Howell-42/+39
2022-07-27rustdoc: remove Clean trait impl for hir::TermMichael Howell-9/+7
2022-07-27rustdoc: remove Clean trait impl for ty::TermMichael Howell-9/+9
2022-07-27Rollup merge of #99812 - GuillaumeGomez:fix-headings-colors, r=jsha,notriddleGuillaume Gomez-6/+2
Fix headings colors Fixes #99797. ![image](https://user-images.githubusercontent.com/3050060/181260966-49faf9d3-f6b8-4de4-bc7d-ed9f0467cf68.png) cc `@jsha` r? `@notriddle`
2022-07-27Rollup merge of #99710 - davidtwco:internal-lint-opts, r=lcnrGuillaume Gomez-1/+1
lint: add bad opt access internal lint Prompted by [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/sess.2Ecrate_types.28.29.20vs.20sess.2Eopts.2Ecrate_types/near/290682847). Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`. Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted. A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too. **Leave a comment if there's an option I should add this to.**
2022-07-27Fix headings borderGuillaume Gomez-5/+1
2022-07-27Fix invalid css property valueGuillaume Gomez-1/+1
2022-07-27Fix settings display on small screen sizeGuillaume Gomez-2/+1
2022-07-27session: disable internal lints for rustdocDavid Wood-1/+1
If an internal lint uses `typeck_results` or similar queries then that can result in rustdoc checking code that it shouldn't (e.g. from other platforms) and emit compilation errors. Signed-off-by: David Wood <david.wood@huawei.com>