about summary refs log tree commit diff
path: root/tests/ui/unsized
AgeCommit message (Collapse)AuthorLines
2023-12-14update use of feature flagslcnr-2/+2
2023-11-24Show number in error message even for one errorNilstrieb-13/+13
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-01Remove a false statement from Unsize docs, add a testMichael Goulet-0/+29
2023-10-30Improve some diagnostics around `?Trait` boundsOli Scherer-10/+10
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-6/+39
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-09-13fix: skip opt if body has tainted errorbohan-0/+32
2023-09-10Point out if a local trait has no implementationsMichael Goulet-0/+5
2023-09-08fix: return ealry when has tainted in mir-lintbohan-0/+30
2023-08-26Point at appropriate type parameter in more trait bound errorsEsteban Küber-8/+4
2023-08-15Separate consider_unsize_to_dyn_candidate from other unsize candidatesMichael Goulet-0/+2
2023-06-20Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnrbors-2/+23
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code. Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above. The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits: https://github.com/rust-lang/rust/blob/2f896da247e0ee8f0bef7cd7c54cfbea255b9f68/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L61-L132 However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well. r? `@lcnr`
2023-06-20Add rustc_do_not_implement_via_objectMichael Goulet-2/+23
2023-06-15change `std::marker::Sized` to just `Sized`Lukas Markeffsky-36/+36
2023-05-18Remove return type sized check hack from hir typeckMichael Goulet-23/+2
2023-05-18Simplify suggestion when returning bare dyn traitMichael Goulet-17/+18
2023-05-12Note base types of coercionMichael Goulet-8/+8
2023-02-21Specify what 'this' actually isMichael Goulet-1/+1
2023-02-15Fix unintentional UB in ui testsBen Kimock-2/+2
2023-01-30Modify primary span label for E0308Esteban Küber-2/+2
The previous output was unintuitive to users.
2023-01-11Move /src/test to /testsAlbert Larsan-0/+2325