Commit Graph

26 Commits

Author SHA1 Message Date
Deadbeef
47efc90366 Deny providing explicit effect params 2023-10-26 08:24:25 +00:00
David Tolnay
6a02e20fb5
Update since stability attributes in tests 2023-10-23 13:04:47 -07:00
bors
616e37919c Auto merge of - fee1-dead-contrib:dupe-those-bounds, r=oli-obk
Duplicate `~const` bounds with a non-const one in effects desugaring

This should unblock .

r? `@oli-obk`
2023-10-17 12:16:54 +00:00
Deadbeef
f0f89d6d43 Duplicate ~const bounds with a non-const one in effects desugaring 2023-10-15 08:59:38 +00:00
Michael Goulet
59315b8a63 Stabilize AFIT and RPITIT 2023-10-13 21:01:36 +00:00
Alex Macleod
5453a9f34d Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
Raekye
884af362f2 Validate ~const trait bounds on associated fns.
Previously, any associated function could have `~const` trait bounds on
generic parameters, which could lead to ICEs when these bounds were used
on associated functions of non-`#[const_trait] trait` or
non-`impl const` blocks.

Includes changes as per @fee1-dead's comments in .
2023-09-30 19:00:45 -04:00
Deadbeef
2063ebc3ea bless the known-bug tests 2023-09-20 03:02:14 +00:00
Deadbeef
04eec37dc2 Enable effects for libcore 2023-09-20 03:02:14 +00:00
Michael Goulet
5c907a7859 Fallback effects even if types also fall back 2023-09-14 21:08:42 +00:00
Deadbeef
84a490712a Implement fallback for effect param 2023-09-10 07:48:47 +00:00
Esteban Küber
ef11db803c Remove unnecessary select_obligations_where_possible and redundant errors 2023-08-26 19:35:54 +00:00
Esteban Küber
bac0e556f0 On let binding type point to type parameter that introduced unmet bound
On the following example, point at `String` instead of the whole type:

```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/own-bound-span.rs:14:24
   |
LL |     let _: <S as D>::P<String>;
   |                        ^^^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `D::P`
  --> $DIR/own-bound-span.rs:4:15
   |
LL |     type P<T: Copy>;
   |               ^^^^ required by this bound in `D::P`
```
2023-08-26 02:23:25 +00:00
Michael Goulet
13e8b13e15 Handle Self in paths too 2023-08-25 19:05:38 +00:00
Deadbeef
f441fa08da Remove constness from ImplSource::Param 2023-08-14 02:17:30 +00:00
Deadbeef
057be381c6 Fix ICE 2023-08-07 17:16:10 +00:00
Deadbeef
6c1e3bb6e9 bless tests 2023-08-06 13:34:53 +00:00
Deadbeef
92f4c59e48 lower impl const to bind to host effect param 2023-08-06 13:34:53 +00:00
Deadbeef
4fec845c3f Remove constness from TraitPredicate 2023-08-02 15:38:00 +00:00
Deadbeef
df3f9fdf5a Effects: don't print host param in diagnostics 2023-07-29 14:55:35 +00:00
Deadbeef
2d59451274 update tests, adding known-bug 2023-07-27 15:51:02 +00:00
Deadbeef
30b21b758a add test 2023-07-04 11:47:46 +00:00
bors
6fc0273b5a Auto merge of - compiler-errors:do-not-impl-via-obj, r=lcnr
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:
2f896da247/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-20 08:42:37 +00:00
Michael Goulet
ca68cf0d46 Merge attrs, better validation 2023-06-20 04:38:55 +00:00
Deadbeef
89c24af133 Better error for non const PartialEq call generated by match 2023-06-18 05:24:38 +00:00
Maybe Waffle
9d3482c403 Better group RFC ui tests together 2023-06-05 16:09:46 +00:00