summary refs log tree commit diff
path: root/src/test/ui/union
AgeCommit message (Collapse)AuthorLines
2022-07-17use body's param-env when checking if type needs dropMichael Goulet-0/+21
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-34/+34
r=cjgillot gather body owners Issue #96341
2022-07-13add array tests, cleanup, tidy, and blessRalf Jung-8/+27
2022-07-13assigning to a union field can never drop nowRalf Jung-19/+3
2022-07-13remove untagged_union feature gateRalf Jung-187/+283
2022-07-13use gathered body_owners in par_body_ownersMiguel Guarniz-34/+34
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-07Track implicit `Sized` obligations in type paramsEsteban Küber-4/+4
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting the HIR Generics. (Fix #98539)
2022-07-01Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkovbors-6/+4
Shorten def_span for more items. The `def_span` query only returns the signature span for functions. Struct/enum/union definitions can also have a very long body. This PR shortens the associated span.
2022-07-01Shorten def_span for more items.Camille GILLOT-6/+4
2022-07-01Auto merge of #98402 - cjgillot:undead, r=michaelwoeristerbors-10/+10
Rewrite dead-code pass to avoid fetching HIR. This allows to get a more uniform handling of spans, and to simplify the grouping of diagnostics for variants and fields.
2022-06-27Rollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, r=jackh726Matthias Krüger-15/+5
Check ADT field is well-formed before checking it is sized Fixes #96810. There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related. We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.
2022-06-25Rollup merge of #98298 - TaKO8Ki:point-to-type-param-definition, ↵Matthias Krüger-4/+4
r=compiler-errors Point to type parameter definition when not finding variant, method and associated item fixes #77391
2022-06-22Uniform spans in dead code lint.Camille GILLOT-10/+10
2022-06-22point to type param definition when not finding variant, method and assoc typeTakayuki Maeda-4/+4
use `def_ident_span` , `body_owner_def_id` instead of `in_progress_typeck_results`, `guess_head_span` use `body_id.owner` directly add description to label
2022-06-19collapse dead code warnings into a single diagnosticTakayuki Maeda-17/+43
add comments in `store_dead_field_or_variant` support multiple log level add a item ident label fix ui tests fix a ui test fix a rustdoc ui test use let chain refactor: remove `store_dead_field_or_variant` fix a tiny bug
2022-06-16diagnostics: fix trailing spaceklensy-3/+3
2022-06-05Do wfcheck on ADT field before Sized checkMichael Goulet-15/+5
2022-06-03Tighten spans for bad fields in Copy structMichael Goulet-2/+2
2022-04-05Suggest derivable trait on E0277ohno418-0/+16
2022-03-24Auto merge of #91030 - estebank:trait-bounds-are-tricky-2, r=oli-obkbors-0/+10
Properly track `ImplObligations` Instead of probing for all possible `impl`s that could have caused an `ImplObligation`, keep track of its `DefId` and obligation spans for accurate error reporting. Follow to #89580. Addresses #89418.
2022-03-24Properly track `ImplObligation`sEsteban Kuber-0/+10
Instead of probing for all possible impls that could have caused an `ImplObligation`, keep track of its `DefId` and obligation spans for accurate error reporting. Follow up to #89580. Addresses #89418. Remove some unnecessary clones. Tweak output for auto trait impl obligations.
2022-03-22better errors when a Copy impl is not coherentMichael Goulet-0/+6
2022-02-17Rollup merge of #94031 - ↵Matthias Krüger-21/+29
danielhenrymantilla:diagnostics/union-drop-suggest-copy-bound-alternative, r=davidtwco [diagnostics] Add mentions to `Copy` types being valid for `union` fields This came up from some user on Discord which was using a `T : PrimitiveInt` generic type, and they wanted to use in a `union`. Rather than adding a `Copy` bound, they started pondering about the `ManuallyDrop<T>` road, and how to correctly use `unsafe` to perform the drops. <img width="648" alt="Screen Shot 2022-02-15 at 22 28 34" src="https://user-images.githubusercontent.com/9920355/154152496-8f9be74b-ad59-4724-8f9e-48b446774e06.png"> - [Discord link](https://discord.com/channels/442252698964721669/443150878111694848/943092778534072320) So, it seemed like the error message for types with potential drop glue on `union` fields could be improved to also mention the `Copy` alternative, since in many cases where `union`s are concerned, people are dealing with PODs / `Copy` types anyways 🙂 ___ ``@rustbot`` modify labels: +A-diagnostics +D-terse
2022-02-16Add mentions to `Copy` for `union` fieldsDaniel Henry-Mantilla-21/+29
2022-02-16Make implementation genericLucas Kent-4/+4
2021-12-02use try_normalize_erasing_regions in needs_dropb-naber-0/+50
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-12/+12
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-15feedbackLucas Kent-8/+8
2021-11-15Improve ManuallyDrop suggestionLucas Kent-32/+24
2021-09-06Suggest deriving traits if possiblePaul Trojahn-0/+8
This only applies to builtin derives as I don't think there is a clean way to get the available derives in typeck. Closes #85851
2021-09-01Stop sorting bodies by span.Camille GILLOT-26/+26
The definition order is already close to the span order, and only differs in corner cases.
2021-08-25Fix debugger stepping behavior around `match` expressionsWesley Wiser-2/+2
Previously, we would set up the source lines for `match` expressions so that the code generated to perform the test of the scrutinee was matched to the line of the arm that required the test and then jump from the arm block to the "next" block was matched to all of the lines in the `match` expression. While that makes sense, it has the side effect of causing strange stepping behavior in debuggers. I've changed the source information so that all of the generated tests are sourced to `match {scrutinee}` and the jumps are sourced to the last line of the block they are inside. This resolves the weird stepping behavior in all debuggers and resolves some instances of "ambiguous symbol" errors in WinDbg preventing the user from setting breakpoints at `match` expressions.
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-16Use note to point at bound introducing requirementEsteban Küber-12/+12
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-2/+2
2021-08-11Modify structured suggestion outputEsteban Küber-23/+26
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-08Auto merge of #87697 - GuillaumeGomez:add-e0784, r=nagisabors-10/+10
Assign E0784 error code for union expression errors
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-4/+4
2021-08-03Test dropping union fields moreSmitty-22/+3
2021-08-02Update UI testsGuillaume Gomez-10/+10
2021-07-30Do not discard `?Sized` type params and suggest their removalEsteban Küber-0/+12
2021-07-27Update testsJacob Pratt-3/+1
2021-07-23Implement `AssignToDroppingUnionField` in THIR unsafeckLeSeulArtichaut-3/+19
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-12/+30
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-09Check for union field accesses in THIR unsafeckSmitty-65/+707
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-2/+2
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-09remove const_fn feature gateRalf Jung-2/+0
2021-04-10Expand derive invocations in left-to-right orderAaron Hill-18/+18
While derives were being collected in left-to-order order, the corresponding `Invocation`s were being pushed in the wrong order.
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-7/+6
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-03-31give full path of constraint in suggest_constraining_type_paramhi-rustin-3/+3
revert file bless with nll mode