about summary refs log tree commit diff
path: root/tests/ui/cast
AgeCommit message (Collapse)AuthorLines
2024-09-24use more accurate spans for user type ascriptionsLukas Markeffsky-4/+4
2024-09-24add another testLukas Markeffsky-1/+14
2024-08-27Arbitrary self types v2: pointers feature gate.Adrian Taylor-1/+1
The main `arbitrary_self_types` feature gate will shortly be reused for a new version of arbitrary self types which we are amending per [this RFC](https://github.com/rust-lang/rfcs/blob/master/text/3519-arbitrary-self-types-v2.md). The main amendments are: * _do_ support `self` types which can't safely implement `Deref` * do _not_ support generic `self` types * do _not_ support raw pointers as `self` types. This PR relates to the last of those bullet points: this strips pointer support from the current `arbitrary_self_types` feature. We expect this to cause some amount of breakage for crates using this unstable feature to allow raw pointer self types. If that's the case, we want to know about it, and we want crate authors to know of the upcoming changes. For now, this can be resolved by adding the new `arbitrary_self_types_pointers` feature to such crates. If we determine that use of raw pointers as self types is common, then we may maintain that as an unstable feature even if we come to stabilize the rest of the `arbitrary_self_types` support in future. If we don't hear that this PR is causing breakage, then perhaps we don't need it at all, even behind an unstable feature gate. [Tracking issue](https://github.com/rust-lang/rust/issues/44874) This is [step 4 of the plan outlined here](https://github.com/rust-lang/rust/issues/44874#issuecomment-2122179688)
2024-08-14Rollup merge of #128759 - notriddle:notriddle/spec-to-string, ↵Matthias Krüger-0/+3
r=workingjubilee,compiler-errors alloc: add ToString specialization for `&&str` Fixes #128690
2024-08-13diagnostics: use `DeepRejectCtxt` for checkMichael Howell-0/+3
This makes more things match, particularly applicable blankets.
2024-08-11Normalize struct tail properly in borrowck and hir typeckMichael Goulet-1/+19
2024-08-05Normalize when equating dyn tails in MIR borrowckMichael Goulet-0/+21
2024-07-14Use ordinal number in argument errorlong-long-float-1/+1
Fix error message Fix tests Format
2024-07-07Allow casting `*mut dyn T`->`*mut (dyn T + Send)` if `T` has `Send` super traitMaybe Lapkin-0/+9
2024-07-05Equate types instead of using `Unsize`Maybe Lapkin-26/+27
2024-07-04Sort trait names before printingMaybe Lapkin-3/+3
2024-07-04Properly normalize types in bck when checking pointer castsMaybe Lapkin-0/+42
2024-07-04Fill in tracking issueMaybe Lapkin-4/+4
2024-07-04Use `DiagSymbolList` for a lint diagnosticMaybe Lapkin-1/+28
2024-07-04Align the changes to the lang decisionMaybe Lapkin-7/+21
2024-07-04Actually check that the traits are the same for casting pointers to dyn _Waffle Lapkin-5/+31
2024-07-04test blessingWaffle Lapkin-11/+10
2024-07-04blessingsMaybe Waffle-8/+2
2024-07-04Add more checks for pointers with vtable metaMaybe Waffle-29/+205
The rules for casting `*mut X<dyn A>` -> `*mut Y<dyn B>` are as follows: - If `B` has a principal - `A` must have exactly the same principal (including generics) - Auto traits of `B` must be a subset of autotraits in `A` Note that `X<_>` and `Y<_>` can be identity, or arbitrary structs with last field being the dyn type. The lifetime of the trait object itself (`dyn ... + 'a`) is not checked. This prevents a few soundness issues with `#![feature(arbitrary_self_types)]` and trait upcasting. Namely, these checks make sure that vtable is always valid for the pointee.
2024-07-04Add tests for `*const Trait<'a>` -> `*const Trait<'b>` and similar castsMaybe Waffle-0/+99
2024-07-04Forbid casts of raw pointers to trait objects with the same trait, but ↵Maybe Waffle-16/+28
different args
2024-07-04Add a test for `*const Tr<A>` to `*const Tr<B>` castsMaybe Waffle-0/+41
2024-05-11FIx ICE while casting a type with errorGurinder Singh-0/+81
2024-04-21Miri: detect wrong vtables in wide pointersRalf Jung-1/+1
2024-03-19add test for casting pointer to union with unsized tailLukas Markeffsky-0/+37
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-17/+17
2024-02-12Lint on reference casting to bigger underlying allocationUrgau-6/+6
2024-02-09Emit more specific diagnostics when enums fail to cast with `as`Gurinder Singh-1/+84
2024-02-07Update testsr0cky-2/+24
2023-12-20Update existing testsVeera-1/+1
2023-12-20fix: diagnostic for casting reference to sliceVeera-0/+27
fixes: #118790
2023-11-24Show number in error message even for one errorNilstrieb-14/+14
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-25Never consider raw pointer casts to be trivalNilstrieb-0/+24
HIR typeck tries to figure out which casts are trivial by doing them as coercions and seeing whether this works. Since HIR typeck is oblivious of lifetimes, this doesn't work for pointer casts that only change the lifetime of the pointee, which are, as borrowck will tell you, not trivial. This change makes it so that raw pointer casts are never considered trivial. This also incidentally fixes the "trivial cast" lint false positive on the same code. Unfortunately, "trivial cast" lints are now never emitted on raw pointer casts, even if they truly are trivial. This could be fixed by also doing the lint in borrowck for raw pointers specifically.
2023-09-22make unsized cast illegalouz-a-0/+15
2023-09-18Migrate 'cast to bool' diagnosticclubby789-7/+32
2023-09-11add source type for invalid bool castsasquared31415-8/+92
2023-01-15suggest `is_empty` for collections when casting to `bool`Ezra Shaw-3/+97
2023-01-11Move /src/test to /testsAlbert Larsan-0/+1172