about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2020-07-30Rename the lint againManish Goregaokar-1/+1
2020-07-30Rename to intra_doc_resolution_failuresManish Goregaokar-36/+30
2020-07-29Rename intra_doc_link_resolution_failure -> intra_doc_link_resolution_failuresManish Goregaokar-1/+1
2020-07-27private_items_doc_tests -> doc_test_lintsJoshua Nelson-3/+3
2020-07-27Move `look_for_tests` to `private_items_doc_tests`Joshua Nelson-56/+61
2020-07-27Separate `missing_doc_code_examples` from intra-doc linksJoshua Nelson-16/+21
These two lints have no relation other than both being nightly-only. This allows stabilizing intra-doc links without stabilizing missing_doc_code_examples.
2020-07-22rustdoc: Add explanation when linting against public to private item linksDennis Hamester-0/+7
The additional note helps explaining why the lint was triggered and that --document-private-items directly influences the link resolution.
2020-07-22rustdoc: Always warn when linking from public to private itemsDennis Hamester-5/+12
Change the logic such that linking from a public to a private item always triggers intra_doc_link_resolution_failure. Previously, the warning was not emitted when --document-private-items is passed. Also don't rely anymore on the item's visibility, which would falsely trigger the lint now that the check for --document-private-items is gone.
2020-07-20refactor and reword intra-doc link errorsAndy Russell-181/+173
This commit refactors intra-doc link error reporting to deduplicate code and decouple error construction from the type of error. This greatly improves flexibility at each error construction site, while reducing the complexity of the diagnostic creation. This commit also rewords the diagnostics for clarity and style: - Diagnostics should not end in periods. - It's unnecessary to say "ignoring it". Since this is a warning by default, it's already clear that the link is ignored.
2020-07-17intra-doc links: Resolve modules in type namespaceManish Goregaokar-15/+8
2020-07-16Add more debuggingJoshua Nelson-2/+9
2020-07-16Support intra-doc links on trait and module re-exportsJoshua Nelson-21/+7
Trait implementations are treated the same as modules for the purposes of intra-doc links.
2020-07-16Support intra-doc links on macro re-exportsJoshua Nelson-10/+8
This includes both `macro_rules!` and proc-macros.
2020-07-16Move import to top of functionJoshua Nelson-1/+2
2020-07-16Remove warningsJoshua Nelson-3/+1
2020-07-16Make sure that module_id is actually a moduleJoshua Nelson-1/+13
2020-07-16Don't panic on fake IDsJoshua Nelson-101/+11
2020-07-16Use DefId for modulesJoshua Nelson-8/+17
2020-07-16Use the scope of the imported variable for resolution, not the current scopeJoshua Nelson-4/+92
- Accept DefId in resolve_str_path_error This will probably break lots of internal invariants.
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-09Allow for parentheses after macro intra-doc-linksManish Goregaokar-0/+3
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-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-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-02Fix linksGuillaume Gomez-1/+1
2020-06-26Fix debug messagesJoshua Nelson-3/+2
2020-06-26Generate docs for links to private items when passed --document-privateJoshua Nelson-9/+19
- 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/+27
2020-06-11Rollup merge of #73183 - Manishearth:intra-doc-macro, r=GuillaumeGomezDylan DPC-28/+72
Support proc macros in intra doc link resolution The feature was written pre-proc macro resolution, so it only supported the wacky MBE resolution rules. This adds support for proc macros as well. cc @GuillaumeGomez Fixes #73173
2020-06-10Don't print bang diagnostics for derivesManish Goregaokar-1/+7
2020-06-10Avoid collisions between traits and their derive macrosManish Goregaokar-3/+26
2020-06-09intra-doc macro resolution should also handle proc macrosManish Goregaokar-24/+39
2020-06-09Fix more clippy warningsMatthias Krüger-1/+1
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-05-30Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`marmeladema-3/+3
2020-05-22Allow using `Self::` in docTymoteusz Jankowski-4/+50
2020-05-19Make intra-link resolve links for both trait and impl itemsTymoteusz Jankowski-26/+35
2020-05-13Make intra links work inside trait impl blockTymoteusz Jankowski-11/+55
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-2/+2
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-2/+1
These are semantically the same, but `find_map()` is more concise.
2020-04-23Address comments from reviewmarmeladema-4/+2
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-4/+2
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-1/+5
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-1/+1
2020-04-23Create new rustdoc lint to check for code blocks tagsGuillaume Gomez-3/+5
2020-04-16Dogfood or_patterns in rustdocJosh Stone-6/+6
2020-04-14rustdoc: add "const_slice_ptr" and "mut_slice_ptr" trait implsMatthias Schiffer-0/+2
2020-04-14Rename AssocKind::Method to AssocKind::FnRustin-Liu-11/+12
Rename fn_has_self_argument to fn_has_self_parameter Rename AssocItemKind::Method to AssocItemKind::Fn Refine has_no_input_arg Refine has_no_input_arg Revert has_no_input_arg Refine suggestion_descr Move as_def_kind into AssocKind Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> Fix tidy check issue Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-05Stop importing int modules in librustdocLinus Färnstrand-1/+0
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-2/+2
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-3/+3