about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2020-08-20Remove duplication in `fold_item`Joshua Nelson-23/+1
2020-08-19xpy fmtJoshua Nelson-1/+6
2020-08-19Use `impls` for intra doc links as wellJoshua Nelson-34/+18
2020-08-19Allow reusing the code in `collect_trait_impls`Joshua Nelson-34/+1
2020-08-19Rollup merge of #75665 - GuillaumeGomez:doc-examples-coverage, r=jyn514Yuki Okushi-24/+84
Add doc examples coverage r? @jyn514
2020-08-19Rollup merge of #75652 - jyn514:true-false-2, r=GuillaumeGomezYuki Okushi-7/+18
Resolve true and false as booleans Successor to https://github.com/rust-lang/rust/pull/75101. r? @Manishearth cc @rust-lang/rustdoc
2020-08-18Add doc examples count for --show-coverageGuillaume Gomez-24/+84
2020-08-17Resolve true and false as booleansJoshua Nelson-7/+18
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-15/+15
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-2/+2
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-2/+2
2020-08-13Add Array Impl Lang Item in various placeskadmin-0/+1
Add basic test And also run fmt which is where the other changes are from Fix mut issues These only appear when running tests, so resolved by adding mut Swap order of forget Add pub and rm guard impl Add explicit type to guard Add safety note Change guard type from T to S It should never have been T, as it guards over [MaybeUninit<S>; N] Also add feature to test
2020-08-09Give precedence to primitives over modulesJoshua Nelson-3/+5
This has less surprising behavior when there is a module with the same name as a primitive in scope.
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-2/+4
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-06Rollup merge of #75079 - jyn514:disambiguator, r=ManishearthManish Goregaokar-43/+145
Disallow linking to items with a mismatched disambiguator Closes https://github.com/rust-lang/rust/issues/74851 r? @Manishearth
2020-08-06Add doc-comment for `kind_side_channel`Joshua Nelson-0/+3
2020-08-06Remove dead codeJoshua Nelson-17/+1
2020-08-06Fix outdated codeJoshua Nelson-3/+1
2020-08-06Use the proper kind for associated itemsJoshua Nelson-2/+8
See comments in the diff; this is such a hack. The reason this can't be done properly in `register_res` is because there's no way to get back the parent type: calling `tcx.parent(assoc_item)` gets you the _impl_, not the type. You can call `tcx.impl_trait_ref(impl_).self_ty()`, but there's no way to go from that to a DefId without unwrapping.
2020-08-06Still print help even if there's no spanJoshua Nelson-0/+2
2020-08-05Suggest f() for functions and add a test caseJoshua Nelson-1/+2
2020-08-05Unresolved link -> incompatible link kindJoshua Nelson-2/+1
Clearly it has been resolved, because we say on the next line what it resolved to.
2020-08-05Give a much better error message if the struct failed to resolveJoshua Nelson-60/+127
2020-08-03item -> linkJoshua Nelson-1/+1
2020-08-02Don't mark associated items as traitsJoshua Nelson-1/+2
This caused the following false positive: ``` warning: unresolved link to `Default::default` --> /home/joshua/rustc2/default.rs:1:14 | 1 | /// Link to [Default::default()] | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(broken_intra_doc_links)]` on by default note: this item resolved to a trait, which did not match the disambiguator 'fn' --> /home/joshua/rustc2/default.rs:1:14 | 1 | /// Link to [Default::default()] | ^^^^^^^^^^^^^^^^^^ ```
2020-08-02Disallow linking to items with a mismatched disambiguatorJoshua Nelson-2/+43
2020-08-01rustc_metadata: track the simplified Self type for every trait impl.Eduard-Mihai Burtescu-1/+1
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