Commit graph

11759 commits

Author SHA1 Message Date
Michael Woerister 5144661d6b Remove out-dated information from rustc_codegen_llvm/src/debuginfo/doc.md 2022-03-14 16:52:47 +01:00
Michael Woerister 3ad299aa67 debuginfo: change cpp-like naming for generator environments so that NatVis works for them 2022-03-14 16:52:47 +01:00
Michael Woerister 07ebc13d87 debuginfo: Refactor debuginfo generation for types
This commit
- changes names to use di_node instead of metadata
- uniformly names all functions that build new debuginfo nodes build_xyz_di_node
- renames CrateDebugContext to CodegenUnitDebugContext (which is more accurate)
- moves TypeMap and functions that work directly work with it to a new type_map module
- moves and reimplements enum related builder functions to a new enums module
- splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate
- uses SmallVec instead of Vec in many places
- removes the old infrastructure for dealing with recursion cycles (create_and_register_recursive_type_forward_declaration(), RecursiveTypeDescription, set_members_of_composite_type(), MemberDescription, MemberDescriptionFactory, prepare_xyz_metadata(), etc)
- adds type_map::build_type_with_children() as a replacement for dealing with recursion cycles
- adds many (doc-)comments explaining what's going on
- changes cpp-like naming for C-Style enums so they don't get a enum$<...> name (because the NatVis visualizer does not apply to them)
- fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields
- changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it
2022-03-14 16:49:06 +01:00
bors 3f58828fdc Auto merge of #94773 - cjgillot:lifetime-fresh-did, r=oli-obk
Identify anonymous lifetimes by their DefId in HIR.

`ParamName::Fresh` currently identifies anonymous lifetimes by an `usize` index computed from the number of lifetimes in scope. This makes the behaviour of lowering dependent on the contents of the surrounding item in unpredictable ways.

This PR replaces this index by the `LocalDefId` of the synthetized generic lifetime parameter. This makes obvious which parameter the lifetime corresponds to.
2022-03-14 02:49:21 +00:00
Camille GILLOT c8c691ff88 Update comments. 2022-03-13 23:13:58 +01:00
bors 4800c7816e Auto merge of #94897 - camelid:query-doc-hidden, r=cjgillot
Queryify `is_doc_hidden`

It came up hot on some profiling of rustdoc I did, so hopefully turning
it into a query will help.
2022-03-13 11:12:01 +00:00
Noah Lev f39d0fc100 Queryify is_doc_hidden
It came up hot on some profiling of rustdoc I did, so hopefully turning
it into a query will help.
2022-03-12 14:27:51 -08:00
bors bbbd48fa6d Auto merge of #90358 - DevinR528:omitted-field-fix, r=jackh726
Fix exposing fields marked unstable or doc hidden

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

Work towards https://github.com/rust-lang/rust/issues/89554

Filter fields that are marked `doc(hidden)` or are unstable with that feature turned off. This brings structs and enums into alignment behavior-wise when emitting warning/errors about pattern exhaustiveness/reachability.

cc `@Nadrieril`
2022-03-12 21:34:30 +00:00
Devin Ragotzy 492d8d7293 Fix rebase conflicts with stderr files 2022-03-12 15:38:44 -05:00
Devin Ragotzy c0e76d6999 Format reordered imports in tyck/pat 2022-03-12 15:16:11 -05:00
Devin Ragotzy 7ffb29d03c Only filter doc(hidden) fields/variants when not crate local 2022-03-12 15:16:11 -05:00
Devin Ragotzy 8663ee19e4 Fix omitted_patterns lint showing unstable/doc hidden fields 2022-03-12 15:02:42 -05:00
bors f103b2969b Auto merge of #94865 - notriddle:notriddle/single-colon-path-not-const-generics, r=cjgillot
diagnostics: single colon within `<>` probably, not type ascription

Fixes #94812
2022-03-12 19:10:33 +00:00
bors 22a20e3f0f Auto merge of #94711 - ouz-a:master3, r=oli-obk
Return early to fix ICE

This fixes #94627, ICE happens because compiler tries to suggest constraining type parameter but the only constraint is implicit `std::Sized` one, so it gets removed and there is nothing to suggest resulting in ICE.
2022-03-12 16:37:07 +00:00
ouz-a 1853ffccbc don't call multipart_suggestion 2022-03-12 18:51:28 +03:00
Michael Howell 26e299a4a7 Use consistent prose for ::
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2022-03-12 08:20:36 -07:00
bors ed2a69c4a9 Auto merge of #94873 - DrMeepster:box_alloc_ice3, r=oli-obk
Fix ICE when using Box<T, A>, again

Sequel to #94043, fixes #94835.
2022-03-12 14:18:34 +00:00
Camille GILLOT d3b7ea6c9e Identify anonymous lifetimes by their DefId in HIR. 2022-03-12 14:18:56 +01:00
bors 258256697b Auto merge of #94870 - notriddle:notriddle/filter-regression, r=oli-obk
diagnostics: do not spurriously claim something is "not an iterator"

Fixes a minor regression caused by #94746, where `iter::Filter` is spurriously declared "not an iterator."
2022-03-12 11:58:07 +00:00
bors f8a29bd95e Auto merge of #94875 - matthiaskrgr:rollup-tq1li2d, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #94150 (rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON)
 - #94833 ([2/2] Implement macro meta-variable expression)
 - #94863 (Remove redundant slicing of whole ranges in `bootstrap`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-12 09:30:06 +00:00
Matthias Krüger 8c87132103
Rollup merge of #94833 - c410-f3r:meta-take-2, r=petrochenkov
[2/2] Implement macro meta-variable expression

Final part of https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295

r? `@petrochenkov`
2022-03-12 09:35:45 +01:00
bors 012720ffb0 Auto merge of #94733 - nnethercote:fix-AdtDef-interning, r=fee1-dead
Improve `AdtDef` interning.

This commit makes `AdtDef` use `Interned`. Much of the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.

r? `@fee1-dead`
2022-03-12 07:02:05 +00:00
DrMeepster 9d72dd54d0 fix another assumption about box 2022-03-11 17:00:56 -08:00
Michael Howell 317f684160 diagnostics: do not spurriously claim something is "not an iterator"
Fixes a minor regression caused by #94746, where iter::Filter is
spurriously declared "not an iterator."
2022-03-11 16:59:32 -07:00
Michael Howell 7e323370b3 diagnostics: single colon within <> probably, not type ascription
Fixes #94812
2022-03-11 15:35:18 -07:00
Caio d0eca08bc4 Implement macro meta-variable expression 2022-03-11 17:48:51 -03:00
Dylan DPC 298c9a0e14
Rollup merge of #94839 - TaKO8Ki:suggest-using-double-colon-for-struct-field-type, r=cjgillot
Suggest using double colon when a struct field type include single colon

#92685
2022-03-11 20:29:47 +01:00
Dylan DPC 9e70b1a033
Rollup merge of #94827 - RalfJung:offset-from-ub, r=oli-obk
CTFE/Miri: detect out-of-bounds pointers in offset_from

Also I became uneasy with aggressively doing `try_to_int` here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now.

Hiding whitespaces helps with the diff.

Fixes https://github.com/rust-lang/miri/issues/1950

r? ``@oli-obk``
2022-03-11 20:29:45 +01:00
Dylan DPC 86376e3aea
Rollup merge of #94798 - nnethercote:parse_tt-refactor, r=petrochenkov
`parse_tt` refactorings

Some readability improvements.

r? ``@petrochenkov``
2022-03-11 20:29:44 +01:00
bors c9b45e6010 Auto merge of #90253 - Kobzol:hash-stable-sort-index-map, r=cjgillot
Change several HashMaps to IndexMap to improve incremental hashing performance

Stable hashing hash maps in incremental mode takes a lot of time, especially for some benchmarks like `clap`. As noted by `@Mark-Simulacrum` [here](https://github.com/rust-lang/rust/pull/89404#issuecomment-950043892), this cost could be reduced by replacing some hash maps by indexmaps.

I gathered some statistics and found several hash maps that took a lot of time to hash and replaced them by indexmaps. However, in order for this to work, we need to make sure that these indexmaps have deterministic insertion order. These three are used only in visitors as far as I can see, which seems deterministic. Can we enforce this somehow? Or should some explaining comment be included for these maps?
2022-03-11 16:37:55 +00:00
Dylan DPC 4ec98d8415
Rollup merge of #94840 - lcnr:update-comment, r=Dylan-DPC
update `replace_bound_vars_with_placeholders` doc comment
2022-03-11 13:38:38 +01:00
Takayuki Maeda 813f00dd4f fix a suggestion message 2022-03-11 21:26:06 +09:00
lcnr c833a9b4b4 update comment 2022-03-11 09:51:42 +01:00
Takayuki Maeda bdc3177868 suggest using double colon when using single colon in struct field type path 2022-03-11 16:15:57 +09:00
Nicholas Nethercote 95d13fa37d Move a parse_tt error case into a separate function. 2022-03-11 14:10:21 +11:00
Nicholas Nethercote 235a87fbd3 Make next_items a SmallVec.
For consistency, and to make the code slightly nicer.
2022-03-11 14:10:21 +11:00
Nicholas Nethercote c13ca42d67 Move eof_items handling entirely within inner_parse_loop.
Also rename `inner_parse_loop` as `parse_tt_inner`, because it's no
longer just a loop.
2022-03-11 14:10:21 +11:00
Nicholas Nethercote 9f0798b2eb Add a useful assertion. 2022-03-11 14:10:21 +11:00
Nicholas Nethercote 4d4baf7c9a Disallow TokenTree::{MetaVar,MetaVarExpr} in matchers.
They should only appear in transcribers.
2022-03-11 14:10:19 +11:00
Nicholas Nethercote 09c3e82050 Refactor the second half of parse_tt.
The current structure makes it hard to tell that there are just four
distinct code paths, depending on how many items there are in `bb_items`
and `next_items`. This commit introduces a `match` that clarifies
things.
2022-03-11 13:56:54 +11:00
Nicholas Nethercote ca5525d564 Improve AdtDef interning.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
2022-03-11 13:31:24 +11:00
bors c5a43b8d39 Auto merge of #94276 - scottmcm:primitive-clone, r=oli-obk
mir-opt: Replace clone on primitives with copy

We can't do it for everything, but it would be nice to at least stop making calls to clone methods in debug from things like derived-clones.

r? `@ghost`
2022-03-11 01:51:49 +00:00
Ralf Jung 63ed8e41ce adjust offset_from logic: check that both pointers are in-bounds 2022-03-10 18:59:58 -05:00
Dylan DPC b18b2d1bcd
Rollup merge of #94728 - compiler-errors:box-allocator-zst-meta, r=michaelwoerister
Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST

Basically copy the change in #94043, but for debuginfo.

r? ``@michaelwoerister``

Fixes #94725
2022-03-10 23:13:00 +01:00
Dylan DPC 634a6b0d25
Rollup merge of #94368 - c410-f3r:metaaaaaaaaaaaaaaaaaaaaaaaaaaa, r=petrochenkov
[1/2] Implement macro meta-variable expressions

See https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295

The logic behind `length`, `index` and `count` was removed but the parsing code is still present, i.e., everything is simply ignored like `ignored`.

r? ``@petrochenkov``
2022-03-10 23:12:58 +01:00
Dylan DPC 1ed2a94fd2
Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandry
Treat unstable lints as unknown

This change causes unstable lints to be ignored if the `unknown_lints`
lint is allowed. To achieve this, it also changes lints to apply as soon
as they are processed. Previously, lints in the same set were processed
as a batch and then all simultaneously applied.

Implementation of https://github.com/rust-lang/compiler-team/issues/469
2022-03-10 23:12:57 +01:00
Dylan DPC 5a7f09d9a3
Rollup merge of #93950 - T-O-R-U-S:use-modern-formatting-for-format!-macros, r=Mark-Simulacrum
Use modern formatting for format! macros

This updates the standard library's documentation to use the new format_args syntax.
The documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.

A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).

`eprintln!("{}", e)` becomes `eprintln!("{e}")`, but `eprintln!("{}", e.kind())` remains untouched.
2022-03-10 23:12:57 +01:00
Matthias Krüger 07e4fbde5a
Rollup merge of #94809 - durin42:llvm-15-modulepass, r=nikic
RustWrapper: add missing include

This is required after LLVM change 3c4410dfcaaf (aka
https://reviews.llvm.org/D121168) did some includes cleanup.

r? nikic
2022-03-10 19:00:12 +01:00
Matthias Krüger b41374598f
Rollup merge of #94440 - compiler-errors:issue-94282, r=lcnr
Better error for normalization errors from parent crates that use `#![feature(generic_const_exprs)]`

This PR implements a somewhat rudimentary heuristic to suggest using `#![feature(generic_const_exprs)]` in a child crate when a function from a foreign crate (that may have used `#![feature(generic_const_exprs)]`) fails to normalize during codegen.

cc: #79018
cc: #94287
2022-03-10 19:00:05 +01:00
Augie Fackler 185e3b95ca RustWrapper: add missing include
This is required after LLVM change 3c4410dfcaaf (aka
https://reviews.llvm.org/D121168) did some includes cleanup.
2022-03-10 11:16:33 -05:00