about summary refs log tree commit diff
path: root/src/test/ui/union
AgeCommit message (Collapse)AuthorLines
2021-01-26Avoid describing a method as 'not found' when bounds are unsatisfiedAaron Hill-4/+4
Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
2020-12-15Auto merge of #78068 - RalfJung:union-safe-assign, r=nikomatsakisbors-31/+52
consider assignments of union field of ManuallyDrop type safe Assigning to `Copy` union fields is safe because that assignment will never drop anything. However, with https://github.com/rust-lang/rust/pull/77547, unions may also have `ManuallyDrop` fields, and their assignments are currently still unsafe. That seems unnecessary though, as assigning `ManuallyDrop` does not drop anything either, and is thus safe even for union fields. I assume this will at least require FCP.
2020-11-29Update tests to remove old numeric constantsbstrie-3/+0
Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-20needs -> might needRalf Jung-6/+6
2020-11-20adjust union access unsafety check logic to take into account Deref and the ↵Ralf Jung-9/+54
actual type of the assignment
2020-11-20consider assignments of union field of ManuallyDrop type safeRalf Jung-28/+4
2020-10-16stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union'Ralf Jung-43/+23
2020-10-11rustc_parse: More precise spans for `tuple.0.0`Vadim Petrochenkov-3/+3
2020-09-23Deduplicate errors in const to pat conversionOliver Scherer-8/+1
2020-09-13rebase falloutRalf Jung-1/+1
2020-09-13make union-drop mem::forget test meaningfulRalf Jung-4/+4
2020-09-13please tidyRalf Jung-1/+1
2020-09-13unions: test move behavior of non-Copy fieldsRalf Jung-0/+93
2020-09-05Auto merge of #75584 - RalfJung:union-no-deref, r=matthewjasperbors-0/+84
do not apply DerefMut on union field This implements the part of [RFC 2514](https://github.com/rust-lang/rfcs/blob/master/text/2514-union-initialization-and-drop.md) about `DerefMut`. Unlike described in the RFC, we only apply this warning specifically when doing `DerefMut` of a `ManuallyDrop` field; that is really the case we are worried about here. @matthewjasper suggested I patch `convert_place_derefs_to_mutable` and `convert_place_op_to_mutable` for this, but I could not find anything to do in `convert_place_op_to_mutable` and this is sufficient to make the test pass. However, maybe there are some other cases this misses? I have no familiarity with this code. This is a breaking change *in theory*, if someone used `ManuallyDrop<T>` in a union field and relied on automatic `DerefMut`. But on stable this means `T: Copy`, so the `ManuallyDrop` is rather pointless. Cc https://github.com/rust-lang/rust/issues/55149
2020-09-02pretty: trim paths of unique symbolsDan Aloni-25/+25
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-31test more ways of mutably accessing a placeRalf Jung-1/+45
2020-08-31only emit error for ManuallyDrop derefsRalf Jung-8/+9
2020-08-31also detect DerefMut in nested union fieldsRalf Jung-4/+19
2020-08-31do not apply DerefMut on union fieldRalf Jung-0/+24
2020-07-27mv std libs to library/mark-3/+3
2020-07-14Rollup merge of #74228 - estebank:unsized-param, r=davidtwcoManish Goregaokar-16/+53
Provide structured suggestion on unsized fields and fn params * Suggest borrowing or boxing unsized fields * Suggest borrowing fn parameters * Remove some verbosity of unsized errors * Remove `on_unimplemented` note from `trait Sized` Fix #23286, fix #28653. r? @davidtwco
2020-07-14Reword messageEsteban Küber-5/+5
2020-07-14Remove redundant explanatory `note` for type parametersEsteban Küber-3/+0
2020-07-14Remove `Sized` `on_unimplemented` noteEsteban Küber-5/+0
2020-07-14Suggest boxing or borrowing unsized fieldsEsteban Küber-8/+53
2020-07-12Detect tuple struct incorrectly used as struct patEsteban Küber-6/+6
2020-06-10review comments: only suggest one substitutionEsteban Küber-5/+1
2020-06-10On recursive ADT, provide indirection structured suggestionEsteban Küber-2/+9
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-2/+10
Keep more information about trait binding failures.
2020-04-02tests: remove ignore directives from tests that mention core/alloc/std spans.Eduard-Mihai Burtescu-7/+2
2020-03-24Rollup merge of #70077 - Aaron1011:feature/new-def-path-ident, r=petrochenkovMazdak Farrokhzad-2/+15
Store idents for `DefPathData` into crate metadata Previously, we threw away the `Span` associated with a definition's identifier when we encoded crate metadata, causing us to lose location and hygiene information. We now store the identifier's `Span` in a side table, which gets encoded into the crate metadata. When we decode items from the metadata, we combine the name and span back into an `Ident`. This improves the output of several tests, which previously had messages suppressed due to dummy spans. This is a prerequisite for #68686, since throwing away a `Span` means that we lose hygiene information.
2020-03-23Ignore tests on some platforms due to #53081Aaron Hill-2/+7
2020-03-22Store idents for `DefPathData` into crate metadataAaron Hill-0/+8
Previously, we threw away the `Span` associated with a definition's identifier when we encoded crate metadata, causing us to lose location and hygiene information. We now store the identifier's `Span` in the crate metadata. When we decode items from the metadata, we combine the name and span back into an `Ident`. This improves the output of several tests, which previously had messages suppressed due to dummy spans. This is a prerequisite for #68686, since throwing away a `Span` means that we lose hygiene information.
2020-03-22Add span label to primary error spanEsteban Küber-1/+1
2020-03-22Increase verbosity when suggesting subtle code changesEsteban Küber-2/+7
2020-02-28Do not suggest implementing traits if present in predicatesEsteban Küber-3/+0
2020-02-28Review comments: split requirement text to multiple lines for readabilityEsteban Küber-1/+2
2020-02-28Show information of chain of bound obligationsEsteban Küber-2/+5
When the obligation that couldn't be fulfilled is specific to a nested obligation, maintain both the nested and parent obligations around for more accurate and detailed error reporting.
2020-02-28Track all predicates in errors, not just trait obligationsEsteban Küber-1/+3
Surface associated type projection bounds that could not be fulfilled in E0599 errors. Always present the list of unfulfilled trait bounds, regardless of whether we're pointing at the ADT or trait that didn't satisfy it.
2020-02-28Deduplicate information in E0599Esteban Küber-3/+1
2020-02-28Reduce vebosity of E0599Esteban Küber-5/+1
2020-02-28Add more context to E0599 errorsEsteban Küber-2/+9
Point at the intermediary unfullfilled trait bounds.
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-0/+2
2020-02-02Account for `?Sized` type parameter boundsEsteban Küber-3/+3
2020-01-24Normalise notes with the/isvarkor-4/+4
2020-01-11Rollup merge of #68014 - estebank:unify-e0599, r=cramertjYuki Okushi-2/+2
Unify output of "variant not found" errors Fix #49566.
2020-01-09Update testsVadim Petrochenkov-1/+8
2020-01-08Unify output of "variant not found" errorsEsteban Küber-2/+2
2019-11-16Use "field is never read" instead of "field is never used"cosine-10/+10
2019-10-21Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJungMazdak Farrokhzad-167/+346
Change untagged_unions to not allow union fields with drop This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass. Change untagged_unions to not allow union fields with drop Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar). The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature. Tracking issue: https://github.com/rust-lang/rust/issues/55149