diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/const-generics/occurs-check | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/const-generics/occurs-check')
15 files changed, 0 insertions, 215 deletions
diff --git a/src/test/ui/const-generics/occurs-check/bind-param.rs b/src/test/ui/const-generics/occurs-check/bind-param.rs deleted file mode 100644 index ee4244051..000000000 --- a/src/test/ui/const-generics/occurs-check/bind-param.rs +++ /dev/null @@ -1,17 +0,0 @@ -// build-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// This test does not use any "unevaluated" consts, so it should compile just fine. - -fn bind<const N: usize>(value: [u8; N]) -> [u8; N] { - todo!() -} - -fn sink(_: [u8; 5]) {} - -fn main() { - let mut arr = Default::default(); - arr = bind(arr); - sink(arr); -} diff --git a/src/test/ui/const-generics/occurs-check/unify-fixpoint.rs b/src/test/ui/const-generics/occurs-check/unify-fixpoint.rs deleted file mode 100644 index e6f8e4ad3..000000000 --- a/src/test/ui/const-generics/occurs-check/unify-fixpoint.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] //~ WARN the feature `generic_const_exprs` is incomplete - - -fn bind<const N: usize>(value: [u8; N + 2]) -> [u8; N * 2] { - todo!() -} - -fn main() { - let mut arr = Default::default(); - arr = bind::<2>(arr); -} diff --git a/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr b/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr deleted file mode 100644 index fe3f24a67..000000000 --- a/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unify-fixpoint.rs:2:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/occurs-check/unify-n-nplusone.rs b/src/test/ui/const-generics/occurs-check/unify-n-nplusone.rs deleted file mode 100644 index c6324bca1..000000000 --- a/src/test/ui/const-generics/occurs-check/unify-n-nplusone.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// This test would tries to unify `N` with `N + 1` which must fail the occurs check. - -fn bind<const N: usize>(value: [u8; N]) -> [u8; N + 1] { - todo!() -} - -fn sink(_: [u8; 5]) {} - -fn main() { - let mut arr = Default::default(); - arr = bind(arr); //~ ERROR mismatched types - sink(arr); -} diff --git a/src/test/ui/const-generics/occurs-check/unify-n-nplusone.stderr b/src/test/ui/const-generics/occurs-check/unify-n-nplusone.stderr deleted file mode 100644 index 6b8e688fb..000000000 --- a/src/test/ui/const-generics/occurs-check/unify-n-nplusone.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/unify-n-nplusone.rs:14:11 - | -LL | arr = bind(arr); - | ^^^^^^^^^ encountered a self-referencing constant - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.rs b/src/test/ui/const-generics/occurs-check/unused-substs-1.rs deleted file mode 100644 index 9d12250c9..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-1.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Bar<const M: usize> {} -impl<const N: usize> Bar<N> for A<{ 6 + 1 }> {} - -struct A<const N: usize> -where - A<N>: Bar<N>; - -fn main() { - let _ = A; //~ERROR the trait bound -} diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr deleted file mode 100644 index a3c011d92..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied - --> $DIR/unused-substs-1.rs:12:13 - | -LL | let _ = A; - | ^ the trait `Bar<_>` is not implemented for `A<_>` - | - = help: the trait `Bar<N>` is implemented for `A<7>` -note: required by a bound in `A` - --> $DIR/unused-substs-1.rs:9:11 - | -LL | struct A<const N: usize> - | - required by a bound in this -LL | where -LL | A<N>: Bar<N>; - | ^^^^^^ required by this bound in `A` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-2.rs b/src/test/ui/const-generics/occurs-check/unused-substs-2.rs deleted file mode 100644 index 9b1212694..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// The goal is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst. -// -// If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>` we introduced an -// artificial inference cycle. -struct Foo<const N: usize>; - -trait Bind<T> { - fn bind() -> (T, Self); -} - -// `N` has to be `ConstKind::Unevaluated`. -impl<T> Bind<T> for Foo<{ 6 + 1 }> { - fn bind() -> (T, Self) { - (panic!(), Foo) - } -} - -fn main() { - let (mut t, foo) = Foo::bind(); - // `t` is `ty::Infer(TyVar(_#1t))` - // `foo` contains `ty::Infer(TyVar(_#1t))` in its substs - t = foo; - //~^ ERROR mismatched types - //~| NOTE cyclic type -} diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-2.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-2.stderr deleted file mode 100644 index 9532fc21a..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/unused-substs-2.rs:25:9 - | -LL | t = foo; - | ^^^ cyclic type of infinite size - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-3.rs b/src/test/ui/const-generics/occurs-check/unused-substs-3.rs deleted file mode 100644 index d5aeab47e..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-3.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// The goal is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst. -// -// If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>` we introduced an -// artificial inference cycle. -fn bind<T>() -> (T, [u8; 6 + 1]) { - todo!() -} - -fn main() { - let (mut t, foo) = bind(); - // `t` is `ty::Infer(TyVar(_#1t))` - // `foo` contains `ty::Infer(TyVar(_#1t))` in its substs - t = foo; - //~^ ERROR mismatched types - //~| NOTE cyclic type -} diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-3.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-3.stderr deleted file mode 100644 index fd8f8b269..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-3.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/unused-substs-3.rs:16:9 - | -LL | t = foo; - | ^^^- help: try using a conversion method: `.to_vec()` - | | - | cyclic type of infinite size - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-4.rs b/src/test/ui/const-generics/occurs-check/unused-substs-4.rs deleted file mode 100644 index 03c2f5486..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-4.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn bind<const N: usize>(value: [u8; N]) -> [u8; 3 + 4] { - todo!() -} - -fn main() { - let mut arr = Default::default(); - arr = bind(arr); //~ ERROR mismatched type -} diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-4.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-4.stderr deleted file mode 100644 index 5685eedbd..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-4.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/unused-substs-4.rs:10:11 - | -LL | arr = bind(arr); - | ^^^^^^^^^ encountered a self-referencing constant - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-5.rs b/src/test/ui/const-generics/occurs-check/unused-substs-5.rs deleted file mode 100644 index 383ab4cd8..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-5.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// `N + 1` also depends on `T` here even if it doesn't use it. -fn q<T, const N: usize>(_: T) -> [u8; N + 1] { - todo!() -} - -fn supplier<T>() -> T { - todo!() -} - -fn catch_me<const N: usize>() where [u8; N + 1]: Default { - let mut x = supplier(); - x = q::<_, N>(x); //~ ERROR mismatched types -} - -fn main() { - catch_me::<3>(); -} diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr deleted file mode 100644 index be289f44f..000000000 --- a/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/unused-substs-5.rs:15:9 - | -LL | x = q::<_, N>(x); - | ^^^^^^^^^^^^- help: try using a conversion method: `.to_vec()` - | | - | cyclic type of infinite size - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. |