Commit Graph

1436 Commits

Author SHA1 Message Date
Vadim Petrochenkov 38ed36bba4 hir: Preserve used syntax in `TyKind::TraitObject` 2021-03-18 03:02:32 +03:00
Vadim Petrochenkov b25d3ba781 ast/hir: Rename field-related structures
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03:00
Camille GILLOT c701872a6c Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00
Guillaume Gomez f879ecc4ef Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler 2021-03-05 16:04:24 +01:00
Joshua Nelson 4d7a648485 Remove the dummy cache in `DocContext`
The same information is available everywhere; the only reason the dummy
cache was needed is because it waas previously stored in three different
places. This consolidates the info a bit so the cache in `DocContext` is
used throughout. As a bonus, it means `renderinfo` is used much much
less.

- Return a `Cache` from `run_global_ctxt`, not `RenderInfo`
- Remove the unused `render_info` from `run_renderer`
- Remove RefCell around `inlined`
- Add intra-doc links
2021-03-01 00:30:30 -05:00
Guillaume Gomez 58a34a4dde Remove is_spotlight field from `Trait` 2021-02-23 21:57:40 +01:00
Camelid e4ac499b7e Remove many RefCells from DocContext
I left some of them so this change doesn't balloon in size and because
removing the RefCell in `DocContext.resolver` would require compiler
changes.

Thanks to `@jyn514` for making this a lot easier with #82020!
2021-02-22 10:02:56 -08:00
Camelid 6a85719b6a rustdoc: Remove unnecessary `Cell` around `param_env` 2021-02-20 17:12:22 -08:00
Joshua Nelson 2bc5a0a600 Make `Clean` take &mut DocContext
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics`
- Take `&mut DocContext` in most of `clean`
- Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad.
- Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-16 21:25:14 -05:00
bors 8fe989dd76 Auto merge of #81611 - cjgillot:meowner, r=estebank
Only store a LocalDefId in some HIR nodes

Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef.
As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`.

This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
2021-02-16 22:14:32 +00:00
Guillaume Gomez 46b93b2e44
Rollup merge of #82163 - matthiaskrgr:slice, r=jyn514
avoid full-slicing slices

If we already have a slice, there is no need to get another full-range slice from that, just use the original.
clippy::redundant_slicing
2021-02-16 19:21:20 +01:00
Matthias Krüger 4390a61b64 avoid full-slicing slices
If we already have a slice, there is no need to get another full-range slice from that, just use the original.
clippy::redundant_slicing
2021-02-16 00:31:11 +01:00
Camille GILLOT c4e7427081 Only store a LocalDefId in hir::MacroDef. 2021-02-15 19:35:55 +01:00
Camille GILLOT 996dc8d5c5 Only store a LocalDefId in hir::ForeignItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT 786a80e9ea Only store a LocalDefId in hir::ImplItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT a871a0f111 Only store a LocalDefId in hir::TraitItem. 2021-02-15 19:32:28 +01:00
Camille GILLOT cebbba081e Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00
Camille GILLOT c676e358a5 Use ItemId as a strongly typed index. 2021-02-15 19:24:58 +01:00
Takayuki Maeda ba72bc9b83 fix typo 2021-02-14 21:18:17 +09:00
Yuki Okushi 4c8e38aa60
Rollup merge of #82033 - magurotuna:issue82016, r=jyn514
Refactor `get_word_attr` to return only `Option`

This commit removes `bool` from the return type of `NestedAttributesExt::get_word_attr` so it will return only `Option<ast::NestedMetaItem>` for less redundancy.

Closes #82016

r? `@jyn514`
2021-02-13 16:36:48 +09:00
Yusuke Tanaka 681cccad57
Rename to `inline_attr` and use if-let to extract `NestedMetaItem` 2021-02-13 01:48:00 +09:00
Yusuke Tanaka 715c19e75e
Refactor `get_word_attr` to return only `Option` 2021-02-13 01:13:50 +09:00
Yuki Okushi 1a9d20b430
Rollup merge of #82004 - GuillaumeGomez:clean-static-struct, r=jyn514
clean up clean::Static struct

Having a `String` for the expression didn't make much sense, and even less when it's actually not used (except in json so I kept it).

r? ``@jyn514``
2021-02-12 19:32:18 +09:00
Guillaume Gomez 583563d86d clean up clean::Static struct 2021-02-11 20:37:36 +01:00
LeSeulArtichaut 2a67e2e323 Revert "Get rid of custom pretty-printing in rustdoc"
This reverts commit 31375d2074.
2021-02-08 19:51:28 +01:00
Guillaume Gomez c92b161df0 Remove unneeded From trait impl for DefKind 2021-02-05 17:23:54 +01:00
Guillaume Gomez 4810910b0b Remove Function all_types and ret_types fields 2021-02-05 17:23:52 +01:00
Guillaume Gomez 19630ead41 Remove cache usage wherever possible 2021-01-27 10:05:05 +01:00
Guillaume Gomez 9fd5a67984 Remove CACHE_KEY global 2021-01-27 10:05:05 +01:00
Camelid 93e51b185a rustdoc: Fix visibility of trait and impl items 2021-01-22 18:30:30 -08:00
Rune Tynan 3349b40d47
Remove StructType entirely and replace it with CtorKind 2021-01-20 17:19:46 -05:00
Rune Tynan 450c5eae1d
Move StructType to clean, remove it from Unions, make JSON output whether something is a union 2021-01-20 16:46:34 -05:00
Jack Huey dcad9f1893 More review comments 2021-01-16 18:56:37 -05:00
Jack Huey 3dea68de1d Review changes 2021-01-16 18:56:37 -05:00
Jack Huey 476bd53058 Cleanup 2021-01-16 18:50:34 -05:00
Mara Bos 1368e81bcb
Rollup merge of #81021 - CraftSpider:rustdoc-remove-import, r=jyn514
Remove doctree::Import

Per the title. Part of cleaning up doctree
2021-01-16 17:30:08 +00:00
Joshua Nelson d11855a8ce Rename VariantKind -> Variant
There's no `Variant`, so it seems silly to have `Kind`.
2021-01-15 13:55:03 -05:00
Joshua Nelson dd459a2be6 Remove useless `clean::Variant` struct
It had exactly one field and no special behavior, so there was no point.
2021-01-15 13:54:59 -05:00
Rune Tynan 2a0c9e28cb
Address nit 2021-01-15 12:50:04 -05:00
Rune Tynan e3274fd148
Remove doctree::Import 2021-01-15 12:49:45 -05:00
Rune Tynan c54678ab2f
Remove doctree::Variant 2021-01-14 15:21:44 -05:00
bors c7b0ddbffe Auto merge of #80802 - jyn514:box-attributes, r=nnethercote
Box Item::Attributes

This reduces the size of Item from 128 to 40 bytes. I think this is as small as it needs to get 🎉

Builds on https://github.com/rust-lang/rust/pull/80339 and should not be merged before.

r? `@GuillaumeGomez`
2021-01-14 02:26:46 +00:00
bors a62a76047e Auto merge of #77524 - Patryk27:fixes/66228, r=estebank
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924)

This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-13 20:35:58 +00:00
Joshua Nelson a8ff647deb Separate out a `hir::Impl` struct
This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.
2021-01-12 20:32:33 -05:00
Joshua Nelson 690aeaf087 Box Item::attributes
This reduces the size of Item from 136 to 48 bytes.
2021-01-10 10:39:36 -05:00
Patryk Wychowaniec d2f8e398f1
Rework diagnostics for wrong number of generic args 2021-01-10 13:07:40 +01:00
Guillaume Gomez 34d128a263 Replace under-used ImplPolarity enum with a boolean 2021-01-09 14:59:37 +01:00
Yuki Okushi dec3dbd36a
Rollup merge of #80799 - jyn514:pretty-print, r=CraftSpider
Get rid of custom pretty-printing in rustdoc

and use rustc_hir_pretty directly instead.

Closes https://github.com/rust-lang/rust/issues/79497.

r? `@CraftSpider`
2021-01-08 11:11:50 +09:00
Joshua Nelson 31375d2074 Get rid of custom pretty-printing in rustdoc
and use rustc_hir_pretty directly instead
2021-01-07 17:44:59 -05:00
LingMan 961f9ee6df Use Option::map_or instead of `.map(..).unwrap_or(..)` 2021-01-07 20:03:59 +01:00