Auto merge of #132128 - workingjubilee:rollup-uwqp2i2, r=workingjubilee

Rollup of 4 pull requests

Successful merges:

 - #131457 (Expand `ptr::fn_addr_eq()` documentation.)
 - #132085 (Update StableMIR doc to reflect current status)
 - #132118 (Add support for `~const` item bounds)
 - #132125 (coverage: Emit LLVM intrinsics using the normal helper method)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors
2024-10-25 07:42:32 +00:00
20 changed files with 273 additions and 259 deletions
@@ -1,5 +1,5 @@
//@ compile-flags: -Znext-solver
//@ known-bug: unknown
//@ check-pass
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
@@ -1,15 +0,0 @@
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
--> $DIR/assoc-type-const-bound-usage-0.rs:14:5
|
LL | T::Assoc::func()
| ^^^^^^^^^^^^^^^^ types differ
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
--> $DIR/assoc-type-const-bound-usage-0.rs:18:5
|
LL | <T as Trait>::Assoc::func()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0271`.
@@ -6,18 +6,30 @@ LL | #![feature(const_trait_impl, effects, generic_const_exprs)]
|
= help: remove one of these features
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
--> $DIR/assoc-type-const-bound-usage-1.rs:15:44
error[E0284]: type annotations needed: cannot normalize `unqualified<T>::{constant#0}`
--> $DIR/assoc-type-const-bound-usage-1.rs:15:37
|
LL | fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> {
| ^^^^^^^^^^^^^^^^ types differ
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `unqualified<T>::{constant#0}`
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
--> $DIR/assoc-type-const-bound-usage-1.rs:19:42
error[E0284]: type annotations needed: cannot normalize `qualified<T>::{constant#0}`
--> $DIR/assoc-type-const-bound-usage-1.rs:19:35
|
LL | fn qualified<T: const Trait>() -> Type<{ <T as Trait>::Assoc::func() }> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `qualified<T>::{constant#0}`
error: aborting due to 3 previous errors
error[E0284]: type annotations needed: cannot normalize `unqualified<T>::{constant#0}`
--> $DIR/assoc-type-const-bound-usage-1.rs:16:5
|
LL | Type
| ^^^^ cannot normalize `unqualified<T>::{constant#0}`
For more information about this error, try `rustc --explain E0271`.
error[E0284]: type annotations needed: cannot normalize `qualified<T>::{constant#0}`
--> $DIR/assoc-type-const-bound-usage-1.rs:20:5
|
LL | Type
| ^^^^ cannot normalize `qualified<T>::{constant#0}`
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0284`.
@@ -0,0 +1,35 @@
//@ compile-flags: -Znext-solver
// Check that `~const` item bounds only hold if the where clauses on the
// associated type are also const.
// i.e. check that we validate the const conditions for the associated type
// when considering one of implied const bounds.
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#[const_trait]
trait Trait {
type Assoc<U>: ~const Trait
where
U: ~const Other;
fn func();
}
#[const_trait]
trait Other {}
const fn fails<T: ~const Trait, U: Other>() {
T::Assoc::<U>::func();
//~^ ERROR the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
<T as Trait>::Assoc::<U>::func();
//~^ ERROR the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
}
const fn works<T: ~const Trait, U: ~const Other>() {
T::Assoc::<U>::func();
<T as Trait>::Assoc::<U>::func();
}
fn main() {}
@@ -0,0 +1,15 @@
error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail-2.rs:24:5
|
LL | T::Assoc::<U>::func();
| ^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail-2.rs:26:5
|
LL | <T as Trait>::Assoc::<U>::func();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
@@ -0,0 +1,28 @@
//@ compile-flags: -Znext-solver
// Check that `~const` item bounds only hold if the parent trait is `~const`.
// i.e. check that we validate the const conditions for the associated type
// when considering one of implied const bounds.
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#[const_trait]
trait Trait {
type Assoc: ~const Trait;
fn func();
}
const fn unqualified<T: Trait>() {
T::Assoc::func();
//~^ ERROR the trait bound `T: ~const Trait` is not satisfied
<T as Trait>::Assoc::func();
//~^ ERROR the trait bound `T: ~const Trait` is not satisfied
}
const fn works<T: ~const Trait>() {
T::Assoc::func();
<T as Trait>::Assoc::func();
}
fn main() {}
@@ -0,0 +1,15 @@
error[E0277]: the trait bound `T: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail.rs:17:5
|
LL | T::Assoc::func();
| ^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `T: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail.rs:19:5
|
LL | <T as Trait>::Assoc::func();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.