summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/issues
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-generics/issues')
-rw-r--r--tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-63322-forbid-dyn.rs2
-rw-r--r--tests/ui/const-generics/issues/issue-67185-2.stderr12
-rw-r--r--tests/ui/const-generics/issues/issue-70273-assoc-fn.rs2
-rw-r--r--tests/ui/const-generics/issues/issue-71381.full.stderr17
-rw-r--r--tests/ui/const-generics/issues/issue-71381.rs10
-rw-r--r--tests/ui/const-generics/issues/issue-71611.full.stderr11
-rw-r--r--tests/ui/const-generics/issues/issue-71611.rs4
-rw-r--r--tests/ui/const-generics/issues/issue-74255.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74255.rs4
-rw-r--r--tests/ui/const-generics/issues/issue-74950.min.stderr10
-rw-r--r--tests/ui/const-generics/issues/issue-74950.rs3
-rw-r--r--tests/ui/const-generics/issues/issue-87076.rs4
-rw-r--r--tests/ui/const-generics/issues/issue-97278.rs2
-rw-r--r--tests/ui/const-generics/issues/issue-97278.stderr8
-rw-r--r--tests/ui/const-generics/issues/issue-99641.rs4
-rw-r--r--tests/ui/const-generics/issues/issue-99641.stderr8
17 files changed, 54 insertions, 53 deletions
diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr
index 16fabd1e8..e2d8c5ca0 100644
--- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr
+++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr
@@ -1,8 +1,10 @@
-error[E0741]: `(dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
+error[E0741]: `&'static (dyn A + 'static)` can't be used as a const parameter type
--> $DIR/issue-63322-forbid-dyn.rs:9:18
|
LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^
+ |
+ = note: `(dyn A + 'static)` must implement `ConstParamTy`, but it does not
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.rs b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.rs
index 116c3fcfb..8bc35ab3d 100644
--- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.rs
+++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.rs
@@ -7,7 +7,7 @@ struct B;
impl A for B {}
fn test<const T: &'static dyn A>() {
- //[full]~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
+ //[full]~^ ERROR `&'static (dyn A + 'static)` can't be used as a const parameter type
//[min]~^^ ERROR `&'static (dyn A + 'static)` is forbidden
unimplemented!()
}
diff --git a/tests/ui/const-generics/issues/issue-67185-2.stderr b/tests/ui/const-generics/issues/issue-67185-2.stderr
index 032b0c410..a2e5b8053 100644
--- a/tests/ui/const-generics/issues/issue-67185-2.stderr
+++ b/tests/ui/const-generics/issues/issue-67185-2.stderr
@@ -5,8 +5,8 @@ LL | <u8 as Baz>::Quaks: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following other types implement trait `Bar`:
- [[u16; 3]; 3]
[u16; 4]
+ [[u16; 3]; 3]
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@@ -17,8 +17,8 @@ LL | [<u8 as Baz>::Quaks; 2]: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following other types implement trait `Bar`:
- [[u16; 3]; 3]
[u16; 4]
+ [[u16; 3]; 3]
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@@ -29,8 +29,8 @@ LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following other types implement trait `Bar`:
- [[u16; 3]; 3]
[u16; 4]
+ [[u16; 3]; 3]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|
@@ -47,8 +47,8 @@ LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following other types implement trait `Bar`:
- [[u16; 3]; 3]
[u16; 4]
+ [[u16; 3]; 3]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@@ -65,8 +65,8 @@ LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following other types implement trait `Bar`:
- [[u16; 3]; 3]
[u16; 4]
+ [[u16; 3]; 3]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@@ -83,8 +83,8 @@ LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following other types implement trait `Bar`:
- [[u16; 3]; 3]
[u16; 4]
+ [[u16; 3]; 3]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|
diff --git a/tests/ui/const-generics/issues/issue-70273-assoc-fn.rs b/tests/ui/const-generics/issues/issue-70273-assoc-fn.rs
index a76488249..f02ab355f 100644
--- a/tests/ui/const-generics/issues/issue-70273-assoc-fn.rs
+++ b/tests/ui/const-generics/issues/issue-70273-assoc-fn.rs
@@ -10,5 +10,5 @@ impl T<0usize> for S {
}
fn main() {
- let _err = <S as T<0usize>>::f();
+ <S as T<0usize>>::f();
}
diff --git a/tests/ui/const-generics/issues/issue-71381.full.stderr b/tests/ui/const-generics/issues/issue-71381.full.stderr
index 962eaf75b..b6460e001 100644
--- a/tests/ui/const-generics/issues/issue-71381.full.stderr
+++ b/tests/ui/const-generics/issues/issue-71381.full.stderr
@@ -14,19 +14,6 @@ LL | const FN: unsafe extern "C" fn(Args),
|
= note: type parameters may not be used in the type of const parameters
-error[E0741]: using function pointers as const generic parameters is forbidden
- --> $DIR/issue-71381.rs:14:61
- |
-LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0741]: using function pointers as const generic parameters is forbidden
- --> $DIR/issue-71381.rs:23:19
- |
-LL | const FN: unsafe extern "C" fn(Args),
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0741, E0770.
-For more information about an error, try `rustc --explain E0741`.
+For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/issues/issue-71381.rs b/tests/ui/const-generics/issues/issue-71381.rs
index 66f819dbe..8a878efb4 100644
--- a/tests/ui/const-generics/issues/issue-71381.rs
+++ b/tests/ui/const-generics/issues/issue-71381.rs
@@ -12,8 +12,8 @@ unsafe extern "C" fn pass(args: PassArg) {
impl Test {
pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
- //~^ ERROR: using function pointers as const generic parameters is forbidden
- //~| ERROR: the type of const parameters must not depend on other generic parameters
+ //[min]~^ ERROR: using function pointers as const generic parameters is forbidden
+ //~^^ ERROR: the type of const parameters must not depend on other generic parameters
self.0 = Self::trampiline::<Args, IDX, FN> as _
}
@@ -21,8 +21,8 @@ impl Test {
Args: Sized,
const IDX: usize,
const FN: unsafe extern "C" fn(Args),
- //~^ ERROR: using function pointers as const generic parameters is forbidden
- //~| ERROR: the type of const parameters must not depend on other generic parameters
+ //[min]~^ ERROR: using function pointers as const generic parameters is forbidden
+ //~^^ ERROR: the type of const parameters must not depend on other generic parameters
>(
args: Args,
) {
@@ -31,6 +31,6 @@ impl Test {
}
fn main() {
- let x = Test();
+ let x = Test(std::ptr::null());
x.call_me::<PassArg, 30, pass>()
}
diff --git a/tests/ui/const-generics/issues/issue-71611.full.stderr b/tests/ui/const-generics/issues/issue-71611.full.stderr
index e109459f2..b55f410a0 100644
--- a/tests/ui/const-generics/issues/issue-71611.full.stderr
+++ b/tests/ui/const-generics/issues/issue-71611.full.stderr
@@ -6,13 +6,6 @@ LL | fn func<A, const F: fn(inner: A)>(outer: A) {
|
= note: type parameters may not be used in the type of const parameters
-error[E0741]: using function pointers as const generic parameters is forbidden
- --> $DIR/issue-71611.rs:5:21
- |
-LL | fn func<A, const F: fn(inner: A)>(outer: A) {
- | ^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0741, E0770.
-For more information about an error, try `rustc --explain E0741`.
+For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/issues/issue-71611.rs b/tests/ui/const-generics/issues/issue-71611.rs
index fbb91ca18..c917f6681 100644
--- a/tests/ui/const-generics/issues/issue-71611.rs
+++ b/tests/ui/const-generics/issues/issue-71611.rs
@@ -3,8 +3,8 @@
#![cfg_attr(full, allow(incomplete_features))]
fn func<A, const F: fn(inner: A)>(outer: A) {
- //~^ ERROR: using function pointers as const generic parameters is forbidden
- //~| ERROR: the type of const parameters must not depend on other generic parameters
+ //[min]~^ ERROR: using function pointers as const generic parameters is forbidden
+ //~^^ ERROR: the type of const parameters must not depend on other generic parameters
F(outer);
}
diff --git a/tests/ui/const-generics/issues/issue-74255.min.stderr b/tests/ui/const-generics/issues/issue-74255.min.stderr
index b462d8448..bbcf8682b 100644
--- a/tests/ui/const-generics/issues/issue-74255.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74255.min.stderr
@@ -1,5 +1,5 @@
error: `IceEnum` is forbidden as the type of a const generic parameter
- --> $DIR/issue-74255.rs:14:31
+ --> $DIR/issue-74255.rs:18:31
|
LL | fn ice_struct_fn<const I: IceEnum>() {}
| ^^^^^^^
diff --git a/tests/ui/const-generics/issues/issue-74255.rs b/tests/ui/const-generics/issues/issue-74255.rs
index 0e523926f..60b2fd37c 100644
--- a/tests/ui/const-generics/issues/issue-74255.rs
+++ b/tests/ui/const-generics/issues/issue-74255.rs
@@ -3,7 +3,11 @@
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
+#[cfg(full)]
+use std::marker::ConstParamTy;
+
#[derive(PartialEq, Eq)]
+#[cfg_attr(full, derive(ConstParamTy))]
enum IceEnum {
Variant
}
diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr
index 729ecc202..c37ee93d4 100644
--- a/tests/ui/const-generics/issues/issue-74950.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74950.min.stderr
@@ -1,5 +1,5 @@
error: `Inner` is forbidden as the type of a const generic parameter
- --> $DIR/issue-74950.rs:17:23
+ --> $DIR/issue-74950.rs:20:23
|
LL | struct Outer<const I: Inner>;
| ^^^^^
@@ -8,7 +8,7 @@ LL | struct Outer<const I: Inner>;
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `Inner` is forbidden as the type of a const generic parameter
- --> $DIR/issue-74950.rs:17:23
+ --> $DIR/issue-74950.rs:20:23
|
LL | struct Outer<const I: Inner>;
| ^^^^^
@@ -17,7 +17,7 @@ LL | struct Outer<const I: Inner>;
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `Inner` is forbidden as the type of a const generic parameter
- --> $DIR/issue-74950.rs:17:23
+ --> $DIR/issue-74950.rs:20:23
|
LL | struct Outer<const I: Inner>;
| ^^^^^
@@ -26,7 +26,7 @@ LL | struct Outer<const I: Inner>;
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `Inner` is forbidden as the type of a const generic parameter
- --> $DIR/issue-74950.rs:17:23
+ --> $DIR/issue-74950.rs:20:23
|
LL | struct Outer<const I: Inner>;
| ^^^^^
@@ -35,7 +35,7 @@ LL | struct Outer<const I: Inner>;
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `Inner` is forbidden as the type of a const generic parameter
- --> $DIR/issue-74950.rs:17:23
+ --> $DIR/issue-74950.rs:20:23
|
LL | struct Outer<const I: Inner>;
| ^^^^^
diff --git a/tests/ui/const-generics/issues/issue-74950.rs b/tests/ui/const-generics/issues/issue-74950.rs
index 3e1ca4735..43bb32265 100644
--- a/tests/ui/const-generics/issues/issue-74950.rs
+++ b/tests/ui/const-generics/issues/issue-74950.rs
@@ -3,8 +3,11 @@
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
+#[cfg(full)]
+use std::marker::ConstParamTy;
#[derive(PartialEq, Eq)]
+#[cfg_attr(full, derive(ConstParamTy))]
struct Inner;
// Note: We emit the error 5 times if we don't deduplicate:
diff --git a/tests/ui/const-generics/issues/issue-87076.rs b/tests/ui/const-generics/issues/issue-87076.rs
index 8a567678b..a32c1f965 100644
--- a/tests/ui/const-generics/issues/issue-87076.rs
+++ b/tests/ui/const-generics/issues/issue-87076.rs
@@ -3,7 +3,9 @@
#![feature(adt_const_params)]
#![allow(incomplete_features)]
-#[derive(PartialEq, Eq)]
+use std::marker::ConstParamTy;
+
+#[derive(PartialEq, Eq, ConstParamTy)]
pub struct UnitDims {
pub time: u8,
pub length: u8,
diff --git a/tests/ui/const-generics/issues/issue-97278.rs b/tests/ui/const-generics/issues/issue-97278.rs
index da0a9776f..8e7a1fcd9 100644
--- a/tests/ui/const-generics/issues/issue-97278.rs
+++ b/tests/ui/const-generics/issues/issue-97278.rs
@@ -9,6 +9,6 @@ enum Bar {
}
fn test<const BAR: Bar>() {}
-//~^ ERROR `Arc<i32>` must be annotated with `#[derive(PartialEq, Eq)]`
+//~^ ERROR `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter
fn main() {}
diff --git a/tests/ui/const-generics/issues/issue-97278.stderr b/tests/ui/const-generics/issues/issue-97278.stderr
index ff13cb505..31e92f840 100644
--- a/tests/ui/const-generics/issues/issue-97278.stderr
+++ b/tests/ui/const-generics/issues/issue-97278.stderr
@@ -1,8 +1,14 @@
-error[E0741]: `Arc<i32>` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
+error[E0741]: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter
--> $DIR/issue-97278.rs:11:20
|
LL | fn test<const BAR: Bar>() {}
| ^^^
+ |
+help: add `#[derive(ConstParamTy)]` to the struct
+ |
+LL + #[derive(ConstParamTy)]
+LL | enum Bar {
+ |
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-99641.rs b/tests/ui/const-generics/issues/issue-99641.rs
index fae6d3fc4..dd075a6ad 100644
--- a/tests/ui/const-generics/issues/issue-99641.rs
+++ b/tests/ui/const-generics/issues/issue-99641.rs
@@ -3,10 +3,10 @@
fn main() {
pub struct Color<const WHITE: (fn(),)>;
- //~^ ERROR using function pointers
+ //~^ ERROR `(fn(),)` can't be used as a const parameter type
impl<const WHITE: (fn(),)> Color<WHITE> {
- //~^ ERROR using function pointers
+ //~^ ERROR `(fn(),)` can't be used as a const parameter type
pub fn new() -> Self {
Color::<WHITE>
}
diff --git a/tests/ui/const-generics/issues/issue-99641.stderr b/tests/ui/const-generics/issues/issue-99641.stderr
index 349ebba08..800aec3ef 100644
--- a/tests/ui/const-generics/issues/issue-99641.stderr
+++ b/tests/ui/const-generics/issues/issue-99641.stderr
@@ -1,14 +1,18 @@
-error[E0741]: using function pointers as const generic parameters is forbidden
+error[E0741]: `(fn(),)` can't be used as a const parameter type
--> $DIR/issue-99641.rs:5:35
|
LL | pub struct Color<const WHITE: (fn(),)>;
| ^^^^^^^
+ |
+ = note: `fn()` must implement `ConstParamTy`, but it does not
-error[E0741]: using function pointers as const generic parameters is forbidden
+error[E0741]: `(fn(),)` can't be used as a const parameter type
--> $DIR/issue-99641.rs:8:23
|
LL | impl<const WHITE: (fn(),)> Color<WHITE> {
| ^^^^^^^
+ |
+ = note: `fn()` must implement `ConstParamTy`, but it does not
error: aborting due to 2 previous errors