summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2020-05-31Auto merge of #72767 - pnkfelix:track-devirtualized-filenames-issue-70924, ↵bors-2/+3
r=eddyb Track devirtualized filenames Split payload of FileName::Real to track both real and virtualized paths. (Such splits arise from metadata refs into libstd; the virtualized paths look like `/rustc/1.45.0/src/libstd/io/cursor.rs` rather than `/Users/felixklock/Dev/Mozilla/rust.git/src/libstd/io/cursor.rs`) This way, we can emit the virtual name into things like the like the StableSourceFileId (as was done back before PR #70642) that ends up in incremental build artifacts, while still using the devirtualized file path when we want to access the file. Fix #70924
2020-05-30Rollup merge of #72650 - GuillaumeGomez:sort-sidebar-elements, r=kinnisonRalf Jung-32/+31
Sort sidebar elements r? @kinnison
2020-05-29Split payload of FileName::Real to track both real and virutalized paths.Felix S. Klock II-2/+3
Such splits arise from metadata refs into libstd. This way, we can (in a follow on commit) continue to emit the virtual name into things like the like the StableSourceFileId that ends up in incremetnal build artifacts, while still using the devirtualized file path when we want to access the file. Note that this commit is intended to be a refactoring; the actual fix to the bug in question is in a follow-on commit.
2020-05-27Sort fields, variants and other unsorted elements in the sidebarGuillaume Gomez-32/+31
2020-05-26Auto merge of #71900 - GuillaumeGomez:clean-up-rustdoc, r=ollie27,kinnisonbors-7/+10
Clean up rustdoc source code Fixes #70498. r? @kinnison cc @rust-lang/rustdoc
2020-05-16Rollup merge of #71724 - GuillaumeGomez:doc-alias-improvements, r=ollie27Dylan DPC-37/+6
Doc alias improvements After [this message](https://github.com/rust-lang/rust/issues/50146#issuecomment-496601755), I realized that the **doc alias**. So this PR does the followings: * Align the alias discovery on items added into the search-index. It brings a few nice advantages: * Instead of cloning the data between the two (in rustdoc source code), we now have the search-index one and aliases which reference to the first one. So we go from one big map containing a lot of duplicated data to just integers... * In the front-end (main.js), I improved the code around aliases to allow them to go through the same transformation as other items when we show the search results. * Improve the search tester in order to perform multiple requests into one file (I think it's better in this case than having a file for each case considering how many there are...) * I also had to add the new function inside the tester (`handleAliases`) Once this PR is merged, I intend to finally stabilize this feature. r? @ollie27 cc @rust-lang/rustdoc
2020-05-14Move doc alias discovery into the Attributes struct and some code improvementsGuillaume Gomez-1/+1
2020-05-11Rollup merge of #72109 - matthiaskrgr:cl8ppy, r=Dylan-DPCDylan DPC-3/+2
Fix clippy warnings Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed} r? @Dylan-DPC
2020-05-11Rollup merge of #72014 - GuillaumeGomez:deprecated-emoji, r=kinnison,ollie27Dylan DPC-1/+4
Deprecated emoji Fixes #67872. r? @kinnison cc @rust-lang/rustdoc
2020-05-11Fix clippy warningsMatthias Krüger-3/+2
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-05-09Sort "implementations on foreign types" section in the sidebarGuillaume Gomez-8/+7
2020-05-08Add emoji for deprecated messagesGuillaume Gomez-1/+4
2020-05-08Clean up rustdoc source codeGuillaume Gomez-7/+10
2020-05-07Merge aliases and search-indexGuillaume Gomez-36/+0
2020-05-07Improve doc alias discoveryGuillaume Gomez-3/+8
2020-05-05Replace title "Methods" with "Implementations"Guillaume Gomez-11/+11
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-8/+3
These are semantically the same, but `find_map()` is more concise.
2020-04-17Replace big JS dict with JSON parsingGuillaume Gomez-4/+35
2020-04-08rustdoc: Don't try to load source files from external cratesOliver Middleton-3/+3
Local items defined in external macros shouldn't generate rendered source files and should link to the external crate's docs instead.
2020-03-31more clippy fixesMatthias Krüger-8/+5
use is_empty() instead of len comparison (clippy::len_zero) use if let instead of while let loop that never loops (clippy::never_loop) remove redundant returns (clippy::needless_return) remove redundant closures (clippy::redundant_closure) use if let instead of match and wildcard pattern (clippy::single_match) don't repeat field names redundantly (clippy::redundant_field_names)
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-2/+2
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-2/+2
2020-03-19Auto merge of #69402 - GuillaumeGomez:extend-search, r=kinnisonbors-9/+61
Extend search I realized that when looking for "struct:String" in the rustdoc search for example, the "in arguments" and "returned" tabs were always empty. After some investigation, I realized it was because we only provided the name, and not the type, making it impossible to pass the "type filtering" check. To resolve this, I added the type alongside the name. Note for the future: we could improve this by instead only registering the path id and use the path dictionary directly. The only problem with that solution (which I already tested) is that it becomes complicated for types in other crates. It'd force us to handle both case with an id and a case with `(name, type)`. I found the current PR big enough to not want to provide it directly. However, I think this is definitely worth it to make it work this way in the future. About the two tests I added: they don't have much interest except checking that we actually have something returned in the search in the cases of a type filtering with and without literal search. I also had to update a bit the test script to add the new locally global (haha) variable I created (`NO_TYPE_FILTER`). I added this variable to make the code easier to read than just "-1". r? @kinnison cc @ollie27
2020-03-17Update rustdoc test and remove TODO commentGuillaume Gomez-1/+0
2020-03-16Rename render::Type to improve namingGuillaume Gomez-5/+5
2020-03-16formattingGuillaume Gomez-4/+1
2020-03-16Support type search for arguments and returned typesGuillaume Gomez-7/+62
2020-03-15Add FIXME notevarkor-1/+1
2020-03-15Render full attributes in rustdocvarkor-22/+2
2020-03-14Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPCYuki Okushi-6/+4
fix more clippy findings * reduce references on match patterns (clippy::match_ref_pats) * Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline) * libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string) * remove unneeded mutable references (cippy::unnecessary_mut_passed) * libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast) * rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes) * call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref) * iterate over a maps values directly. (clippy::for_kv_map) * rustdoc: simplify boolean condition (clippy::nonminimal_bool) * Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently) * rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some) * rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
2020-03-11Rollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27Mazdak Farrokhzad-1/+2
--show-coverage json The purpose of this change is to be able to use it as a tool in docs.rs in order to provide some more stats to crates' owners. Eventually even create a badge or something along the line. r? @QuietMisdreavus
2020-03-10Auto merge of #66364 - Centril:cleanup-macro-def, r=petrochenkov,eddybbors-1/+1
Cleanup `rmeta::MacroDef` Avoid using rountrip parsing in the encoder and in `fn load_macro_untracked`. The main reason I was interested in this was to remove `rustc_parse` as a dependency of `rustc_metadata` but it seems like this had other benefits as well. Fixes #49511. r? @eddyb cc @matthewjasper @estebank @petrochenkov
2020-03-10Store `TokenStream` in `rmeta::MacroDef`.Mazdak Farrokhzad-1/+1
This removes a hack from `load_macro_untracked` in which parsing is used.
2020-03-10Rollup merge of #69514 - GuillaumeGomez:remove-spotlight, r=kinnisonMazdak Farrokhzad-81/+4
Remove spotlight I had a few comments saying that this feature was at best misunderstood or not even used so I decided to organize a poll about on [twitter](https://twitter.com/imperioworld_/status/1232769353503956994). After 87 votes, the result is very clear: it's not useful. Considering the amount of code we have just to run it, I think it's definitely worth it to remove it. r? @kinnison cc @ollie27
2020-03-07iterate over a maps values directly. (clippy::for_kv_map)Matthias Krüger-1/+1
2020-03-07rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some)Matthias Krüger-5/+3
2020-03-06fix various typosMatthias Krüger-1/+1
2020-03-05Const items have by default a static lifetime, there's no need to annotate ↵Matthias Krüger-2/+2
it. (clippy::redundant_static_lifetimes)
2020-03-05Remove redundant patterns when matching ( x @ _ to x) ↵Matthias Krüger-1/+1
(clippy::redundant_pattern)
2020-03-02Put back output-format option for show-coverageGuillaume Gomez-1/+2
2020-03-01Rollup merge of #69598 - ollie27:rustdoc_crate-version_escape, r=GuillaumeGomezDylan DPC-2/+3
rustdoc: HTML escape crate version As `--crate-version` accepts arbitrary strings they need to be escaped. r? @GuillaumeGomez
2020-03-01rustdoc: HTML escape crate versionOliver Middleton-2/+3
As `--crate-version` accepts arbitrary strings they need to be escaped.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-1/+1
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-3/+3
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-3/+3
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-02-27Remove "important traits" featureGuillaume Gomez-81/+4
2020-02-24don't explicitly compare against true or falseMatthias Krüger-1/+1
2020-02-04Rollup merge of #68818 - matthiaskrgr:misc_perf, r=Mark-SimulacrumDylan DPC-8/+1
fix couple of perf related clippy warnings librustc: don't clone a type that is copy librustc_incremental: use faster vector initialization librustc_typeck: don't clone a type that is copy librustdoc: don't create a vector where a slice will do
2020-02-04fix couple of perf related clipyp warningsMatthias Krüger-8/+1
librustc: don't clone a type that is copy librustc_incremental: use faster vector initialization librustc_typeck: don't clone a type that is copy librustdoc: don't create a vector where a slice will do