summary refs log tree commit diff
path: root/tests/ui/transmutability
AgeCommit message (Collapse)AuthorLines
2024-06-03Mark all extraneous generic args as errorsOli Scherer-19/+2
2024-05-09Fix test problems discovered by the revision checkZalathar-3/+2
Most of these changes either add revision names that were apparently missing, or explicitly mark a revision name as currently unused.
2024-04-08Compute transmutability from `rustc_target::abi::Layout`Jack Wrenn-520/+611
In its first step of computing transmutability, `rustc_transmutability` constructs a byte-level representation of type layout (`Tree`). Previously, this representation was computed for ADTs by inspecting the ADT definition and performing our own layout computations. This process was error-prone, verbose, and limited our ability to analyze many types (particularly default-repr types). In this PR, we instead construct `Tree`s from `rustc_target::abi::Layout`s. This helps ensure that layout optimizations are reflected our analyses, and increases the kinds of types we can now analyze, including: - default repr ADTs - transparent unions - `UnsafeCell`-containing types Overall, this PR expands the expressvity of `rustc_transmutability` to be much closer to the transmutability analysis performed by miri. Future PRs will work to close the remaining gaps (e.g., support for `Box`, raw pointers, `NonZero*`, coroutines, etc.).
2024-03-15Safe Transmute: lowercase diagnosticsJack Wrenn-153/+153
2024-03-15Safe Transmute: Use 'not yet supported', not 'unspecified' in errorsJack Wrenn-26/+26
We can (and will) support analyzing the transmutability of types whose layouts aren't completely specified by its repr. This change ensures that the error messages remain sensible after this support lands.
2024-03-13safe transmute: require that src referent is smaller than dstJack Wrenn-2/+76
The source referent absolutely must be smaller than the destination referent of a ref-to-ref transmute; the excess bytes referenced cannot arise from thin air, even if those bytes are uninitialized.
2024-03-11Remove some unnecessary allow(incomplete_features)Michael Goulet-230/+228
2024-03-10Ignore tests w/ current/next revisions from compare-mode=next-solverMichael Goulet-236/+239
2024-02-27safe transmute: revise safety analysisJack Wrenn-1789/+1291
Migrate to a simplified safety analysis that does not use visibility. Closes https://github.com/rust-lang/project-safe-transmute/issues/15
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-39/+39
2024-02-14Continue compilation after check_mod_type_wf errorsOli Scherer-5/+20
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-1/+1
Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-13Bless testsGeorge-lewis-0/+2
Update tests
2024-01-10Rollup merge of #119772 - oli-obk:whackamole, r=compiler-errorsMatthias Krüger-0/+47
Fix an ICE that occurs after an error has already been reported fixes #117491 cc `@jswrenn`
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-1/+18
2024-01-09Fix an ICE that occurs after an error has already been reportedOli Scherer-0/+47
2023-12-14update use of feature flagslcnr-4/+4
2023-11-24Show number in error message even for one errorNilstrieb-23/+23
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-08-02Replace old private-in-public diagnostic with type privacy lintsBryanskiy-18/+28
2023-07-18Auto merge of #113677 - bryangarza:unevaluated-const-ice_issue-110892, ↵bors-0/+76
r=davidtwco Safe Transmute: Fix ICE (due to UnevaluatedConst) This patch updates the code that looks at the `Assume` type when evaluating if transmutation is possible. An ICE was being triggered in the case that the `Assume` parameter contained an unevaluated const (in this test case, due to a function with missing parameter names). Fixes #110892
2023-07-17Safe Transmute: Fix ICE (due to UnevaluatedConst)Bryan Garza-0/+76
This patch updates the code that looks at the `Assume` type when evaluating if transmutation is possible. An ICE was being triggered in the case that the `Assume` parameter contained an unevaluated const (in this test case, due to a function with missing parameter names). Fixes #110892
2023-06-29Enable co-induction support for Safe TransmuteBryan Garza-56/+4
This patch adds the `#[rustc_coinductive]` annotation to `BikeshedIntrinsicFrom`, so that it's possible to compute transmutability for recursive types.
2023-06-12Safe Transmute: Refactor error handling and Answer typeBryan Garza-3/+19
- Create `Answer` type that is not just a type alias of `Result` - Remove a usage of `map_layouts` to make the code easier to read - Don't hide errors related to Unknown Layout when computing transmutability
2023-06-07Safe Transmute: Disable coinduction supportBryan Garza-4/+56
This patch just removes the `#[rustc_coinductive]` annotation from `BikeshedIntrinsicFrom` and flips the related tests to `check-fail`. Once an FCP for setting the annotation on the trait is approved, it could be enabled again.
2023-05-24Safe Transmute: Update definition of Condition typeBryan Garza-2/+2
- Change `Condition` to not contain `Answer`s but instead just contain other `Condition`s directly. - Also improve error reporting for `DstHasStricterAlignment`
2023-05-24Safe Transmute: Check mutability before creating dst -> src obligationBryan Garza-51/+81
- Only create dst -> src obligation if Dst is mutable - Add some long comments to explain parts of the transmutability code that were unclear to me when reading - Update/add tests
2023-05-24Safe Transmute: Add alignment testsBryan Garza-0/+76
2023-05-24Safe Transmute: Fix propagation of errorsBryan Garza-33/+33
- Make sure that the most specific Reason is the one that bubbles up when we are folding over the `Answer` tree. `Reason::DstIsBitIncompatible` is the least specific, so that should be used only when there isn't anything else available. - Small fixes where we used the wrong Reason variant. - Tiny cleanups
2023-05-24Safe Transmute: Enable handling references, including recursive typesBryan Garza-45/+215
This patch enables support for references in Safe Transmute, by generating nested obligations during trait selection. Specifically, when we call `confirm_transmutability_candidate(...)`, we now recursively traverse the `rustc_transmute::Answer` tree and create obligations for all the `Answer` variants, some of which include multiple nested `Answer`s. Also, to handle recursive types, enable support for coinduction for the Safe Transmute trait (`BikeshedIntrinsicFrom`) by adding the `#[rustc_coinduction]` annotation. Also fix some small logic issues when reducing the `or` and `and` combinations in `rustc_transmute`, so that we don't end up with additional redundant `Answer`s in the tree. Co-authored-by: Jack Wrenn <jack@wrenn.fyi>
2023-04-18Fix ICE for transmutability in candidate assemblyBryan Garza-0/+17
Don't skip transmutability check just because there may be generics in the ParamEnv. Fixes #110467
2023-04-16Erase regions when confirming transmutability candidateMichael Goulet-4/+49
2023-04-13Improve safe transmute error reportingBryan Garza-534/+356
This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-10testsMichael Goulet-121/+1117
2023-03-23Note type mismatch on ConstArgHasTypeMichael Goulet-1/+1
2023-03-09Use param's real type in try_eval_lit_or_paramMichael Goulet-6/+8
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-2/+2
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-21Specify what 'this' actually isMichael Goulet-118/+118
2023-01-30Modify primary span label for E0308Esteban Küber-1/+1
The previous output was unintuitive to users.
2023-01-12Render missing generics suggestion verboselyMichael Goulet-6/+10
2023-01-11Move /src/test to /testsAlbert Larsan-0/+4698