rust/tests
Guillaume Gomez f4d06256d8
Rollup merge of #119721 - compiler-errors:constness-implication, r=fee1-dead
`~const` trait and projection bounds do not imply their non-const counterparts

This PR removes the hack where we install a non-const trait and projection bound for every `const_trait` and `~const` projection bound we have in the AST. It ends up messing up more things than it fixes, see words below.

Fixes #119718

cc `@fmease` `@fee1-dead` `@oli-obk`
r? fee1-dead or one of y'all i don't care

---

My understanding is that this hack was added to support the following code:

```rust
pub trait Owo<X = <Self as Uwu>::T> {}

#[const_trait]
pub trait Uwu: Owo {}
```

Which is concretely lifted from in the `FromResidual` and `Try` traits. Since within the param-env of `trait Uwu`, we only know that `Self: ~const Uwu` and not `Self: Uwu`, the projection `<Self as Uwu>::T` is not satsifyable.

This causes problems such as #119718, since instantiations of `FnDef` types coming from `const fn` really do **only** implement one of `FnOnce` or `const FnOnce`!

---

In the long-term, I believe that such code should really look something more like:

```rust
#[const_trait]
pub trait Owo<X = <Self as ~const Uwu>::T> {}

#[const_trait]
pub trait Uwu: Owo {}
```

... and that we should introduce some sort of `<T as ~const Foo>::Bar` bound syntax, since due to the fact that `~const` bounds can be present in item bounds, e.g.

```rust
#[const_trait] trait Foo { type Bar: ~const Destruct; }
```

It's easy to see that `<T as Foo>::Bar` and `<T as ~const Foo>::Bar` (or `<T as const Foo>::Bar`) can be distinct types with distinct item bounds!

**Admission**: I know I've said before that I don't like `~const` projection syntax, I do at this point believe they're necessary to fully express bounds and types in a maybe-const world.
2024-01-09 17:52:21 +01:00
..
assembly Support reg_addr register class in s390x inline assembly 2024-01-03 18:00:37 +09:00
auxiliary
codegen mark vec::IntoIter pointers as !nonnull 2024-01-07 03:44:04 +01:00
codegen-units Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
coverage coverage: llvm-cov expects column numbers to be bytes, not code points 2024-01-08 21:58:46 +11:00
coverage-run-rustdoc
debuginfo Improved support of collapse_debuginfo attribute for macros. 2024-01-08 17:47:18 +07:00
incremental Disable opt in incremental test. 2023-12-24 20:08:58 +00:00
mir-opt Rollup merge of #119699 - cjgillot:simplify-unreachable, r=oli-obk 2024-01-09 13:23:18 +01:00
pretty Make some non-diagnostic-affecting QPath::LangItem into regular qpaths 2023-12-26 04:07:38 +00:00
run-make tests: Normalize \r\n to \n in some run-make tests 2024-01-06 18:46:35 +03:00
run-make-fulldeps Auto merge of #118899 - veera-sivarajan:fix-makefile, r=Mark-Simulacrum 2024-01-05 07:42:03 +00:00
run-pass-valgrind
rustdoc Rollup merge of #119216 - weiznich:use_diagnostic_namespace_in_stdlib, r=compiler-errors 2024-01-05 23:41:41 -05:00
rustdoc-gui rustdoc ui: adjust tooltip z-index to be above sidebar 2023-12-31 20:31:56 +01:00
rustdoc-js Rollup merge of #118194 - notriddle:notriddle/tuple-unit, r=GuillaumeGomez 2024-01-06 16:07:46 +01:00
rustdoc-js-std Rollup merge of #118194 - notriddle:notriddle/tuple-unit, r=GuillaumeGomez 2024-01-06 16:07:46 +01:00
rustdoc-json Add regression test for is_object_safe field on traits 2023-12-23 19:00:17 +01:00
rustdoc-ui Rollup merge of #119148 - estebank:bare-traits, r=davidtwco 2024-01-05 10:57:20 -05:00
ui Rollup merge of #119721 - compiler-errors:constness-implication, r=fee1-dead 2024-01-09 17:52:21 +01:00
ui-fulldeps Rollup merge of #119655 - Nilstrieb:cleanup-the-error-count-monster-mess, r=WaffleLapkin 2024-01-06 16:07:49 +01:00
COMPILER_TESTS.md